makecol(3alleg4)

πŸ’– makecol β€” the glow-up your RGB deserves πŸ’–

okay bestie, welcome to makecol(3alleg4), straight out of the Allegro game programming library manual. this one is short, sweet, and honestly iconic. let's get into it 🫢


✨ NAME ✨

makecol β€” converts an RGB value into the current pixel format. also: this is part of the Allegro game programming library, iykyk πŸ’…


🌸 SYNOPSIS 🌸

#include <allegro.h>

int makecol(int r, int g, int b);

like. that's it. three little ints and a dream πŸŽ€


πŸ¦‹ DESCRIPTION πŸ¦‹

so here's the vibe: you've got a color in a hardware independent format β€” that's your red, green, and blue values, each one ranging 0-255 β€” and makecol is the bestie that translates it into whatever pixel format your current video mode is actually asking for. no cap. it does this by calling the preceding 8, 15, 16, 24, or 32-bit makecol functions as appropriate, depending on what it's working with. it just picks the right one for you, main character energy honestly ✨

example time, look:

/* Regardless of color depth, this will look green. */
int green_color = makecol(0, 255, 0);

see how that comment says regardless of color depth? that's the whole point, babes. you write the color once, it slays in any depth. πŸ’š


πŸ‘‘ RETURN VALUE πŸ‘‘

it returns the requested RGB triplet, expressed in the current color depth. that's the whole gift. that's the whole package. periodt. 🎁


🌈 SEE ALSO 🌈

the squad, the friend group, the ones you should also go read:


ngl there's nothing dangerous in here, it's just colors. go make something pretty. 🎨

Allegro, version 4.4.3 β€” and this page is makecol(3alleg4). mwah, love u, bye πŸ’‹πŸ’–πŸ§š