summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2020-01-03 23:24:44 +0800
committerruki <[email protected]>2020-01-03 14:28:26 +0800
commitff793d251bfc6814127953751bc3a47bf029b613 (patch)
treeaa23c10e3452a9e8c4b6e937767ef35225fcb0c6
parent5196d07b2a512d630c32bab1fd7ae767aef4136c (diff)
improve colors and theme
-rw-r--r--xmake/core/base/colors.lua5
-rw-r--r--xmake/themes/dark/xmake.lua6
-rw-r--r--xmake/themes/default/xmake.lua6
3 files changed, 9 insertions, 8 deletions
diff --git a/xmake/core/base/colors.lua b/xmake/core/base/colors.lua
index f619dc0aa..d74a0c411 100644
--- a/xmake/core/base/colors.lua
+++ b/xmake/core/base/colors.lua
@@ -272,6 +272,7 @@ end
-- @param opt options
-- patch_reset: wrap str with `"${reset}"`?
-- ignore_unknown: ignore unknown codes like `"${unknown_code}"`?
+-- plain: false
--
-- 8 colors:
--
@@ -336,7 +337,7 @@ function colors.translate(str, opt)
-- is plain theme? no colors and no emoji
local noemoji = not colors.emoji()
- if theme and theme:name() == "plain" then
+ if opt.plain or (theme and theme:name() == "plain") then
nocolors = true
noemoji = true
end
@@ -438,7 +439,7 @@ function colors.ignore(str)
end
-- ignore it
- return (string.gsub(str, "(%${(.-)})", ""))
+ return colors.translate(str, {plain = true})
end
-- get theme
diff --git a/xmake/themes/dark/xmake.lua b/xmake/themes/dark/xmake.lua
index 249b61f81..cf2a340f0 100644
--- a/xmake/themes/dark/xmake.lua
+++ b/xmake/themes/dark/xmake.lua
@@ -26,15 +26,15 @@ theme("dark")
set_color("success", "green")
-- the failure status
- set_text("failure", "failed")
+ set_text("failure", "$failed")
set_color("failure", "red")
-- the nothing status
- set_text("nothing", "no")
+ set_text("nothing", "$no")
set_color("nothing", "red")
-- the error info
- set_text("error", "error")
+ set_text("error", "$error")
set_color("error", "red")
-- the warning info
diff --git a/xmake/themes/default/xmake.lua b/xmake/themes/default/xmake.lua
index 033d2138c..bbc0eb762 100644
--- a/xmake/themes/default/xmake.lua
+++ b/xmake/themes/default/xmake.lua
@@ -26,15 +26,15 @@ theme("default")
set_color("success", "green")
-- the failure status
- set_text("failure", "failed")
+ set_text("failure", "$failed")
set_color("failure", "red")
-- the nothing status
- set_text("nothing", "no")
+ set_text("nothing", "$no")
set_color("nothing", "red")
-- the error info
- set_text("error", "error")
+ set_text("error", "$error")
set_color("error", "red")
-- the warning info