Questions tagged [hsl]

HSV is cylindrical color model that determines colors by hue (0°-360°), saturation (color intensity) and lightness (from black over the color to white).

The HSL model describes colors in terms of hue, saturation, and lightness (also called luminance). (Note: the definition of saturation in HSL is substantially different from HSV) The model has two prominent properties:

  • The transition from black to a hue to white is symmetric and is controlled solely by increasing lightness

    • Shading and tinting are controlled by a single value, lightness
  • Decreasing saturation transitions to a shade of gray dependent on the lightness, thus keeping the overall intensity relatively constant

    • Tones are controlled by a single value, saturation

The properties mentioned above have led to the wide use of HSL, in particular, in the CSS3 color model. As in HSV, hue corresponds directly to the concept of hue in the Color Basics section. The advantages of using hue are

  • The relationship between tones around the color circle is easily identified
  • Shades, tints, and tones can be generated easily without affecting the hue

http://xahlee.info/js/i/HSL_color_model.png

Lightness combines the concepts of shading and tinting from the Color Basics section. Assuming full saturation, lightness is neutral at the midpoint value, for example 50%, and the hue displays unaltered. As lightness decreases below the midpoint, it has the effect of shading. Zero lightness produces black. As lightness increases above 50%, it has the effect of tinting, and full lightness produces white.

At zero saturation, lightness controls the resulting shade of gray. A value of zero still produces black, and full lightness still produces white. The midpoint value results in the "middle" shade of gray, with an RGB value of (128,128,128).

As saturation decreases, it produces tones of the reference hue that converge on a shade of gray that is determined by the lightness. This keeps the total intensity relatively constant.


Note that the physical nature of additive color prevents the scheme from working exactly except for hues halfway between the primary and secondary hues. However, the total intensity of the tones resulting from decreasing saturation are much closer than tinting alone, as in HSV.

265 questions
5
votes
2 answers

Using CSS Variables in HSLA in SCSS

So I have been trying to use CSS variables in HSLA. I need to keep the same color, but just change the opacity.
// content here
SCSS :root { --color: 332, 61%, 78%; } div { background: hsla(var(--color),…
sammiepls
  • 1,340
  • 2
  • 13
  • 19
5
votes
2 answers

Convert YUV into HSL or HSV bypassing the RGB step

Wikipedia and plethora of online resources provide detailed and abundant help with various color space conversions from/to RGB. What I need is a straight YUV->HSL/HSV conversion. In fact what I need is just the Hue (don't care much for the…
YePhIcK
  • 5,816
  • 2
  • 27
  • 52
5
votes
3 answers

How can I check if my browser supports HSL colours in Javascript?

I want to be able to determine if a browser supports HSL colours, if not then I want to fall back on generated RGB colours (i have both generated). Is there any way to do that without actually checking what browser the user is using?
paullb
  • 4,293
  • 6
  • 37
  • 65
5
votes
2 answers

Interpolate HSL Colours

I am building a star visualisation engine, and need to interpolate values received from the API. The HSL colour stops are: -.63, hsl: 228° 100% 80%, .165, hsl: 224° 100% 90%, .33, hsl: 240° 100% 98%, .495, hsl: 64° 100% 92%, .66, hsl: 52° 100%…
j_d
  • 2,818
  • 9
  • 50
  • 91
5
votes
1 answer

Determine HSL variation to transform a color in another one

I use LESS, and I would like to take advantage by various integrated color functions that allow to set only few basic colors, and then derive others changing Hue, Saturation, Lightness, Spin, ecc. Let's imagine that we have the following 2 colors (a…
Luca Detomi
  • 5,564
  • 7
  • 52
  • 77
5
votes
7 answers

PHP function to convert HSL to RGB or Hex

Does anyone know a PHP function (for >5.3) which can convert an HSL color to either RGB or Hex? I've tried a dozen Google searches and none of the functions I have found work as expected. It doesn't matter whether the function converts to RGB or hex…
Rich Jenks
  • 1,723
  • 5
  • 19
  • 32
5
votes
3 answers

How can I generate a rainbow circle using HTML5 canvas?

I would like to generate a canvas image using gradients in some clever way. I would like the image to looks something like this: I just can't get my head around it. I need to generate lines in the form and arc - or use gradients with color stops in…
Yonder
  • 719
  • 2
  • 13
  • 26
4
votes
2 answers

Converting HSL to RBG

I'm trying to convert some HSL value to RBG with Data.Colour module. Hackage doc said that Hue is always in the range 0-360. But there are now any ranges of Saturation and Lightness values. Are they in [0,100] or in [0,1] ranges? I suppose that…
4
votes
1 answer

Color profiles conversion

I have a project on color profile conversion in C++, where the idea is to use CIELAB as transition between RGB and all others (CMY; CMYK; HSV; HSL;...).But I have one big big problem. I have searched everywhere and I cannot find any formula or…
magic
  • 41
  • 2
4
votes
3 answers

How to determine color of the pixel or What degree range of Hue correspond to certain color?

Is there some convention to divide the HSL color circle into degree ranges to define basic colors? For example, degrees 80-150 would be considered green, degrees 210-280 as blue, and so on. I'd like to automatically detect pixel's color belonging to…
w.k
  • 8,218
  • 4
  • 32
  • 55
4
votes
1 answer

What happens when an AppendStructuredBuffer overflows in a compute shader?

I have a Unity project in which I'm writing to an AppendStructuredBuffer via Append(triangle) in a compute shader. In this instance, I know the theoretical limit to the number of triangles that could exist, so the obvious correct approach…
PeterT
  • 1,454
  • 1
  • 12
  • 22
4
votes
1 answer

How do you lightness thresh hold with HSL on OpenCV?

There is a project that im working on which required the color white detection, after some research i decided to use covert RGB image to HSL image and thresh hold the lightness to get the color white, im working with openCV so wonder if there is a…
Minh Cht
  • 305
  • 2
  • 5
  • 13
4
votes
1 answer

Reading correct value from hsl color wheel

I'm trying to read a color value from a dynamically created color wheel. There is, however, clearly an offset between the color that I'm getting and the one that I'm hovering over. I recreated the issue on JS…
vikdoro
  • 158
  • 1
  • 7
4
votes
1 answer

Sass color transform calculation

I have two shades of the color blue (#1E95EF -> #1988DD), and need to figure out the color transformation that has happened in order to replicate it across other colors in my palette (red, green etc). I've used combinations of darken()/lighten() &…
Joe Austin
  • 557
  • 7
  • 24
4
votes
1 answer

Get hsl color with javascript

If I have this: .box{ color: #FF3010; background: hsl(0,90%,40%); } and then this: var box = document.querySelector(".box"); var result = document.querySelector(".result"); result.innerHTML = "BG color:…
Vandervals
  • 5,774
  • 6
  • 48
  • 94
1 2
3
17 18