# how to calculate hex values from hue , sat and lum?

Discussion in 'HTML' started by Fjodor Klondyke, Jan 13, 2004.

1. ### Fjodor KlondykeGuest

hello,

colors consist of hue, sat and lum.
every combination of hue, sat and lum has an hex color witch one can use in
an page.

my question is:
- when i know the hue, sat and lum numbers of a color, how do i get then the
hex values?
- and also the other way round: when i got the hex value of a color, who do
i then get the hue, sat and lum values?

thanks,

fjodor

Fjodor Klondyke, Jan 13, 2004

2. ### chrisGuest

If you have Photoshop try the color picker. It displays the values in every
important color system.

chris---

"Fjodor Klondyke" <> schrieb im Newsbeitrag
news:bu17je\$me5\$...
> hello,
>
> colors consist of hue, sat and lum.
> every combination of hue, sat and lum has an hex color witch one can use

in
> an page.
>
> my question is:
> - when i know the hue, sat and lum numbers of a color, how do i get then

the
> hex values?
> - and also the other way round: when i got the hex value of a color, who

do
> i then get the hue, sat and lum values?
>
> thanks,
>
> fjodor
>
>

chris, Jan 13, 2004

3. ### Fjodor KlondykeGuest

"chris" <> wrote in message
news:bu187k\$pj9\$00\$-online.com...
> If you have Photoshop try the color picker. It displays the values in

every
> important color system.
>

yes i know but i need to know how to do for an application i am making.

fjodor

Fjodor Klondyke, Jan 13, 2004
4. ### brucieGuest

in post <news:bu17je\$me5\$>
Fjodor Klondyke said:

> - when i know the hue, sat and lum numbers of a color, how do i get then the
> hex values?

about half way down the page you'll find the formula:
http://premshree.resource-locator.com/articles/fun_colors/

i would recommend a bit of software. theres gazillions of cute little
free ones.

--
brucie

brucie, Jan 13, 2004
5. ### Fjodor KlondykeGuest

Fjodor Klondyke, Jan 13, 2004
6. ### Steve PughGuest

"Fjodor Klondyke" <> wrote:

>colors consist of hue, sat and lum.

That's one possible colour space; there are others.

>every combination of hue, sat and lum has an hex color witch one can use in
>an page.

That's not automatically a given. Not all colours exist in all colour
spaces. I know that some colours exist in CMYK but not in RGB. Not
having worked with HSL much I can't say for sure whether the same is
true of HSL and RGB.

Certainly PhotoShop 7 will only let me enter integer values for Hue
Stauration and Brightness (as it calls it). This means that the
PhotoShop HSL colour space has only 360 x 100 x 100 = 3,600,000
colours in it whilst the RGB colour space has 256 x 256 x 256 =
16,77,216 colours in it, That's four half times as many.

The value used in HTML colours is just the RGB value of a colour

>my question is:
>- when i know the hue, sat and lum numbers of a color, how do i get then the
>hex values?
>- and also the other way round: when i got the hex value of a color, who do
>i then get the hue, sat and lum values?

Use a program that will display both values at once. Any decent
graphics package should be display both HSL and RGB values for a given
colour and most modern graphics packages will additionally display the
RGB value a hex triplet.

Steve

--
"My theories appal you, my heresies outrage you,
I never answer letters and you don't like my tie." - The Doctor

Steve Pugh <> <http://steve.pugh.net/>

Steve Pugh, Jan 13, 2004
7. ### WestGuest

"Fjodor Klondyke" <> wrote in message
news:bu17je\$me5\$...
> hello,
>
> colors consist of hue, sat and lum.
> every combination of hue, sat and lum has an hex color witch one can use

in
> an page.
>
> my question is:
> - when i know the hue, sat and lum numbers of a color, how do i get then

the
> hex values?
> - and also the other way round: when i got the hex value of a color, who

do
> i then get the hue, sat and lum values?
>

http://inetis.com/freeware.asp

--
W

West, Jan 13, 2004
8. ### Toby A InksterGuest

Steve Pugh wrote:

> That's not automatically a given. Not all colours exist in all colour
> spaces. I know that some colours exist in CMYK but not in RGB.

Well, I believe all colours that exist in CMYK do exist in RGB (and vice
versa) -- it's just that you need infinitely granular units of each
component colour.

> This means that the PhotoShop HSL colour space has only 360 x 100 x 100
> = 3,600,000 colours in it whilst the RGB colour space has 256 x 256 x
> 256 = 16,77,216 colours in it, That's four half times as many.

In fact, in PhotoShop's world (which is a fairly standard way of doing
HSL) the HSL colour space is even more limited than that.

Consider the following colours in HSL:

(1,0,0)
(2,0,0)
....
(360,0,0)
....
(1,1,0)
....
(360,1,0)
......
(1,100,0)
....
(360,100,0)

All are pure black -- there are just 36000 ways of specifying it! Whereas
with an RGB colour space, each of the 16777216 colours is unique.

--
Toby A Inkster BSc (Hons) ARCS
Contact Me - http://www.goddamn.co.uk/tobyink/?page=132

Toby A Inkster, Jan 13, 2004
9. ### Owen JacobsonGuest

On Tue, 13 Jan 2004 18:50:58 +0000, Toby A Inkster wrote:

> Consider the following colours in HSL:
>
> (1,0,0)
> (360,100,0)
>
> All are pure black -- there are just 36000 ways of specifying it! Whereas
> with an RGB colour space, each of the 16777216 colours is unique.

Interesting point. Is there a programmatic way to compare colours for
equality in HSL space?

--
Some say the Wired doesn't have political borders like the real world,
but there are far too many nonsense-spouting anarchists or idiots who
think that pranks are a revolution.

Owen Jacobson, Jan 14, 2004
10. ### Toby A InksterGuest

Owen Jacobson wrote:

> On Tue, 13 Jan 2004 18:50:58 +0000, Toby A Inkster wrote:
>
>> Consider the following colours in HSL:
>>
>> (1,0,0)
>> (360,100,0)
>>
>> All are pure black -- there are just 36000 ways of specifying it! Whereas
>> with an RGB colour space, each of the 16777216 colours is unique.

>
> Interesting point. Is there a programmatic way to compare colours for
> equality in HSL space?

The simplest way is to convert to RGB and compare there, although I'm sure
there is some way to do it in the HSL space directly.

Conversion algorithm is here:
http://130.113.54.154/~monger/hsl-rgb.html

--
Toby A Inkster BSc (Hons) ARCS
Contact Me - http://www.goddamn.co.uk/tobyink/?page=132

Toby A Inkster, Jan 14, 2004