al_color_rgb_to_html(3)
β¨ al_color_rgb_to_html(3) β¨
okay so bestie, welcome to the Allegro 5 API corner of the manual π this one lives in the Library Functions Manual and it's genuinely so cute and simple, no cap π
πΈ SYNOPSIS πΈ
#include <allegro5/allegro_color.h>
void al_color_rgb_to_html(float red, float green, float blue,
char *string)
like, that's the whole vibe. four args, one function, zero drama π¦
π DESCRIPTION π
okay so what this icon does π is create an HTML-style string representation of an ALLEGRO_COLOR(3), like #00faff. it's giving "I have a color, now give me the hex string" and honestly? obsessed π₯
π«Ά Parameters
- red, green, blue β the color components, and they're in the range
0..1(yes, floats, not 0..255, don't come for me π) - string β a pointer to a buffer of at least 8 bytes, and that's where the result gets written (including the NUL terminator, so yes, the 8th byte is doing important work π)
lowkey important: that buffer needs to be at least 8 bytes fr fr. don't be out here passing a tiny little buffer, the NUL terminator needs its seat at the table π
β¨ Example
char html[8];
al_color_rgb_to_html(1, 0, 0, html);
and now html will contain β#ff0000β πβ¨ red slayed, periodt.
π¦ SEE ALSO π¦
iykyk, go read those next, they're the sibling icons of this whole hex-string situation π
mwah π that's the whole page bestie β brought to you by the Allegro reference manual, version/date Allegro reference manual, and this function's own footer buddy al_color_rgb_to_html(3). go convert some colors, you're gonna eat πΈπ
π¦ where this page comes from
- arch rolling: allegro 5.2.11.3-2 Β· Zlib AND BSD-3-Clause AND OFL-1.1 AND LicenseRef-Custom
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms