al_color_rgb_to_html(3alleg5)

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

al_color_rgb_to_html πŸ’– (a.k.a. the Allegro 5 API girlies' favorite glow-up function)

okay bestie, sit DOWN, because this one is literally the cutest little function in the whole Allegro 5 color corner and she deserves her moment πŸ’…


✨ NAME ✨

al_color_rgb_to_html β€” she takes your float-y RGB vibes and turns them into a pretty HTML hex string, no cap πŸŽ€


✨ SYNOPSIS ✨

#include <allegro5/allegro_color.h>

void al_color_rgb_to_html(float red, float green, float blue,
    char *string)

✨ DESCRIPTION ✨

So here's the tea β˜•: this function creates an HTML-style string representation of an ALLEGRO_COLOR(3alleg5), like for example #00faff. Iconic. Gorgeous. Served. 🌈

Parameters 🫢

  • red, green, blue β€” the color components, and they live in the range 0..1. Yes, floats, not 0-255, don't come at me πŸ™ˆ
  • string β€” a pointer to a buffer that is at least 8 bytes, into which the result gets written. And yes babes, that 8 counts the NUL terminator, she's included, she's part of the squad πŸ’€

Example ⭐

char html[8];
al_color_rgb_to_html(1, 0, 0, html);

and after that runs, html will contain "#ff0000". red era. main character energy. periodt. πŸ‘‘


✨ SEE ALSO ✨

go read those too, they're her sisters, the whole family eats πŸ“


πŸ’‘ little reminder bestie: that buffer is 8 bytes minimum including the NUL, so don't skimp on her, she needs the room to glow πŸ¦‹

mwah πŸ’‹ this page is from the Allegro reference manual, and you just read all about al_color_rgb_to_html(3alleg5) β€” go forth and make pretty hex strings, i'm obsessed with you fr fr πŸŒΈπŸ§šπŸ’œ

πŸ“¦ where this page comes from