aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Harrison <adamdharrison@gmail.com>2023-06-13 11:52:16 -0400
committerAdam Harrison <adamdharrison@gmail.com>2023-06-13 11:52:16 -0400
commiteaf74ed6bcb9ea1236e15fe8124db5081059ed8b (patch)
tree23bb99a6978cb9ebed3ec1a4a047a40a82635218
parenta6f52ebb1744c1c36302c1cd244483ea55bc1ca9 (diff)
downloadlite-xl-plugin-manager-eaf74ed6bcb9ea1236e15fe8124db5081059ed8b.tar.gz
lite-xl-plugin-manager-eaf74ed6bcb9ea1236e15fe8124db5081059ed8b.zip
Adopted NO_COLOR standard.
-rw-r--r--src/lpm.lua4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/lpm.lua b/src/lpm.lua
index 0fce4f7..1fa8a81 100644
--- a/src/lpm.lua
+++ b/src/lpm.lua
@@ -487,9 +487,9 @@ local colors = {
blue = 34,
cyan = 36
}
-local TERM = os.getenv("TERM")
+local SHOULD_COLOR = os.getenv("TERM") and os.getenv("TERM") ~= "dumb" and not os.getenv("NO_COLOR")
local function colorize(text, color)
- if not TERM or not TTY or NO_COLOR or not color then return text end
+ if not SHOULD_COLOR or not TTY or NO_COLOR or not color then return text end
return "\x1B[" .. colors[color] .. "m" .. text .. "\x1B[0m"
end