Skip to content

Instantly share code, notes, and snippets.

@STCollier
Last active May 1, 2024 13:43
Show Gist options
  • Save STCollier/f98c4be03f651f06ec9b67a64f36ff73 to your computer and use it in GitHub Desktop.
Save STCollier/f98c4be03f651f06ec9b67a64f36ff73 to your computer and use it in GitHub Desktop.
#include <stdio.h>
#include <stdint.h>
typedef struct {
uint8_t r, g, b;
} color_t;
uint16_t numbers[10] = {0xF6DE, 0xC92E, 0xE7CE, 0xE79E, 0xB792, 0xF39E, 0xF3DE, 0xE492, 0xF7DE, 0xF79E};
void putp(color_t color) {
printf("\x1B[48;2;%i;%i;%im ", color.r, color.g, color.b);
}
void putr(const char* s) {
printf("\033[0m%s", s);
}
void flushs() {
puts("\x1B[0m");
}
int main() {
color_t c = {0, 125, 255};
for (size_t n = 0; n < 10; n++) {
for (size_t i = 0; i < 16; i++) {
numbers[n] >> (16 - i) & 1 ? putp(c) : putr(" ");
if (!(i % 3)) flushs();
}
flushs();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment