struct Term::Color::Support

Overview

Terminal color support detection (merged from original term-color)

Defined in:

color/support.cr

Constant Summary

ENV_VARS = ["COLORTERM", "ANSICON"] of ::String
TERM_REGEX = /\ color| # claims color support in the name direct| # claims 24-bit direct color support #{Term::Color::Mode::TERM_256}| #{Term::Color::Mode::TERM_64}| #{Term::Color::Mode::TERM_52}| #{Term::Color::Mode::TERM_16}| #{Term::Color::Mode::TERM_8}| ^ansi(\.sys.*)?$| ^cygwin| ^linux| ^putty| ^rxvt| ^screen| ^tmux| ^xterm| ^ms\-terminal /ix

Constructors

Instance Method Summary

Constructor Detail

def self.new(env : Hash(String, String), verbose : Bool = false) #

[View source]

Instance Method Detail

def disabled? : Bool #

Detect if color support has been disabled with NO_COLOR


[View source]
def from_env : Bool | Nil #

Check color-related env vars


[View source]
def from_term : Bool | Nil #

Inspect TERM for color support


[View source]
def from_tput : Bool | Nil #

Check via tput


[View source]
def from_windows_term : Bool | Nil #

[View source]
def support? : Bool #

Detect if terminal supports color


[View source]