Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature.terminal truecolor #1413

Merged
merged 9 commits into from Jan 27, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 10 additions & 2 deletions lib/rouge/cli.rb
Expand Up @@ -200,9 +200,17 @@ def self.doc
yield %[ delimiters. implies --escape]
end

# TODO: find a better way to do this?
# There is no consistent way to do this, but this is used elsewhere,
# and we provide explicit opt-in and opt-out with $COLORTERM
def self.supports_truecolor?
ENV['TERM'] == 'xterm' || %w(24bit truecolor).include?(ENV['COLORTERM'])
return true if %w(24bit truecolor).include?(ENV['COLORTERM'])
return false if ENV['COLORTERM'] && ENV['COLORTERM'] =~ /256/

if RbConfig::CONFIG['host_os'] =~ /mswin|mingw/
jneen marked this conversation as resolved.
Show resolved Hide resolved
ENV['ConEmuANSI'] == 'ON' && !ENV['ANSICON']
else
ENV['TERM'] !~ /(^rxvt)|(-color$)/
end
end

def self.parse(argv)
Expand Down