Compare commits

..

No commits in common. "a878659475083fe0877741a2722605daa38ba3df" and "d95912feed288fdb8dc744ec1628e3f5c0dbeec1" have entirely different histories.

10 changed files with 162 additions and 215 deletions

1
.gitignore vendored
View file

@ -1,2 +1 @@
/a.out /a.out
/pride-c

149
basic.c
View file

@ -2,116 +2,99 @@
#include <stdio.h> #include <stdio.h>
#include "draw.h"
void rainbow_8() { void rainbow_8() {
color colors [] = { printf(
RED, RED STRIPE
L_RED, L_RED STRIPE
L_YELLOW, L_YELLOW STRIPE
GREEN, GREEN STRIPE
BLUE, BLUE STRIPE
MAGENTA MAGENTA STRIPE
}; );
draw(6, colors);
} }
void aroace_8() { void aroace_8() {
color colors [] = { printf(
YELLOW, YELLOW STRIPE
L_YELLOW, L_YELLOW STRIPE
WHITE, WHITE STRIPE
L_CYAN, L_CYAN STRIPE
BLUE BLUE STRIPE
}; );
draw(5, colors);
} }
void bigender_8() { void bigender_8() {
color colors [] = { printf(
L_RED, L_RED STRIPE
L_YELLOW, L_YELLOW STRIPE
WHITE, WHITE STRIPE
MAGENTA, MAGENTA STRIPE
L_BLUE L_BLUE STRIPE
}; );
draw(5, colors);
} }
void bisexual_8() { void bisexual_8() {
color colors [] = { printf(
RED, RED STRIPE STRIPE
RED, MAGENTA STRIPE
MAGENTA, BLUE STRIPE STRIPE
BLUE, );
BLUE
};
draw(5, colors);
} }
void gay_8() { void gay_8() {
color colors [] = { printf(
CYAN, CYAN STRIPE
L_CYAN, L_CYAN STRIPE
WHITE, WHITE STRIPE
L_BLUE, L_BLUE STRIPE
BLUE BLUE STRIPE
}; );
draw(5, colors);
} }
void genderfluid_8() { void genderfluid_8() {
color colors [] = { printf(
L_RED, L_RED STRIPE
WHITE, WHITE STRIPE
MAGENTA, MAGENTA STRIPE
BLACK, BLACK STRIPE
BLUE BLUE STRIPE
}; );
draw(5, colors);
} }
void lesbian_8() { void lesbian_8() {
color colors [] = { printf(
RED, RED STRIPE
L_RED, L_RED STRIPE
WHITE, WHITE STRIPE
L_MAGENTA, L_MAGENTA STRIPE
MAGENTA MAGENTA STRIPE
}; );
draw(5, colors);
} }
void nonbinary_8() { void nonbinary_8() {
color colors [] = { printf(
L_YELLOW, L_YELLOW STRIPE
WHITE, WHITE STRIPE
MAGENTA, MAGENTA STRIPE
BLACK BLACK STRIPE
}; );
draw(4, colors);
} }
void pansexual_8() { void pansexual_8() {
color colors [] = { printf(
MAGENTA, MAGENTA STRIPE STRIPE
MAGENTA, L_YELLOW STRIPE STRIPE
L_YELLOW, CYAN STRIPE STRIPE
L_YELLOW, );
CYAN,
CYAN
};
draw(6, colors);
} }
void transgender_8() { void transgender_8() {
color colors [] = { printf(
L_CYAN, L_CYAN STRIPE
L_MAGENTA, L_MAGENTA STRIPE
WHITE, WHITE STRIPE
L_MAGENTA, L_MAGENTA STRIPE
L_CYAN L_CYAN STRIPE
}; );
draw(5, colors);
} }

34
basic.h
View file

@ -1,21 +1,23 @@
#pragma once #pragma once
#define BLACK 0 #include "color.h"
#define RED 1
#define GREEN 2 #define BLACK COLOR(0)
#define YELLOW 3 #define RED COLOR(1)
#define BLUE 4 #define GREEN COLOR(2)
#define MAGENTA 5 #define YELLOW COLOR(3)
#define CYAN 6 #define BLUE COLOR(4)
#define GRAY 7 #define MAGENTA COLOR(5)
#define L_BLACK 8 #define CYAN COLOR(6)
#define L_RED 9 #define GRAY COLOR(7)
#define L_GREEN 10 #define L_BLACK COLOR(8)
#define L_YELLOW 11 #define L_RED COLOR(9)
#define L_BLUE 12 #define L_GREEN COLOR(10)
#define L_MAGENTA 13 #define L_YELLOW COLOR(11)
#define L_CYAN 14 #define L_BLUE COLOR(12)
#define WHITE 15 #define L_MAGENTA COLOR(13)
#define L_CYAN COLOR(14)
#define WHITE COLOR(15)
void rainbow_8(); void rainbow_8();
void aroace_8(); void aroace_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"

10
draw.c
View file

@ -1,10 +0,0 @@
#include "draw.h"
#include <stdio.h>
void draw(unsigned short int len, color colors []) {
for(int i = 0; i < len; i++) {
printf(ANSI "%dm" STRIPE, colors[i]);
}
}

10
draw.h
View file

@ -1,10 +0,0 @@
#pragma once
#define ANSI "\x1b[38;5;"
#define COLOR(n) ANSI #n "m"
#define STRIPE "██████████████████\n"
typedef unsigned short int color;
void draw(unsigned short int len, color colors[]);

150
full.c
View file

@ -2,115 +2,103 @@
#include <stdio.h> #include <stdio.h>
#include "draw.h" #include "color.h"
void rainbow_256() { void rainbow_256() {
color colors [] = { printf(
196, // red COLOR(196) STRIPE // red
208, // orange COLOR(208) STRIPE // orange
220, // yellow COLOR(220) STRIPE // yellow
28, // green COLOR(28) STRIPE // green
21, // blue COLOR(21) STRIPE // blue
90 // purple COLOR(90) STRIPE // purple
}; );
draw(6, colors);
} }
void aroace_256() { void aroace_256() {
color colors [] = { printf(
172, // orange COLOR(172) STRIPE
184, // yellow COLOR(184) STRIPE
255, // white COLOR(255) STRIPE
38, // blue COLOR(38) STRIPE
17 // navy COLOR(17) STRIPE
}; );
draw(5, colors);
} }
void bigender_256() { void bigender_256() {
color colors [] = { printf(
204, // pink COLOR(204) STRIPE
227, // yellow COLOR(227) STRIPE
255, // white COLOR(255) STRIPE
134, // purple COLOR(134) STRIPE
69 // blue COLOR(69) STRIPE
}; );
draw(5, colors);
} }
void bisexual_256() { void bisexual_256() {
color colors [] = { printf(
161, // magenta COLOR(161) STRIPE STRIPE
161, COLOR(91) STRIPE
91, // purple COLOR(21) STRIPE STRIPE
21, );
21 // blue
};
draw(5, colors);
} }
void gay_256() { void gay_256() {
color colors [] = { printf(
29, COLOR(29) STRIPE
49, // greens COLOR(49) STRIPE
123, COLOR(123) STRIPE
255, // white COLOR(255) STRIPE
75, COLOR(75) STRIPE
63, // blues COLOR(63) STRIPE
56 COLOR(56) STRIPE
}; );
draw(7, colors);
} }
void genderfluid_256() { void genderfluid_256() {
color colors[] = { printf(
204, // pink COLOR(204) STRIPE
255, // white COLOR(255) STRIPE
164, // purple COLOR(164) STRIPE
16, // black COLOR(16) STRIPE
63, // blue COLOR(63) STRIPE
}; );
draw(5, colors);
} }
void lesbian_256() { void lesbian_256() {
color colors [] = { printf(
202, // orange COLOR(202) STRIPE
209, // tangerine COLOR(209) STRIPE
255, // white COLOR(255) STRIPE
134, // pink COLOR(134) STRIPE
161 // magenta COLOR(161) STRIPE
}; );
draw(5, colors);
} }
void nonbinary_256() { void nonbinary_256() {
color colors [] = { printf(
226, // yellow COLOR(226) STRIPE
255, // white COLOR(255) STRIPE
134, // purple COLOR(134) STRIPE
16 // black COLOR(16) STRIPE
}; );
draw(4, colors);
} }
void pansexual_256() { void pansexual_256() {
color colors [] = { printf(
161, 161, // magenta COLOR(161) STRIPE STRIPE
220, 220, // yellow COLOR(220) STRIPE STRIPE
45, 45 // cyan COLOR(45) STRIPE STRIPE
}; );
draw(6, colors);
} }
void transgender_256() { void transgender_256() {
color colors [] = { printf(
45, // blue COLOR(45) STRIPE
213, // pink COLOR(117) STRIPE
255, // white COLOR(255) STRIPE
213, // pink COLOR(117) STRIPE
45 // blue COLOR(45) STRIPE
}; );
draw(5, colors);
} }

2
full.h
View file

@ -1,6 +1,6 @@
#pragma once #pragma once
#include "draw.h" #include "color.h"
void rainbow_256(); void rainbow_256();
void aroace_256(); void aroace_256();

View file

@ -1,4 +0,0 @@
build:
gcc main.c draw.c basic.c full.c -o pride-c

12
main.c
View file

@ -1,8 +1,7 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h>
#include <string.h> #include <string.h>
#include "draw.h" #include "color.h"
#include "basic.h" #include "basic.h"
#include "full.h" #include "full.h"
@ -27,7 +26,6 @@ void help() {
" bigender\n" " bigender\n"
" bisexual\n" " bisexual\n"
" gay\n" " gay\n"
" genderfluid\n"
" lesbian\n" " lesbian\n"
" nonbinary\n" " nonbinary\n"
" pansexual\n" " pansexual\n"
@ -60,12 +58,8 @@ int main(int argc, char **argv) {
help(); help();
return 0; return 0;
} }
int color_mode = 0; int color_mode = 0;
char * term = getenv("TERM");
if(strcmp(term, "linux"))
color_mode = 1;
unsigned long flag_hash = djb_hash(flag); unsigned long flag_hash = djb_hash(flag);
char *output; char *output;
@ -128,7 +122,7 @@ int main(int argc, char **argv) {
case 249901996007388822lu: // 'pansexual' case 249901996007388822lu: // 'pansexual'
case 193502276lu: // 'pan' case 193502276lu: // 'pan'
if(color_mode) pansexual_256(); if(color_mode) pansexual_256();
else pansexual_8(); else nonbinary_8();
break; break;
// - TRANSGENDER - // - TRANSGENDER -