It seems lipgloss reads the UNIX environment sometime early in its lifecycle such that changes to it later don't have any effect:
# test.rb
require "lipgloss"
if ARGV[0] == "no"
puts "Disabling colors"
ENV["NO_COLOR"] = "1"
end
puts Lipgloss::Style.new.foreground("#ffff00").render("HELLO")
> ruby test.rb
HELLO (in yellow)
> NO_COLOR=1 ruby test.rb
HELLO (not colored)
> ruby test.rb no
Disabling colors
HELLO (in yellow)
Ultimatley, I'm trying to disable colors during a test. By the time my code runs, even in a test, whatever Lipgloss does to decide if colors should be used has been decided as "yes". In the go version's faq, it implies you can call lipgloss.SetColorProfile(termenv.TrueColor) (or some other value from termenv) to force its behavior. Is this possible with the Ruby version?
It seems lipgloss reads the UNIX environment sometime early in its lifecycle such that changes to it later don't have any effect:
Ultimatley, I'm trying to disable colors during a test. By the time my code runs, even in a test, whatever Lipgloss does to decide if colors should be used has been decided as "yes". In the go version's faq, it implies you can call
lipgloss.SetColorProfile(termenv.TrueColor)(or some other value fromtermenv) to force its behavior. Is this possible with the Ruby version?