aboutsummaryrefslogtreecommitdiff
path: root/src/lpm.lua
diff options
context:
space:
mode:
Diffstat (limited to 'src/lpm.lua')
-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