RevealTheme logo

颜色转换工具(HEX/RGB/HSL)

在HEX、RGB和HSL格式之间转换颜色。可视化选取颜色,或手动输入数值。

HEX
#535beb
RGB
rgb(83, 91, 235)
HSL
hsl(237, 79%, 62%)

如何使用本工具

  1. 1

    Click the color swatch to open your operating system's color picker and choose a color visually.

  2. 2

    Or type a 6-digit HEX value (such as #535beb, with or without the leading #) into the text field.

  3. 3

    Read the matching rgb(R, G, B) and hsl(H, S%, L%) strings in the result cards below.

  4. 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?
在设计时:HSL让你能够独立调整明度或饱和度。随后再转换为HEX用于代码。
OKLCH和现代颜色空间呢?
OKLCH在感知上是均匀的,更利于实现无障碍设计。它在CSS Color Level 4中获得支持(所有现代浏览器)。

相关工具