// DEV / COLOR

颜色转换Color Converter

HEX、RGB、HSL 实时互转,带透明度与明暗对比度参考。Convert between HEX, RGB and HSL with alpha and contrast ratio reference.

透明度Alpha100%
HEXHEX#22d3ee
RGBRGBrgb(34, 211, 238)
HSLHSLhsl(188, 86%, 53%)
WCAG 对比度WCAG contrast正文要求:AA ≥ 4.5,AAA ≥ 7Body text: AA ≥ 4.5, AAA ≥ 7
与白色对比Against white
1.81:1AAAAA
与黑色对比Against black
11.62:1AAAAA

常见问题FAQ

颜色转换支持哪些输入写法?Which color formats are accepted?

支持 HEX(#rgb、#rgba、#rrggbb、#rrggbbaa,可省略 #)以及 rgb()、rgba()、hsl()、hsla(),并可在 HEX、RGB、HSL 之间实时互转。HEX in the forms #rgb, #rgba, #rrggbb and #rrggbbaa with the # optional, plus rgb(), rgba(), hsl() and hsla(). Values convert between HEX, RGB and HSL as you type.

对比度是怎么算的?How is the contrast ratio calculated?

按 WCAG 公式计算与白色、黑色的对比度,并标注是否达到 AA(4.5:1)与 AAA(7:1)。半透明颜色会先与底色混合再计算。Contrast against white and black follows the WCAG formula and is marked against AA at 4.5 to 1 and AAA at 7 to 1. Semi-transparent colors are blended with the background before measuring.

同类工具Related tools

所有计算都在你的浏览器本地完成,输入内容不会上传到任何服务器。Everything runs locally in your browser. Nothing you type is ever uploaded to a server.