Colconv(3NCARG)
π Colconv β the NCAR GRAPHICS color-model glow-up π
okay bestie, welcome to Colconv (that's Colconv(3NCARG), the NCAR GRAPHICS one). this is the routine that lets you convert a color spec between the color models RGB, HSV, HLS, and YIQ. that's literally it, that's the whole vibe. she converts. she slays. periodt. π
β¨ NAME β¨
Colconv β Allows a user to convert among the color models RGB, HSV, HLS, and YIQ. π¨π¦
πΈ SYNOPSIS πΈ
okay so there's a whole lil squad here, one function per conversion. no cap, they all do exactly what their name says:
HLSRGBβ Converts a color specification given as Hue, Lightness, and Saturation (HLS) values to Red, Green, and Blue (RGB) intensity values in the RGB color space.HSVRGBβ Converts a color specification given in the Hue, Saturation, and Value (HSV) color space to color values in the Red, Green, Blue (RGB) color space.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.RGBHSVβ Converts a color specification given in the Red, Green, Blue (RGB) color space to color values in the Hue, Saturation, and Value (HSV) color space.RGBYIQβ Converts a color specification given in the RGB Red, Green, Blue, (RGB) color space to a color specification in the YIQ color space.YIQRGBβ Converts a color specification given in the YIQ color space to the equivalent color specification in the Red, Green, Blue (RGB) color space.
it's giving "one job, done flawlessly." π
π C-BINDING SYNOPSIS π
for my C girls, you get lowercase lil versions of everybody. first, obviously:
#include <ncarg/ncargC.h>
and then the cast, in order:
c_hlsrgb
c_hsvrgb
c_rgbhls
c_rgbhsv
c_rgbyiq
c_yiqrgb
π yes bestie, c_hlsrgb goes from HLS to RGB even though the letters read the other way. that's just how she is. we don't question the icon.
π ACCESS π
To use Colconv or the c_colconv routines, load the NCAR Graphics libraries ncarg, ncarg_gks, and ncarg_c β preferably in that order. (the order matters, don't be chaotic about it, i'm begging π)
π¨ MESSAGES π¨
When error conditions are detected, the support routine SETER is called in such a way that it writes a message to the standard error file (as defined by I1MACH(4)) and then terminates execution. like, that's it, that's the end of the run. no gentle warning arc. π
so here's the full list of possible error messages, and what each one means:
HLSRGB - L out of rangeβ Lightness is less than0.or greater than100.HLSRGB - S out of rangeβ Saturation is less than0.or greater than100.HSVRGB - S out of rangeβ Saturation is less than0.or greater than1.HSVRGB - V out of rangeβ Value of input color is less than0.or greater than1.RGBHLS - R out of rangeβ Value of red intensity component is less than0.or greater than1.RGBHLS - G out of rangeβ Value of green intensity component is less than0.or greater than1.RGBHLS - B out of rangeβ Value of blue intensity component is less than0.or greater than1.RGBHSV - R out of rangeβ Value of red intensity component is less than0.or greater than1.RGBHSV - G out of rangeβ Value of green intensity component is less than0.or greater than1.RGBHSV - B out of rangeβ Value of blue intensity component is less than0.or greater than1.
β οΈ bestie. check your ranges. i'm not even being dramatic,SETERwill literally end your whole program over a1.5. vibe check your inputs before you hand them over. π«Ά
π SEE ALSO π
- Online:
hlsrgb,hsvrgb,rgbhls,rgbhsv,rgbyiq,yiqrgb,ncarg_cbind. - Hardcopy: NCAR Graphics Fundamentals, UNIX Version
go read the friends, they're all in the same friend group. iykyk. π
π COPYRIGHT π
Copyright (C) 1987-2009 University Corporation for Atmospheric Research The use of this Software is governed by a License Agreement.
that's the whole page bestie, you ate it, every last flag and range and legal line intact, no crumbs left. πβ¨
kisses from the UNIX manual page, dated March 1993, titled Colconv(3NCARG) β mwah π
π¦ 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