Class: SuperDiff::Csi::TwentyFourBitColor
- Inherits:
-
Object
- Object
- SuperDiff::Csi::TwentyFourBitColor
- Defined in:
- lib/super_diff/csi/twenty_four_bit_color.rb
Constant Summary collapse
- VALID_COMPONENT_RANGE =
0..255
- LEADING_CODES_BY_LAYER =
{ fg: 38, bg: 48 }.freeze
- SERIAL_CODE =
2
Instance Method Summary collapse
-
#initialize(value) ⇒ TwentyFourBitColor
constructor
A new instance of TwentyFourBitColor.
- #sequence_for(layer) ⇒ Object
Constructor Details
#initialize(value) ⇒ TwentyFourBitColor
Returns a new instance of TwentyFourBitColor.
8 9 10 |
# File 'lib/super_diff/csi/twenty_four_bit_color.rb', line 8 def initialize(value) @code = interpret_triplet!(value) end |
Instance Method Details
#sequence_for(layer) ⇒ Object
12 13 14 15 |
# File 'lib/super_diff/csi/twenty_four_bit_color.rb', line 12 def sequence_for(layer) leading_code = LEADING_CODES_BY_LAYER.fetch(layer) "\e[#{leading_code};#{SERIAL_CODE};#{code}m" end |