Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions ast/utils.c2
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,25 @@ public fn void setGlobals(Globals* g) @(unused){

// wordsize in bytes, must NOT be called from Plugin!
public fn void initialize(Context* c, string_pool.Pool* astPool, u32 wordsize, bool use_color) {

if (use_color) {
// adjust colors for readability on dark mode terminals
const char* colorfgbg = stdlib.getenv("COLORFGBG");
const char* c2_colors = stdlib.getenv("C2_COLORS");
if (c2_colors && !string.strncmp(c2_colors, "none", 4)) {
use_color = false;
} else
if ((c2_colors && !string.strncmp(c2_colors, "dark", 4))
|| (colorfgbg && *colorfgbg && !string.strcmp(colorfgbg + 1, ";0"))) {
// use brighter colors in dark mode
col_Attr = color.Bblue;
col_Template = color.Bgreen;
col_Type = color.Bgreen;
col_Error = color.Bred;
col_Calc = color.Byellow;
}
}

globals = stdlib.malloc(sizeof(Globals));
globals.pointers.init(c);
globals.string_types.init(c);
Expand Down