Class: Tuile::EventQueue::BackgroundColorEvent

Inherits:
Object
  • Object
show all
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

Class Method Summary collapse

Instance Attribute Details

#colorColor (readonly)

@return — the reported background, 24-bit RGB.

Returns:



259
260
261
262
263
264
265
266
267
# File 'lib/tuile/event_queue.rb', line 259

class BackgroundColorEvent < Data.define(:color)
  # @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.

Parameters:

  • key (String)

Returns:



263
264
265
266
# File 'lib/tuile/event_queue.rb', line 263

def self.parse(key)
  result = TerminalBackground.parse(key)
  result&.color && new(result.color)
end