1
0
mirror of https://github.com/deavmi/birchwood synced 2024-09-20 11:43:22 +02:00

Add simpleColor function overloads

This commit is contained in:
supremestdoggo 2023-03-17 10:34:56 -04:00
parent 622d6e509d
commit a4b75a322d

View File

@ -18,7 +18,7 @@ enum ascii_color_code = '\x03';
enum hex_color_code = '\x04';
// Simple color codes
enum simple_colors: string {
enum simpleColor: string {
WHITE = "00",
BLACK = "01",
BLUE = "02",
@ -78,6 +78,18 @@ string set_foreground_background(string fg, string bg) {
return control_char ~ fg ~ "," ~ bg;
}
// Generates a string that changes the foreground color (except enum)
pragma(inline)
string set_foreground(simpleColor color) {
return ascii_color_code ~ color;
}
// Generate a string that sets the foreground and background color (except enum)
pragma(inline)
string set_foreground_background(simpleColor fg, simpleColor bg) {
return ascii_color_code ~ fg ~ "," ~ bg;
}
// Generate a string that resets the foreground and background colors
pragma(inline)
string reset_fg_bg() {return ascii_color_code;}