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中獲得支援(所有現代瀏覽器)。

相關工具