csscolorsrgbcolor-spacehsl

Which color space does linear-gradient() uses?


Which color space does CSS's linear-gradient() function uses, RGB, HSL or HSV and why ?

Can I change the color space of my own choice ?


Solution

  • In the future you can specify the color space

    Compared to [css3-images], this level adds a token to customize color interpolation in gradients as described in CSS Color 4 § 12 Interpolation.

    linear-gradient() = linear-gradient(
      [ <angle> | to <side-or-corner> ]? || <color-interpolation-method>,
      <color-stop-list>
    )
    <side-or-corner> = [left | right] || [top | bottom]
    

    You can keep reading for more detail


    Safari has some support for this if you want to test: https://twitter.com/argyleink/status/1490376117064065025