al_color_lab(3alleg5)
π al_color_lab β the Allegro 5 API manual page, bestie edition π
okay so welcome to the Allegro 5 API reference manual, section 3alleg5, and today's main character is al_color_lab. she converts color spaces. she's lowkey iconic. let's get into it π
β¨ NAME β¨
al_color_lab β the Allegro 5 API function that hands you a color straight out of CIE L*a*b* land π¦
β¨ SYNOPSIS β¨
#include <allegro5/allegro_color.h>
ALLEGRO_COLOR al_color_lab(float l, float a, float b)
like, that's the whole vibe. three floats in, one color out. periodt π
β¨ DESCRIPTION β¨
So basically this function returns an ALLEGRO_COLOR(3alleg5) structure built from CIE L*a*b* values. π¨
Here's the breakdown, bestie:
- The
L*component is your luminance, and it goes from0..1. - The
a*andb*components hang out in the range-1..+1.
Note: β οΈ the L*a*b* color space can represent more colors than are actually visible in sRGB, so the conversion might give you RGB values that land outside the0..1range. not a bug, just the color space being extra. you can check whether that happened withal_is_color_valid(3alleg5). π΅οΈβοΈ
Note: π in some literature the range ofL*is0to100, anda*andb*go from-100to+100. if that's the version of the math you're working with, just divide all the components by100before passing them into this function. no cap. π―
β¨ SINCE β¨
5.2.3 β she's been here since then, serving color conversions with zero complaints π
β¨ SEE ALSO β¨
go read those too, they're her besties π«Ά
and that's the whole page!! this came from the Allegro reference manual, al_color_lab(3alleg5) edition β you're welcome, go make something pretty with it πβ¨πΈ
π¦ where this page comes from
- debian trixie: allegro5-doc 2:5.2.10.1+dfsg-1 Β· Zlib
- ubuntu questing: allegro5-doc 2:5.2.10.1+dfsg-1build1
- ubuntu resolute: allegro5-doc 2:5.2.11.3+dfsg-1 Β· Zlib
- ubuntu stonking: allegro5-doc 2:5.2.11.3+dfsg-1 Β· Zlib
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms