颜色转换工具(HEX/RGB/HSL)
在HEX、RGB和HSL格式之间转换颜色。可视化选取颜色,或手动输入数值。
#535bebrgb(83, 91, 235)hsl(237, 79%, 62%)如何使用本工具
- 1
Click the color swatch to open your operating system's color picker and choose a color visually.
- 2
Or type a 6-digit HEX value (such as #535beb, with or without the leading #) into the text field.
- 3
Read the matching rgb(R, G, B) and hsl(H, S%, L%) strings in the result cards below.
- 4
Copy whichever format you need straight into your CSS or design file.
什么是颜色转换工具(HEX/RGB/HSL)?
HEX、RGB和HSL是表达同一种颜色的三种方式。HEX(#RRGGBB)在CSS和设计工具中最为常见。RGB(rgb(R,G,B))以数值方式分离各通道。HSL(hsl(H,S%,L%))对人来说更直观:色相(hue)是颜色本身,饱和度是色彩强度,明度(lightness)则是亮度。设计配色方案时使用HSL;在实现时再转换为HEX。
常见使用场景
Translating a brand HEX code from a style guide into the rgb() values a legacy stylesheet or email template requires.
Grabbing the HSL form of a color so you can nudge its lightness or saturation while keeping the same hue for a palette.
Checking the exact RGB channels of a color picked from a screenshot or mockup before writing it into CSS.
Confirming what a designer's HEX swatch becomes in RGB for a canvas, SVG, or charting library that wants numeric channels.
Teaching or learning how hexadecimal color notation maps to decimal RGB and to the HSL model.
Quickly sampling a color visually with the picker and reading all three CSS-ready notations at once.
常见问题
我应该在什么时候用HSL而不是HEX?▼
OKLCH和现代颜色空间呢?▼
相关工具
CSS Box Shadow生成器
以可视化方式创建CSS box-shadow值。实时预览并复制生成的CSS。
CSS渐变生成器
创建线性和径向CSS渐变。以可视化方式选择颜色,并复制生成的CSS。
Cubic Bezier缓动曲线生成器
为CSS创建cubic-bezier缓动曲线。内置标准预设。
配色方案生成器
从任意基准色生成和谐的配色方案。支持互补色、邻近色、三角色和单色方案。
CSS Border Radius生成器
以可视化方式创建复杂的CSS border-radius值。可独立控制每个圆角。
CSS Clamp()生成器
使用clamp()生成流式、响应式的CSS数值。在视口范围内于最小值与最大值之间平滑缩放。