summaryrefslogtreecommitdiff
path: root/xmake/core/base
diff options
context:
space:
mode:
authorruki <[email protected]>2017-09-04 21:26:48 +0800
committerruki <[email protected]>2017-09-04 21:26:48 +0800
commit87362b49f7cd5547c14f47f3f47bc93a1987286f (patch)
tree8a32172ddf387d7a9f147420e0842478e6b23d37 /xmake/core/base
parent4fead28a91b650fd7268e708afdf4dc97935d454 (diff)
add switch to disable color output
Diffstat (limited to 'xmake/core/base')
-rw-r--r--xmake/core/base/colors.lua8
1 files changed, 8 insertions, 0 deletions
diff --git a/xmake/core/base/colors.lua b/xmake/core/base/colors.lua
index eb7295ea4..d1d96210d 100644
--- a/xmake/core/base/colors.lua
+++ b/xmake/core/base/colors.lua
@@ -110,6 +110,14 @@ colors._escape = string.char(27) .. '[%sm'
-- support 256 colors?
function colors.has256()
+ -- get $COLORTERM
+ colors._COLORTERM = colors._COLORTERM or os.getenv("COLORTERM") or ""
+
+ -- no color?
+ if colors._COLORTERM == "nocolor" then
+ return false
+ end
+
-- this is supported if be not windows
if os.host() ~= "windows" then
return true