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 can I adjust the huse, saturation, and lightness of in image in HTML5 Canvas?

The simplest method possible is preferable. I unfortunately don't know much about image manipulation!
Jacob Kelley
  • 395
  • 3
  • 13
1
vote
3 answers

How to de-saturate a color defined by RGB in declarative QML

Using QtQuick, is it possible to take an existing color defined by RGB and desaturate it without resorting to Javascript?
JeffV
  • 52,985
  • 32
  • 103
  • 124
1
vote
1 answer

HSL color models in animation

Currently I am using the animate tag to cycle through some colors. How are the colors being interpolated, and can I use HSL…
posfan12
  • 2,541
  • 8
  • 35
  • 57
1
vote
2 answers

Histogram equalization (or stretching) of RGB picture in python

I am creating automatically JPG pictures from multispectral data. Created picture is very dark. So I thought it would be best idea change brightness (like Image.Enhance in PIL). But there was a problem, because some pictures need more brightness…
Bulva
  • 1,208
  • 14
  • 28
1
vote
1 answer

hsl to rgb conversion. Values waaaay off. Compare to solution. What am I doing differently?

SOLVED! see EDITs I built a color picker app. Very simple; you click on the rgb color palette, and it creates a swatch with RGB values, HSL values, and HEX values. I used this formula for the conversions. Basically, I built my HSL values from the…
BenTheHumanMan
  • 327
  • 2
  • 11
1
vote
1 answer

HSL to RGB conversion math

When converting from HSL to RGB the math involved seems relatively simple, especially when converting grayscale as the RGB values are the lightness multiplied by 255. However take this hex #eeeeee. It's RGB value is rgb(238,238,238) and it's HSL…
David Barker
  • 14,484
  • 3
  • 48
  • 77
1
vote
1 answer

Use convert to replace lightness channel with another lightness channel

How can I use ImageMagick to replace 1.png's HSL lightness channel with 2.png's HSL lightness channel? I almost cannot understand the convert syntax.
Simon Kuang
  • 3,870
  • 4
  • 27
  • 53
1
vote
1 answer

d3.hsl fails on Safari

I put together a simple HTML page: $(document).ready(function() { var canvas = document.getElementById("myCanvas"); var ctx = canvas.getContext("2d"); canvas.width = window.innerWidth; canvas.height = window.innerHeight; …
P i
  • 29,020
  • 36
  • 159
  • 267
1
vote
4 answers

How can I create a color with values for green, blue, orange, and gold only?

If one knows the "weights" of red, green, and blue, one can create a color using a class like .blaRGB { color: rgb(128, 128, 128) } .blaHSL { color: hsl(33%, 34%, 33%) } and use it in HTML like so:

BLA RGB

B. Clay Shannon-B. Crow Raven
  • 8,547
  • 144
  • 472
  • 862
1
vote
0 answers

D3 HSL color interpolation counterclockwise

In D3, HSL color interpolation always goes in the clockwise direction. If I go from yellow at 60 degrees to blue at 240 degrees it always goes through green at 120 degrees. Reversing the interpolation colors changes the endpoints of yellow and blue,…
M Wade
  • 177
  • 1
  • 11
1
vote
1 answer

Mistake passing parameters for simple RGB to HSL color converter

Okay I am trying to follow this guide to making a converter in c#: http://www.geekymonkey.com/Programming/CSharp/RGB2HSL_HSL2RGB.htm here is my code: using System; using System.Collections.Generic; using System.Linq; using System.Text; using…
kujosHeist
  • 810
  • 1
  • 11
  • 25
1
vote
2 answers

Smoothly fade image RGB by setting SRC data Javascript

I am working on emulating the behavior of the server box on https://mcprohosting.com/ but without sending multiple images (currently there are 3 images that rotate using javascripts .fadeout() calls and such. My best attempt at doing this right now…
Matthew Salsamendi
  • 294
  • 1
  • 5
  • 14
1
vote
0 answers

Computing a color in a good range ("different enough" from other color) using JavaScript

I'm working on an open source project that uses a lot of key=value tags, and represents them in a HTML UI with labels that show the value as text, and deterministically generates a color for the foreground text based on the key (code here). To get…
Dieter_be
  • 853
  • 7
  • 13
1
vote
4 answers

Javascript - Match and parse Hsl color string with Regex

I'm trying to parse a hsl color string and get an hex color string from it. I tried using regex but can't figure it out. How my regexp should be look like to match and parse a hsl color string to hue, saturation and value fileds. The input will be…
Halil Ibrahim
  • 1,339
  • 1
  • 20
  • 39
1
vote
1 answer

Get Color From HSL Values in Flash

I just want to know how to get a Color() Object or a Hex Color Value ( uint ) from HSL values in flash.´ The idea behind the HSL is, that i can map vaues from a range ob anything, to the range of the Hue ( 0 - 360 ) and get the coresponding…
Ace
  • 1,437
  • 6
  • 28
  • 46