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 of 0. in the output space. so if you feed it pure blue channel, hue comes back 0.. 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 of 0. is black, and a lightness of 100. gives white. the pure hues occur at lightness value 50. 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 of 0. represent grays (with a gray value equal to the lightness value L). saturation values of 100. are fully saturated colors. the hue is undefined when S=0. 🚨 (yes bestie, undefined, we don't make the rules.) the fully saturated pure hues occur when S=100. and L=50.. and the saturation value should be thought of as a percentage. πŸ’―
lowkey the S=0 thing is important β€” no saturation means no hue, so don't go reading that H value 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 (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 🫢✨