Output Color

Loading… Please Wait

About HSLA to RGB Converter

Input an HSLA value like hsla(180deg, 100%, 50%, 0.5) and HSLA to RGB converter will convert this value to an RGB color like rgb(128, 255, 255).

Additionally, we can even specify a background color in RGBA format. Diversify India’s HSLA to RGB converter will mix these foreground and background colors to get the resultant RGB color.

HSLA color parameters are hue, saturation, lightness, and alpha. The output RGB color parameters are red, green, and blue.

Why Convert HSLA to RGB?

Converting HSLA to RGB is useful because RGB is the standard color model for digital screens and most image processing tasks. The HSLA color model represents colors in terms of hue, saturation, lightness, and alpha (transparency), which can simplify color adjustments and manipulations in design applications. Converting HSLA to RGB allows for compatibility with a wider range of digital applications.

How to Convert HSLA to RGB

To convert HSLA to RGB, you need to transform the hue, saturation, and lightness components into red, green, and blue components, and also include the alpha (A) component.

  1. Extract the values for Hue (H), Saturation (S), Lightness (L), and Alpha (A) from the HSLA code.
    • Example: hsla(20deg, 50%, 30%, 0.5) gives H = 20, S = 50%, L = 30%.
  2. Convert the Saturation (S) and Lightness (L) values to a range of 0 to 1 by dividing by 100.
    • 𝑆 = 50% / 100 = 0.5
    • L = 30% / 100 = 0.3
  3. Calculate the intermediate values for chroma (C), X, and m.
    • Chroma 𝐢 = (1 – ∣2𝐿 – 1∣) Γ— S
    • X = 𝐢 Γ— (1 – ∣(𝐻 / 60) % 2 – 1∣)
    • m = 𝐿 – (𝐢 / 2)
  4. Example Calculation:
    • C = (1 – ∣2 Γ— 0.3 – 1∣) Γ— 0.5 = 0.3
    • X = 0.3 Γ— (1 – ∣(20 / 60) % 2 – 1∣) = 0.1
    • m = 0.3 – (0.3 / 2) = 0.15
  5. Calculate the Red (R), Green (G), and Blue (B) values based on the Hue (H) range.
    • For 0 ≀ 𝐻 <60: (𝑅, 𝐺, 𝐡) = (𝐢 + π‘š, 𝑋 + π‘š, π‘š)
    • For 60 ≀ 𝐻 < 120: (𝑅, 𝐺, 𝐡) = (𝑋 + π‘š, 𝐢 + π‘š, π‘š)
    • For 120 ≀ 𝐻 <180: (𝑅, 𝐺, 𝐡) = (π‘š, 𝐢 + π‘š, 𝑋 + π‘š)
    • For 180 ≀ 𝐻 < 240: (𝑅, 𝐺, 𝐡) = (π‘š, 𝑋 + π‘š, 𝐢 + π‘š)
    • For 240 ≀ 𝐻 < 300: (𝑅, 𝐺, 𝐡) = (𝑋 + π‘š, π‘š, 𝐢 + π‘š)
    • For 300 ≀ 𝐻 < 360: (𝑅, 𝐺, 𝐡) = (𝐢 + π‘š, π‘š, 𝑋 + π‘š)
    • Example: Since H = 20, (𝑅, 𝐺, 𝐡) = (0.3 + 0.15, 0.1 + 0.15, 0.15) = (0.45, 0.25, 0.15)
  6. Convert the RGB values to a scale of 0 to 255.
    • 𝑅 = 0.45 Γ— 255 β‰ˆ 115
    • 𝐺 = 0.25 Γ— 255 β‰ˆ 64
    • 𝐡 = 0.15 Γ— 255 β‰ˆ 38
  7. Combine the RGB values:
    • Example: rgb(115, 64, 38)

List of Color Tools