From ff793d251bfc6814127953751bc3a47bf029b613 Mon Sep 17 00:00:00 2001 From: ruki Date: Fri, 3 Jan 2020 23:24:44 +0800 Subject: improve colors and theme --- xmake/core/base/colors.lua | 5 +++-- xmake/themes/dark/xmake.lua | 6 +++--- xmake/themes/default/xmake.lua | 6 +++--- 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 -- cgit v1.3.1