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