al_color_html(3alleg5)

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

πŸ’– al_color_html β€” Allegro 5 API πŸ’–

okay bestie, so this one is literally a whole page from the Allegro reference manual and it's about turning cute little hex color strings into actual colors. we love a glow-up. ✨


✨ SYNOPSIS ✨

#include <allegro5/allegro_color.h>

ALLEGRO_COLOR al_color_html(char const *string)

πŸŽ€ DESCRIPTION πŸŽ€

so what this does is it takes an HTML-style hex number β€” like #00faff, you know the vibe, very cutesy, very web-1.0 β€” and it interprets it as a color. that's it. that's the function. πŸ¦‹

the format it accepts? literally the exact same one that al_color_html_to_rgb(3alleg5) accepts. no cap. if you know that one you already know this one, iykyk. πŸ’…

and then it gives you back the interpreted color. so fun. so aesthetic. πŸŽ€

but bestie... listen. if the string could not be parsed? it returns al_map_rgba(0, 0, 0, 0). that's fully transparent black, the void, the nothingness, the no color at all. so like, if you get a see-through ghost back, that's why. 😭

⚠️ Note: the behaviour on invalid strings is different from Allegro 5.0.x. so if you're porting old code and something looks off β€” this is probably it. not me finding out the hard way πŸ™ˆ

🌈 SEE ALSO 🌈


okay that's the whole page, you're literally an expert now, main character energy fr fr πŸ’œβœ¨

this was brought to you by the Allegro reference manual, page al_color_html(3alleg5) β€” go slay some hex codes bestie, ily πŸ«ΆπŸ’–

πŸ“¦ where this page comes from