From a4b75a322d849188334010fbfbf9ca952f5bc42b Mon Sep 17 00:00:00 2001 From: supremestdoggo <83146042+supremestdoggo@users.noreply.github.com> Date: Fri, 17 Mar 2023 10:34:56 -0400 Subject: [PATCH] Add simpleColor function overloads --- source/birchwood/protocol/formatting.d | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/source/birchwood/protocol/formatting.d b/source/birchwood/protocol/formatting.d index 74fc274..9f34f91 100644 --- a/source/birchwood/protocol/formatting.d +++ b/source/birchwood/protocol/formatting.d @@ -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;}