From 5fa5b0a217aff8fa8c6e8cc1bbe3031e3b1f1bec Mon Sep 17 00:00:00 2001 From: ruki Date: Wed, 20 Nov 2019 00:47:35 +0800 Subject: improve to set plain theme --- xmake/core/base/colors.lua | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) 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 -- cgit v1.3.1