Module: Sai::Support
- Defined in:
- lib/sai/support.rb
Overview
Determine the color capabilities of the terminal
Class Method Summary collapse
-
.advanced? ⇒ Boolean
(also: color256?, colour256?, eight_bit?, two_hundred_fifty_six_color?, two_hundred_fifty_six_colour?)
Check if the terminal supports 256 colors (8-bit).
-
.ansi? ⇒ Boolean
(also: color16?, colour16?, four_bit?, sixteen_color?, sixteen_colour?)
Check if the terminal supports ANSI colors (4-bit).
-
.basic? ⇒ Boolean
(also: color8?, colour8?, eight_color?, eight_colour?, three_bit?)
Check if the terminal supports basic colors (3-bit).
-
.color? ⇒ Boolean
Check if the terminal supports color output.
-
.true_color? ⇒ Boolean
(also: color16m?, colour16m?, sixteen_million_color?, sixteen_million_colour?, twenty_for_bit?)
Check if the terminal supports true color (24-bit).
Class Method Details
.advanced? ⇒ Boolean Also known as: color256?, colour256?, eight_bit?, two_hundred_fifty_six_color?, two_hundred_fifty_six_colour?
Check if the terminal supports 256 colors (8-bit)
27 28 29 |
# File 'lib/sai/support.rb', line 27 def advanced? Terminal::Capabilities.detect_color_support >= Terminal::ColorMode::ADVANCED end |
.ansi? ⇒ Boolean Also known as: color16?, colour16?, four_bit?, sixteen_color?, sixteen_colour?
Check if the terminal supports ANSI colors (4-bit)
48 49 50 |
# File 'lib/sai/support.rb', line 48 def ansi? Terminal::Capabilities.detect_color_support >= Terminal::ColorMode::ANSI end |
.basic? ⇒ Boolean Also known as: color8?, colour8?, eight_color?, eight_colour?, three_bit?
Check if the terminal supports basic colors (3-bit)
69 70 71 |
# File 'lib/sai/support.rb', line 69 def basic? Terminal::Capabilities.detect_color_support >= Terminal::ColorMode::BASIC end |
.color? ⇒ Boolean
Check if the terminal supports color output
90 91 92 |
# File 'lib/sai/support.rb', line 90 def color? Terminal::Capabilities.detect_color_support > Terminal::ColorMode::NO_COLOR end |
.true_color? ⇒ Boolean Also known as: color16m?, colour16m?, sixteen_million_color?, sixteen_million_colour?, twenty_for_bit?
Check if the terminal supports true color (24-bit)
106 107 108 |
# File 'lib/sai/support.rb', line 106 def true_color? Terminal::Capabilities.detect_color_support >= Terminal::ColorMode::TRUE_COLOR end |