major project restructure; new 256-color implementation

This commit is contained in:
Valerie Wolfe 2024-03-21 17:01:09 -04:00
parent db6c081056
commit da8e51f661
6 changed files with 222 additions and 39 deletions

70
basic.c Normal file
View file

@ -0,0 +1,70 @@
#include "basic.h"
#include <stdio.h>
void rainbow_8() {
printf(
RED STRIPE
L_RED STRIPE
L_YELLOW STRIPE
GREEN STRIPE
BLUE STRIPE
MAGENTA STRIPE
);
}
void aroace_8() {
printf(
YELLOW STRIPE
L_YELLOW STRIPE
WHITE STRIPE
L_CYAN STRIPE
BLUE STRIPE
);
}
void bisexual_8() {
printf(
RED STRIPE STRIPE
MAGENTA STRIPE
BLUE STRIPE STRIPE
);
}
void lesbian_8() {
printf(
RED STRIPE
L_RED STRIPE
WHITE STRIPE
L_MAGENTA STRIPE
MAGENTA STRIPE
);
}
void nonbinary_8() {
printf(
L_YELLOW STRIPE
WHITE STRIPE
MAGENTA STRIPE
BLACK STRIPE
);
}
void pansexual_8() {
printf(
MAGENTA STRIPE STRIPE
L_YELLOW STRIPE STRIPE
CYAN STRIPE STRIPE
);
}
void transgender_8() {
printf(
L_CYAN STRIPE
L_MAGENTA STRIPE
WHITE STRIPE
L_MAGENTA STRIPE
L_CYAN STRIPE
);
}

29
basic.h Normal file
View file

@ -0,0 +1,29 @@
#pragma once
#include "color.h"
#define BLACK COLOR(0)
#define RED COLOR(1)
#define GREEN COLOR(2)
#define YELLOW COLOR(3)
#define BLUE COLOR(4)
#define MAGENTA COLOR(5)
#define CYAN COLOR(6)
#define GRAY COLOR(7)
#define L_BLACK COLOR(8)
#define L_RED COLOR(9)
#define L_GREEN COLOR(10)
#define L_YELLOW COLOR(11)
#define L_BLUE COLOR(12)
#define L_MAGENTA COLOR(13)
#define L_CYAN COLOR(14)
#define WHITE COLOR(15)
void rainbow_8();
void aroace_8();
void bisexual_8();
void lesbian_8();
void nonbinary_8();
void pansexual_8();
void transgender_8();

5
color.h Normal file
View file

@ -0,0 +1,5 @@
#pragma once
#define COLOR(n) "\x1b[38;5;" #n "m"
#define STRIPE "██████████████████\n"

72
full.c Normal file
View file

@ -0,0 +1,72 @@
#include "full.h"
#include <stdio.h>
#include "color.h"
void rainbow_256() {
printf(
COLOR(196) STRIPE // red
COLOR(208) STRIPE // orange
COLOR(220) STRIPE // yellow
COLOR(28) STRIPE // green
COLOR(21) STRIPE // blue
COLOR(90) STRIPE // purple
);
}
void aroace_256() {
printf(
COLOR(172) STRIPE
COLOR(184) STRIPE
COLOR(255) STRIPE
COLOR(38) STRIPE
COLOR(17) STRIPE
);
}
void bisexual_256() {
printf(
COLOR(161) STRIPE STRIPE
COLOR(91) STRIPE
COLOR(21) STRIPE STRIPE
);
}
void lesbian_256() {
printf(
COLOR(202) STRIPE
COLOR(209) STRIPE
COLOR(255) STRIPE
COLOR(134) STRIPE
COLOR(161) STRIPE
);
}
void nonbinary_256() {
printf(
COLOR(226) STRIPE
COLOR(255) STRIPE
COLOR(134) STRIPE
COLOR(16) STRIPE
);
}
void pansexual_256() {
printf(
COLOR(161) STRIPE STRIPE
COLOR(220) STRIPE STRIPE
COLOR(45) STRIPE STRIPE
);
}
void transgender_256() {
printf(
COLOR(45) STRIPE
COLOR(117) STRIPE
COLOR(255) STRIPE
COLOR(117) STRIPE
COLOR(45) STRIPE
);
}

12
full.h Normal file
View file

@ -0,0 +1,12 @@
#pragma once
#include "color.h"
void rainbow_256();
void aroace_256();
void bisexual_256();
void lesbian_256();
void nonbinary_256();
void pansexual_256();
void transgender_256();

