al_color_html_to_rgb(3alleg5)
π al_color_html_to_rgb β Allegro 5 API π
okay bestie, gather round, because this one is so handy and also so small. it's an Allegro 5 API function, and it does exactly one (1) job: it takes a hex color string like you'd see in CSS and turns it into actual floating point RGB values. slay.
β¨ SYNOPSIS β¨
#include <allegro5/allegro_color.h>
bool al_color_html_to_rgb(char const *string,
float *red, float *green, float *blue)
π DESCRIPTION π
so basically, this function reads an HTML-style hex number β think #00faff β and interprets it as a color. that's the whole vibe. π
and the only formats it accepts are these two, no substitutions, no exceptions:
#RRGGBBRRGGBB
where R, G, and B are hexadecimal digits from the set [0-9A-Fa-f]. that's it. that's the list. don't come at it with your three-digit shorthand, it will simply not eat that. π
it returns true on success and false on failure. and on failure β listen carefully bestie β all components are set to zero. all of them. zeroed out. so if you ignore the return value you're gonna be sitting there wondering why your color is black, and the answer is that you fumbled. π
β οΈ Note: the behaviour on invalid strings is different from Allegro 5.0.x. so if you're porting old code and the vibes feel off, that's why. not you, it's the version. π«Ά
π SEE ALSO π
and that's the whole page, no notes. π this was brought to you by the Allegro reference manual, starring al_color_html_to_rgb(3alleg5) in the title role. go forth and convert your hexes, bestie, you've got this. βππ¦
π¦ 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