super_diff icon indicating copy to clipboard operation
super_diff copied to clipboard

Hide color escape chars in non-TTY

Open iSarCasm opened this issue 2 years ago • 1 comments

Currently, out-of-the-box super_diff will continue using colors in non-TTY environments such as CircleCI, etc.

To avoid this, one can simply modify spec_helper.rb like this:

unless config.color
    SuperDiff.configure do |config|
      config.actual_color = :white
      config.expected_color = :white
      config.border_color = :white
      config.header_color = :white
    end
end

Ideally, this gem should automatically detect this case.

I can try and open a PR once confirmed

iSarCasm avatar Dec 07 '22 02:12 iSarCasm

Thanks for reporting this. We are doing some detection already here. I suppose for some reason I opted to enable colors on CI. We could remove that part of the logic though. Note that not all colors are getting disabled, so there is more we have to do to get rid of color completely — that is logged in #82 — but removing ENV["CI"] would be a start.

mcmire avatar Dec 07 '22 16:12 mcmire