73
main.c
View file

@ -1,17 +1,15 @@
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include "color.h"
#include "basic.h"
#include "full.h"
#define VERSION "0.0.1" #define VERSION "0.0.1"
#define INDENT " " #define INDENT " "
#define RESET "\x1b[0m" #define RESET "\x1b[0m"
#define COLOR(n) "\x1b[38;5;" #n "m"
#define BLACK "\x1b[38;5;0m"
#define WHITE "\x1b[38;5;255m"
#define STRIPE "██████████████████\n"
#define RAINBOW "rainbow" #define RAINBOW "rainbow"
#define AROACE "aroace" #define AROACE "aroace"
#define BISEXUAL "bisexual" #define BISEXUAL "bisexual"
@ -49,6 +47,8 @@ int main(int argc, char **argv) {
if(argc > 1) { flag = argv[1]; } if(argc > 1) { flag = argv[1]; }
else { flag = RAINBOW; } else { flag = RAINBOW; }
int color_mode = 0;
// handle flags // handle flags
if(strcmp(flag, "--version") == 0) { if(strcmp(flag, "--version") == 0) {
version(); version();
@ -59,57 +59,52 @@ int main(int argc, char **argv) {
} }
if(strcmp(flag, RAINBOW) == 0) { // - RAINBOW - if(strcmp(flag, RAINBOW) == 0) { // - RAINBOW -
printf(COLOR(196) STRIPE); // red if(color_mode)
printf(COLOR(208) STRIPE); // orange rainbow_256();
printf(COLOR(220) STRIPE); // yellow else
printf(COLOR(28) STRIPE); // green rainbow_8();
printf(COLOR(21) STRIPE); // blue
printf(COLOR(90) STRIPE); // purple
} }
else if(strcmp(flag, AROACE) == 0) { // - ARO/ACE - else if(strcmp(flag, AROACE) == 0) { // - ARO/ACE -
printf(COLOR(172) STRIPE); // orange if(color_mode)
printf(COLOR(184) STRIPE); // yellow aroace_256();
printf(WHITE STRIPE); // white else
printf(COLOR(38) STRIPE); // blue aroace_8();
printf(COLOR(17) STRIPE); // navy
} }
else if(strcmp(flag, BISEXUAL) == 0) { // - BISEXUAL - else if(strcmp(flag, BISEXUAL) == 0) { // - BISEXUAL -
printf(COLOR(161) STRIPE STRIPE); // maroon if(color_mode)
printf(COLOR(91) STRIPE); // purple aroace_256();
printf(COLOR(21) STRIPE STRIPE); // blue else
bisexual_8();
} }
else if(strcmp(flag, LESBIAN) == 0) { // - LESBIAN - else if(strcmp(flag, LESBIAN) == 0) { // - LESBIAN -
printf(COLOR(202) STRIPE); // orange if(color_mode)
printf(COLOR(209) STRIPE); // tangerine lesbian_256();
printf(WHITE STRIPE); // white else
printf(COLOR(205) STRIPE); // pink lesbian_8();
printf(COLOR(161) STRIPE); // magenta
} }
else if(strcmp(flag, NONBINARY) == 0) { // - NONBINARY - else if(strcmp(flag, NONBINARY) == 0) { // - NONBINARY -
printf(COLOR(226) STRIPE); // yellow if(color_mode)
printf(WHITE STRIPE); // white nonbinary_256();
printf(COLOR(134) STRIPE); // purple else
printf(BLACK STRIPE); // black nonbinary_8();
} }
else if(strcmp(flag, PANSEXUAL) == 0) { // - PANSEXUAL - else if(strcmp(flag, PANSEXUAL) == 0) { // - PANSEXUAL -
printf(COLOR(161) STRIPE STRIPE); // magenta if(color_mode)
printf(COLOR(220) STRIPE STRIPE); // yellow pansexual_256();
printf(COLOR(45) STRIPE STRIPE); // cyan else
pansexual_8();
} }
else if(strcmp(flag, TRANSGENDER) == 0) { // - TRANSGENDER - else if(strcmp(flag, TRANSGENDER) == 0) { // - TRANSGENDER -
char *blue = COLOR(45) STRIPE; if(color_mode)
char *pink = COLOR(177) STRIPE; transgender_256();
printf(blue); else
printf(pink); transgender_8();
printf(WHITE STRIPE);
printf(pink);
printf(blue);
} }