Module: Sai::Conversion::ColorSequence Private
- Defined in:
- lib/sai/conversion/color_sequence.rb
Overview
This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.
ANSI escape sequence utilities
Class Method Summary collapse
-
.resolve(color, mode, style_type = :foreground) ⇒ String
private
Convert a color to the appropriate ANSI escape sequence.
Class Method Details
.resolve(color, mode, style_type = :foreground) ⇒ String
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.
Convert a color to the appropriate ANSI escape sequence
33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/sai/conversion/color_sequence.rb', line 33 def resolve(color, mode, style_type = :foreground) rgb = RGB.resolve(color) style_type = validate_style_type(style_type) #: style_type case mode when Terminal::ColorMode::TRUE_COLOR then true_color(rgb, style_type) when Terminal::ColorMode::ADVANCED then advanced(rgb, style_type) when Terminal::ColorMode::ANSI then ansi(rgb, style_type) when Terminal::ColorMode::BASIC then basic(rgb, style_type) else '' end end |