如何将 3 位 HTML 十六进制颜色转换为 6 位灵活十六进制颜色 [英] How to convert 3-digit HTML hex colors to 6-digit flex hex colors
本文介绍了如何将 3 位 HTML 十六进制颜色转换为 6 位灵活十六进制颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想将来自 HTML CSS 的三位数十六进制颜色转换为 Flex 的六位数十六进制颜色.谁能给我代码将 3 位十六进制颜色转换为 6 位等效颜色?
I want to convert a three-digit hex color which is coming from HTML CSS to a six-digit hex color for Flex. Can anyone give me code to convert 3-digit hex colors to their 6-digit equivalents?
推荐答案
通过将每个数字加倍来扩展三位十六进制颜色(参见 w3 规范).所以 #F3A
被扩展为 #FF33AA
.
The three digit hex colors are expanded by doubling each digit (see w3 spec).
So #F3A
gets expanded to #FF33AA
.
这篇关于如何将 3 位 HTML 十六进制颜色转换为 6 位灵活十六进制颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文