al_color_lab(3alleg5)

πŸ“¦
version 5.2.11.3 Β· 4 versions
, in debian trixie, ubuntu questing, ubuntu resolute, ubuntu stonking

πŸ’– 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 from 0..1.
  • The a* and b* 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 the 0..1 range. not a bug, just the color space being extra. you can check whether that happened with al_is_color_valid(3alleg5). πŸ•΅οΈβ™€οΈ
Note: πŸ“š in some literature the range of L* is 0 to 100, and a* and b* go from -100 to +100. if that's the version of the math you're working with, just divide all the components by 100 before 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