Class: Tuile::EventQueue::BackgroundColorEvent
- Inherits:
-
Object
- Object
- Tuile::EventQueue::BackgroundColorEvent
- Includes:
- Tuile::Event
- Defined in:
- lib/tuile/event_queue.rb,
sig/tuile.rbs
Overview
The terminal reported its background color — an OSC 11 reply, read back as a whole "key" by Keys.getkey.
Only ever an answer to a TerminalBackground::QUERY someone wrote, and only the color: a ColorSchemeEvent is what prompts the re-probe and what carries the light/dark half. See Screen#background_color.
Instance Attribute Summary collapse
-
#color ⇒ Color
readonly
@return — the reported background, 24-bit RGB.
Class Method Summary collapse
-
.parse(key) ⇒ BackgroundColorEvent?
@param
key— key read via Keys.getkey.
Instance Attribute Details
#color ⇒ Color (readonly)
@return — the reported background, 24-bit RGB.
270 271 272 273 274 275 276 277 278 279 280 |
# File 'lib/tuile/event_queue.rb', line 270 class BackgroundColorEvent < Data.define(:color) include Tuile::Event # @param key [String] key read via {Keys.getkey}. # @return [BackgroundColorEvent, nil] nil when `key` is not an OSC 11 # background reply. def self.parse(key) result = TerminalBackground.parse(key) result&.color && new(result.color) end end |
Class Method Details
.parse(key) ⇒ BackgroundColorEvent?
@param key — key read via Keys.getkey.
@return — nil when key is not an OSC 11
background reply.
276 277 278 279 |
# File 'lib/tuile/event_queue.rb', line 276 def self.parse(key) result = TerminalBackground.parse(key) result&.color && new(result.color) end |