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
1
vote
1 answer

How to fix "Sub or Function not defined" when using HSL Function

I'm trying to set the interior color of some cells using HSL instead of RGB. Judging by this documentation from Microsoft, it's very simple: https://learn.microsoft.com/en-us/office/client-developer/visio/hsl-function The syntax is simply HSL(** hue…
squidgeny
  • 41
  • 5
1
vote
1 answer

Edit a RGB colorspace image with HSL conversion failed

I'm making an app to edit image's HSL colorspace via opencv2 and some conversions code from Internet. I suppose the original image's color space is RGB, so here is my thought: Convert the UIImage to cvMat Convert the colorspace from BGR to…
Itachi
  • 5,777
  • 2
  • 37
  • 69
1
vote
1 answer

How to convert RGB565 to HSL Color in C

I'm new to converting image types. I would like to determine the color of each pixel on the screen. I can read the colors from the frame buffer, but they are all in RGB565. For tracking a certain color, I would like to convert the RGB565 to HSV so I…
1
vote
3 answers

Add or subtract 50% to Lightness value in HSL format in a Sass mixin

I have several colors in HSL format, this one of them: 284, 3, 30. I need to create a Sass mixin for the developers where all they need to do is add or subtract 50% of the Lightness value (30) in order to achieve the desired color as per our brand…
Ricardo Zea
  • 10,053
  • 13
  • 76
  • 79
1
vote
1 answer

How to calculate luminance in HSL

Just checked this website http://www.workwithcolor.com/hsl-color-schemer-01.htm and I am curious how to get those numbers in Lum(luminance)? I can not find a proper formula online to get those results. Thanks
Lucas Hu
  • 159
  • 1
  • 1
  • 7
1
vote
0 answers

Get Complementary Color of Hex Color in C

I want to get the complementary color of an hexadecimal color in C. From what I understood I need to first convert it to HSL and then change the angles. But how can I do this conversion? Is that any other way to get the complementary?
joana
  • 23
  • 3
1
vote
1 answer

How to control image contrast based on HSV/RGB values

I was wondering if it was possible to modify the contrast of an image, by modifying its RGB, HSV (or similar) values. I am currently doing the following to mess with luminance, saturation and hue (in python): import numpy as np from PIL import…
John Doe
  • 108
  • 12
1
vote
1 answer

Python: reduce lightness of a RGB color

Is there a simple way to change the lightness of a color given as RGB string? E.g. in_RGB = '#FF0000' --> out_RGB = '#CC0000'
Don
  • 16,928
  • 12
  • 63
  • 101
1
vote
1 answer

Best way to handle multiple checks ruby

So I'm trying to write a converter for HSL to RGB (and eventually into hex) I'm following this colorspace conversion theory and I seem to be stuck on step 6 Now we need to do up to 3 tests to select the correct formula for each color channel.…
1
vote
1 answer

C++: Adjust HSL of an image without clipping

I'm trying to program a Hue/Saturation/Lightness filter for an image (in C++). The RGB->HSL conversions work fine, but my issue comes when accounting for the fact that each pixel has a different initial saturation and lightness. For each pixel, I've…
TheTrueJard
  • 471
  • 4
  • 18
1
vote
0 answers

CSS hue-rotate/saturate/brightness not accurately showing some colors

I'm using Javascript to filter/shift a red icon image to another color specified in RGB. More specifically, I'm using CSS filters hue-rotate, brightness and saturate to shift colors from pure red to my target color. My result works well for many…
Krulwich
  • 41
  • 9
1
vote
1 answer

Testing HSL colours, ideally avoiding Red adjacent to Green (common colour-blindness type)

Inspired by the top answer on this page I wrote a python program to generate N distinct HEX colours. The difference is that the original author would generate saturation and luminance by using math.random(), whereas I use a trigonometric function…
Alex Leach
  • 1,199
  • 2
  • 12
  • 26
1
vote
1 answer

Circular data in machine learning algorithms

I have a circular data (color component Hue of HSL) and I need to use it as predictor in one of the machine learning algorithms. How can I convert it to the regular continuous variable? In order to clarify the problem, suppose we have an object in…
1
vote
1 answer

I am trying to make an HSV color picker but I can't figure out how to generate the overlay image

So like I said in the title, I'm trying to make a color picker (with HTML/CSS/JS, if that matters) and I'm basing it off of DuckDuckGo's color picker (seen here). They use a semi-transparent image overlayed on a div with a solid color. I thought…
1
vote
1 answer

PHP - Generate color from Green -> Black -> Red

In PHP I have a list with values ranging from 0 to 1 and everything in between. I want to give each value it's own color. I want 0 to be green, 0.5 to be black and 1 will be red. A value like 0.1 should still be green but starting to gradient to…
DijkeMark
  • 1,284
  • 5
  • 19
  • 41