Method: TTY::Color::Mode#from_term

Defined in:
lib/tty/color/mode.rb

#from_termNoValue, Integer

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Check TERM environment for colors

Returns:



57
58
59
60
61
62
63
64
65
66
67
68
69
70
# File 'lib/tty/color/mode.rb', line 57

def from_term
  case @env["TERM"]
  when TERM_24BIT then TRUECOLORS
  when /[-+](\d+)color/ then $1.to_i
  when /[-+](\d+)bit/   then 2**$1.to_i
  when TERM_256 then 256
  when TERM_64  then 64
  when TERM_52  then 52
  when TERM_16  then 16
  when TERM_8   then 8
  when /dummy/  then 0
  else NoValue
  end
end