RGBHLS(3NCARG)
π RGBHLS β bestie edition π
okay so this is RGBHLS, a lil routine from the NCAR GRAPHICS manual (section 3NCARG, we love a classic β¨). and what does it do?? it takes your color in RGB β you know, Red, Green, Blue, the vibe everyone knows β and translates it into HLS, aka Hue, Lightness, Saturation. it's giving glow-up, it's giving color-space conversion. no cap. π
β¨ NAME β¨
RGBHLS β converts a color specification given in the Red, Green, Blue (RGB) color space to color values in the Hue, Lightness, Saturation (HLS) color space. literally just a translator bestie π¦
π SYNOPSIS π
CALL RGBHLS (R, G, B, H, L, S)
that's it. six args, in, out, done. periodt. π
π C-BINDING SYNOPSIS π
for my C girlies (iykyk), you gotta include this:
#include <ncarg/ncargC.h>
void c_rgbhls (float r, float g, float b, float *h,
float *l, float *s)
note that h, l, and s are pointers because they're outputs, the other three are just vibing as inputs. β
π« DESCRIPTION π«
okay so here's the rundown on every single argument, and yes we're doing all six, nobody gets left out π
Rβ (REAL, input, range[0.,1.]) this represents the red intensity component of the input point in RGB color space. πGβ (REAL, input, range[0.,1.]) this represents the green intensity component of the input point in RGB color space. πΏBβ (REAL, input, range[0.,1.]) this represents the blue intensity component of the input point in RGB color space. πHβ (REAL, output, range[0.,360.)) this represents the hue of the input point in HLS color space. and here's a fun one: a value of(0.,0.,B)in the input space will result in a hue of0.in the output space. so if you feed it pure blue channel, hue comes back0.. noted. πLβ (REAL, output, range[0.,100.]) this represents the lightness value of the input point in HLS color space. lightness is a measure of the quantity of light β a lightness of0.is black, and a lightness of100.gives white. the pure hues occur at lightness value50. so like, 50 is the main character. β¨Sβ (REAL, output, range[0.,100.]) this represents the saturation value of the input point in HLS color space. saturation is a measure of how much white light is mixed with the color. saturation values of0.represent grays (with a gray value equal to the lightness valueL). saturation values of100.are fully saturated colors. the hue is undefined whenS=0. π¨ (yes bestie, undefined, we don't make the rules.) the fully saturated pure hues occur whenS=100.andL=50.. and the saturation value should be thought of as a percentage. π―
lowkey theS=0thing is important β no saturation means no hue, so don't go reading thatHvalue like it means something. it doesn't. π
π§ͺ EXAMPLES π§ͺ
use the ncargex command to see the following relevant examples: tcolcv, fcce02. go look, they ate. π₯
πΈ C-BINDING DESCRIPTION πΈ
the C-binding argument descriptions are the same as the FORTRAN argument descriptions. so like... scroll up, it's all the same tea. βπ«Ά
π ACCESS π
to use RGBHLS or c_rgbhls, load the NCAR Graphics libraries ncarg, ncarg_gks, and ncarg_c β preferably in that order. don't be chaotic about the order, bestie, it matters. π
π’ MESSAGES π’
see the colconv man page for a description of all Colconv error messages and/or informational messages. everything lives over there. π
π SEE ALSO π
Online: colconv, hlsrgb, hsvrgb, rgbhsv, rgbyiq, yiqrgb, ncarg_cbind.
Hardcopy: NCAR Graphics Fundamentals, UNIX Version
(if you ever need to go the other way, hlsrgb is right there, we're obsessed with a reversible function π¦)
Β©οΈ COPYRIGHT Β©οΈ
Copyright (C) 1987-2009 University Corporation for Atmospheric Research The use of this Software is governed by a License Agreement.
and that's the whole page!! π this lil gem is from the NCAR Graphics docs, page RGBHLS(3NCARG), and the version/date on the tin says March 1993 under UNIX. yes, 1993, she's vintage and she still slays. ππ mwah, go convert some colors bestie π«Άβ¨
π¦ where this page comes from
- debian bookworm: libncarg-dev 6.6.2.dfsg.1-1
- debian trixie: libncarg-dev 6.6.2.dfsg.1-10+b2
- ubuntu jammy: libncarg-dev 6.6.2-10build2
- ubuntu questing: libncarg-dev 6.6.2.dfsg.1-10build2
- ubuntu resolute: libncarg-dev 6.6.2.dfsg.1-12
- ubuntu stonking: libncarg-dev 6.6.2.dfsg.1-12build2
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms