summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2019-11-20 00:47:35 +0800
committerruki <[email protected]>2019-11-19 22:45:30 +0800
commit5fa5b0a217aff8fa8c6e8cc1bbe3031e3b1f1bec (patch)
tree2c9535c90728cadb50a8c0c315833920421a4855
parent618ff7b329f384323845ec12d7be5acd47fcaea9 (diff)
improve to set plain theme
-rw-r--r--xmake/core/base/colors.lua9
1 files changed, 8 insertions, 1 deletions
diff --git a/xmake/core/base/colors.lua b/xmake/core/base/colors.lua
index bd4cf4089..69c91e7fd 100644
--- a/xmake/core/base/colors.lua
+++ b/xmake/core/base/colors.lua
@@ -334,6 +334,13 @@ function colors.translate(str, opt)
nocolors = true
end
+ -- is plain theme? no colors and no emoji
+ local noemoji = not colors.emoji()
+ if theme and theme:name() == "plain" then
+ nocolors = true
+ noemoji = true
+ end
+
-- get keys
local keys = colors.color256() and colors._keys256 or colors._keys8
if colors.truecolor() then
@@ -391,7 +398,7 @@ function colors.translate(str, opt)
elseif block:startswith("$") then
-- plain text, do not translate emoji
table.insert(text_buffer, block:sub(2))
- elseif colors.emoji() then
+ elseif not noemoji then
-- get emoji code
local emoji_code = emoji.translate(block)
if emoji_code then