颜色转换器
在浏览器中转换HEX/HEXA、RGB/RGBA与HSL/HSLA颜色;支持传统逗号与现代空格/斜杠语法、百分比通道、四种色相单位和透明预览。
使用步骤
如何使用
- Enter a supported HEX, RGB, or HSL color.
- Convert it and inspect the normalized color preview.
- Copy the complete list of HEX, HEXA, RGB, RGBA, HSL, and HSLA values.
Supported CSS color forms
Use #RGB, #RGBA, #RRGGBB, or #RRGGBBAA; legacy comma-separated rgb(), rgba(), hsl(), and hsla(); or modern space-separated RGB/HSL with an optional slash alpha. RGB channels may be 0–255 numbers or percentages. Hue accepts degrees, turns, radians, or gradians.
Defined ranges and rounding
Out-of-range channels are rejected rather than silently clamped. RGB output uses nearest whole 8-bit channels. HSL output uses at most one decimal place, and alpha uses at most three decimals. Conversion is limited to standard sRGB; named colors, Lab, LCH, and wide-gamut color() spaces are not interpreted.
常见问题
你可能还想知道
Can I convert a transparent color?
Yes. Four- or eight-digit HEX and RGB/HSL alpha syntax produce both RGBA/HSLA and eight-digit HEXA output.
Why does the HEX alpha differ slightly?
HEXA stores alpha in one byte, so values are rounded to one of 256 levels. RGBA and HSLA show alpha to at most three decimals.
Can I enter a named color such as rebeccapurple?
No. Enter its HEX, RGB, or HSL value; this keeps the accepted syntax and output consistent across browsers.