diff options
Diffstat (limited to 'source/style/package.d')
-rw-r--r-- | source/style/package.d | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/source/style/package.d b/source/style/package.d index 2e5ff7f..1c55a99 100644 --- a/source/style/package.d +++ b/source/style/package.d @@ -1,15 +1,22 @@ module style; import std.conv; +import core.stdc.stdlib : getenv; import style.color; string set(string s, int code) { + if (getenv("NO_COLOR")) + return s; + return ("%{\x1b[" ~ to!string(code) ~ "m%}") ~ s ~ ( "%{\x1b[" ~ to!string((Color.reset + 0)) ~ "m%}"); } string set(string s, int code, bool close) { + if (getenv("NO_COLOR")) + return s; + return ("%{\x1b[" ~ to!string(code) ~ "m%}") ~ s ~ (close ? ( "%{\x1b[" ~ to!string((Color.reset + 0)) ~ "m%}") : ""); } |