Class: Reline::Face

Inherits:
Object
  • Object
show all
Defined in:
lib/reline/face.rb

Class Method Summary collapse

Class Method Details

.[](name) ⇒ Object



169
170
171
# File 'lib/reline/face.rb', line 169

def self.[](name)
  @configs[name]
end

.config(name, &block) ⇒ Object



173
174
175
176
# File 'lib/reline/face.rb', line 173

def self.config(name, &block)
  @configs ||= {}
  @configs[name] = Config.new(name, &block)
end

.configsObject



178
179
180
# File 'lib/reline/face.rb', line 178

def self.configs
  @configs.transform_values(&:definition)
end

.force_truecolorObject



164
165
166
167
# File 'lib/reline/face.rb', line 164

def self.force_truecolor
  @force_truecolor = true
  @configs&.each_value(&:reconfigure)
end

.load_initial_configsObject



182
183
184
185
186
187
188
189
190
191
192
193
# File 'lib/reline/face.rb', line 182

def self.load_initial_configs
  config(:default) do |conf|
    conf.define :default, style: :reset
    conf.define :enhanced, style: :reset
    conf.define :scrollbar, style: :reset
  end
  config(:completion_dialog) do |conf|
    conf.define :default, foreground: :bright_white, background: :gray
    conf.define :enhanced, foreground: :black, background: :white
    conf.define :scrollbar, foreground: :white, background: :gray
  end
end

.reset_to_initial_configsObject



195
196
197
198
# File 'lib/reline/face.rb', line 195

def self.reset_to_initial_configs
  @configs = {}
  load_initial_configs
end

.truecolor?Boolean

Returns:

  • (Boolean)


160
161
162
# File 'lib/reline/face.rb', line 160

def self.truecolor?
  @force_truecolor || %w[truecolor 24bit].include?(ENV['COLORTERM'])
end