From eaf74ed6bcb9ea1236e15fe8124db5081059ed8b Mon Sep 17 00:00:00 2001 From: Adam Harrison Date: Tue, 13 Jun 2023 11:52:16 -0400 Subject: Adopted NO_COLOR standard. --- src/lpm.lua | 4 ++-- 1 file 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 -- cgit v1.2.3