al_color_lch(3alleg5)

๐Ÿ“ฆ
version 5.2.11.3 ยท 4 versions
, in debian trixie, ubuntu questing, ubuntu resolute, ubuntu stonking

๐Ÿ’– NAME ๐Ÿ’–

al_color_lch โ€” it's giving Allegro 5 API, bestie โœจ


๐ŸŒˆ SYNOPSIS ๐ŸŒˆ

#include <allegro5/allegro_color.h>

ALLEGRO_COLOR al_color_lch(float l, float c, float h)

๐ŸŽ€ DESCRIPTION ๐ŸŽ€

Okay so this one hands you back an ALLEGRO_COLOR(3alleg5) struct, built from CIE LCH values. Slay ๐Ÿ’…

LCH colors are lowkey super similar to HSL โ€” same meaning for L and H, and C does the job that S does. But here's the tea: LCH is way more visually uniform. Like, the gradients actually look even. Iconic behavior fr fr.

โš ๏ธ And heads up bestie, this is the part that gets people: this function wants the angle for H in radians, not degrees. Not me accidentally passing degrees and getting a whole different vibe ๐Ÿ˜ญ

So the CIE LCH color space? It's a cylindrical representation of the L*a*b* color space. The L component stays exactly the same, and C and H get computed like this:

C = sqrt(a * a + b * b)
H = atan2(b, a)

Math ate that, no cap ๐Ÿงฎโœจ


๐Ÿฆ‹ SINCE ๐Ÿฆ‹

5.2.3 โ€” she's been here a minute, and she's still serving ๐Ÿ‘‘


๐ŸŒธ SEE ALSO ๐ŸŒธ


And that's the whole page, babe โ€” straight out of the Allegro reference manual, page al_color_lch(3alleg5). Go convert some colors, you've got this ๐Ÿ’œ๐ŸŽ€

๐Ÿ“ฆ where this page comes from