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
0
votes
1 answer

Is it neccessary to change the RGB color to HSL in order to change specific range of color?

I wanted to change specific range of color to another color. For instance, i want to change all shades of yellow color to white.
Sauce
  • 3
  • 3
0
votes
1 answer

Cannot load HSL for IPOPT in Google Colab

I'm trying to use HSL MA97 for IPOPT on Google colab. I succeeded to run IPOPT (and cyipopt) without HSL linear solver, but failed to run with HSL, for example ma97. Thank you for your help. The setting is as follows. install IPOPT using !apt…
RetroD
  • 1
  • 2
0
votes
2 answers

Convert HSL color to RGB and HEX using SQL

The problem started when I needed to apply conditional formatting to a table with smooth color changes in MS SQL Server Reporting Services (SSRS). It is impossible with standard SSRS functionality. But you can use the table data to smoothly change…
0
votes
1 answer

How to stop Javascript code to convert hsl to rgb automatically

I have this code where I assign a color to an object and then I use a conditional to check if this item have already been selected or not. However the conditional doesn't work because the javascript (or the browser) converts the hsl to rgb which…
0
votes
0 answers

Why does editing colors in Angular not work correctly?

Heyo, I'm trying to set colors for some inline SVG element programmatically but it doesn't really work. My code has, for example: baseColor: HSLColor = HSLColor.of(30, 40, 50); //ugly but good for experiments strokeColor: HSLColor = HSLColor.of(0,…
Panossa
  • 371
  • 5
  • 17
0
votes
1 answer

How to colorize a drawable?

How can I colorize Android drawable by setting hue, saturation delta and brightness delta?
fhucho
  • 34,062
  • 40
  • 136
  • 186
0
votes
3 answers

Simplest Example of Linear Interpolation for Color in Python

I am looking for a way to color objects based on the colors of nearby objects, and from what I've read it looks like linear interpolation is the thing to do. I have looked through a lot (all?) of the posts on SO about linear interpolation for color…
Doda
  • 285
  • 1
  • 9
0
votes
2 answers

Is there a function to convert HSL to color:int in actionscript?

I want to define color value by using HSL(Hue, Saturation, Lightness) not RGB. Does actionscript have a function for that? For example, I want to write code like the following: var color:int = hsl(10, 90, 30); sprite.graphics.lineStyle(2, color);
js_
  • 4,671
  • 6
  • 44
  • 61
0
votes
1 answer

python - check presence of predefined color ranges in image

I would need to verify if and how much of certain predefined color ranges are present in a image file. each color range is defined by 6 variables and a counter in a colorRange class: hS (hue start) hE (hue end) sS (saturation start) sE (saturation…
sharkyenergy
  • 3,842
  • 10
  • 46
  • 97
0
votes
0 answers

Is there a concept of "opposite HSL color"?

I would like to have fields for which background color will be generated from their content (this will be in javascript but this does not matter I believe for my question). I will therefore have, for instance, a background of hsl(218, 52%, 83%)…
WoJ
  • 27,165
  • 48
  • 180
  • 345
0
votes
1 answer

Shortcut to adjust ggplot code to change color of all text - R

I am trying to edit my code to make all the text and labels with the following color information RGB: (204, 14, 68) Hex: #CC0E44 HSL: (243, 222, 109) Here is my current code and its current output ggplot(Alldata, aes(Date)) + geom_tile(aes(alpha =…
MacroChair
  • 57
  • 5
0
votes
1 answer

how to override hsl lightness with pure css

I have a nav wrapped by a header
With these styles header { background-color: hsl(180, 90%, 35%); } nav { background-color: hsl(180,80%,25%); } The nav color is the header color but darker I'd like to…
sankiago
  • 79
  • 9
0
votes
0 answers

Chartist.js: how to set pie chart slice colors

I have a variable length series array which I feed to the Chartist.js pie chart. It draws slices in terrible red colors. There is an HSL color example in the Documentation, but it starts from red too. How do I start with a color #0099ff for the max…
linuxoid
  • 1,415
  • 3
  • 14
  • 32
0
votes
1 answer

Faster way to loop through the pixel of a frame in Python?

Trying to find the HSL per pixel value from a frame of input video but it's taking too much time about 0.2s but want to reduce the time to at least within 0.1s. def colorize(im, h, s, l_adjust): result = Image.new('RGBA', im.size) pixin =…
MSI
  • 105
  • 9
0
votes
3 answers

How to properly convert hsl colors to rgb colors in lua?

I have the following code: #!/usr/bin/env lua5.3 -- Code adapted from https://github.com/EmmanuelOga/columns/blob/master/utils/color.lua#L51 local function hslToRgb(h, s, l, a) local r, g, b h = (h / 255) s = (s / 100) l = (l /…
SkyyySi
  • 53
  • 5