diff options
| author | ruki <[email protected]> | 2019-01-03 23:13:50 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2019-01-03 13:23:05 +0800 |
| commit | 7da17d16ef3bf08d1b683f95fcec1c6d48ecdee4 (patch) | |
| tree | 7fd5f04ec77e3f33858545660531a89a49413ea8 | |
| parent | e6bdff43415c485114ae9a68a435923497fb3059 (diff) | |
improve plain text in colors
| -rw-r--r-- | xmake/core/base/colors.lua | 11 | ||||
| -rw-r--r-- | xmake/modules/lib/detect/check_cxsnippets.lua | 12 | ||||
| -rw-r--r-- | xmake/themes/dark/xmake.lua | 4 | ||||
| -rw-r--r-- | xmake/themes/default/xmake.lua | 4 | ||||
| -rw-r--r-- | xmake/themes/emoji/xmake.lua | 2 | ||||
| -rw-r--r-- | xmake/themes/plain/xmake.lua | 4 |
6 files changed, 24 insertions, 13 deletions
diff --git a/xmake/core/base/colors.lua b/xmake/core/base/colors.lua index 570e001fc..589288f16 100644 --- a/xmake/core/base/colors.lua +++ b/xmake/core/base/colors.lua @@ -291,6 +291,14 @@ end -- -- "${beer}hello${beer}world" -- +-- theme: +-- "${color.error}" +-- "${bright color.warning}" +-- +-- text: +-- "${hello xmake}" +-- "${hello xmake $beer}" +-- function colors.translate(str) -- check string @@ -366,6 +374,9 @@ function colors.translate(str) else code = block:gsub("#", "38;5;") end + elseif block:startswith("$") then + -- plain text, do not translate emoji + table.insert(text_buffer, block:sub(2)) else -- get emoji code local emoji_code = emoji.translate(block) diff --git a/xmake/modules/lib/detect/check_cxsnippets.lua b/xmake/modules/lib/detect/check_cxsnippets.lua index 1730a65ed..56e1d9562 100644 --- a/xmake/modules/lib/detect/check_cxsnippets.lua +++ b/xmake/modules/lib/detect/check_cxsnippets.lua @@ -200,23 +200,23 @@ function main(snippets, opt) if opt.verbose or option.get("verbose") or option.get("diagnosis") then local kind = ifelse(sourcekind == "cc", "c", "c++") if #includes > 0 then - cprint("checking for the %s includes %s ... %s", kind, table.concat(includes, ", "), ifelse(ok, "${green}ok", "${red}no")) + cprint("${dim}checking for the %s includes %s ... %s", kind, table.concat(includes, ", "), ok and "${color.success}${text.success}" or "${color.nothing}${text.nothing}") end if #types > 0 then - cprint("checking for the %s types %s ... %s", kind, table.concat(types, ", "), ifelse(ok, "${green}ok", "${red}no")) + cprint("${dim}checking for the %s types %s ... %s", kind, table.concat(types, ", "), ok and "${color.success}${text.success}" or "${color.nothing}${text.nothing}") end if #funcs > 0 then - cprint("checking for the %s funcs %s ... %s", kind, table.concat(funcs, ", "), ifelse(ok, "${green}ok", "${red}no")) + cprint("${dim}checking for the %s funcs %s ... %s", kind, table.concat(funcs, ", "), ok and "${color.success}${text.success}" or "${color.nothing}${text.nothing}") end if #links > 0 then - cprint("checking for the %s links %s ... %s", kind, table.concat(links, ", "), ifelse(ok, "${green}ok", "${red}no")) + cprint("${dim}checking for the %s links %s ... %s", kind, table.concat(links, ", "), ok and "${color.success}${text.success}" or "${color.nothing}${text.nothing}") end for _, snippet in ipairs(snippets) do - cprint("checking for the %s snippet %s ... %s", kind, snippet:sub(1, 16), ifelse(ok, "${green}ok", "${red}no")) + cprint("${dim}checking for the %s snippet %s ... %s", kind, snippet:sub(1, 16), ok and "${color.success}${text.success}" or "${color.nothing}${text.nothing}") end end if errors and #errors > 0 and option.get("diagnosis") then - cprint("${yellow}checkinfo:${clear dim} %s", errors) + cprint("${color.warning}checkinfo:${clear dim} %s", errors) end -- ok? diff --git a/xmake/themes/dark/xmake.lua b/xmake/themes/dark/xmake.lua index 459721f33..a4abb97e7 100644 --- a/xmake/themes/dark/xmake.lua +++ b/xmake/themes/dark/xmake.lua @@ -26,7 +26,7 @@ theme("dark") -- the success status - set_text("success", "ok") + set_text("success", "$ok") set_color("success", "green") -- the failure status @@ -42,7 +42,7 @@ theme("dark") set_color("error", "red") -- the warning info - set_text("warning", "warn") + set_text("warning", "$warning") set_color("warning", "cyan") -- the building progress diff --git a/xmake/themes/default/xmake.lua b/xmake/themes/default/xmake.lua index 02f6a010e..7ad766f8e 100644 --- a/xmake/themes/default/xmake.lua +++ b/xmake/themes/default/xmake.lua @@ -26,7 +26,7 @@ theme("default") -- the success status - set_text("success", "ok") + set_text("success", "$ok") set_color("success", "green") -- the failure status @@ -42,7 +42,7 @@ theme("default") set_color("error", "red") -- the warning info - set_text("warning", "warn") + set_text("warning", "$warning") set_color("warning", "yellow") -- the building progress diff --git a/xmake/themes/emoji/xmake.lua b/xmake/themes/emoji/xmake.lua index 03342ba44..cab523c25 100644 --- a/xmake/themes/emoji/xmake.lua +++ b/xmake/themes/emoji/xmake.lua @@ -42,7 +42,7 @@ theme("emoji") set_color("error", "red") -- the warning info - set_text("warning", "warning warn") + set_text("warning", "warning $warning") set_color("warning", "yellow") -- the building progress diff --git a/xmake/themes/plain/xmake.lua b/xmake/themes/plain/xmake.lua index b814322e0..d7f1d2399 100644 --- a/xmake/themes/plain/xmake.lua +++ b/xmake/themes/plain/xmake.lua @@ -26,7 +26,7 @@ theme("plain") -- the success status - set_text("success", "ok") + set_text("success", "$ok") set_color("success", "") -- the failure status @@ -42,7 +42,7 @@ theme("plain") set_color("error", "") -- the warning info - set_text("warning", "warn") + set_text("warning", "$warning") set_color("warning", "") -- the building progress |
