Class: Thor::Interactive::TUI::Theme
- Inherits:
-
Object
- Object
- Thor::Interactive::TUI::Theme
- Defined in:
- lib/thor/interactive/tui/theme.rb
Overview
Theming system for the TUI shell. Predefined themes and custom color configuration.
Constant Summary collapse
- THEMES =
{ default: { output_fg: nil, output_border: :dark_gray, error_fg: :red, command_echo_fg: :dark_gray, system_fg: :cyan, input_fg: nil, input_border: :green, input_title_fg: :green, cursor_fg: :black, cursor_bg: :white, status_bar_fg: :white, status_bar_bg: :blue, completion_fg: :white, completion_bg: :dark_gray, completion_selected_fg: :black, completion_selected_bg: :cyan }, dark: { output_fg: :gray, output_border: :dark_gray, error_fg: :light_red, command_echo_fg: :dark_gray, system_fg: :light_cyan, input_fg: :white, input_border: :light_green, input_title_fg: :light_green, cursor_fg: :black, cursor_bg: :light_yellow, status_bar_fg: :white, status_bar_bg: :dark_gray, completion_fg: :white, completion_bg: :dark_gray, completion_selected_fg: :black, completion_selected_bg: :light_cyan }, light: { output_fg: :black, output_border: :gray, error_fg: :red, command_echo_fg: :gray, system_fg: :blue, input_fg: :black, input_border: :green, input_title_fg: :green, cursor_fg: :white, cursor_bg: :black, status_bar_fg: :white, status_bar_bg: :blue, completion_fg: :black, completion_bg: :gray, completion_selected_fg: :white, completion_selected_bg: :blue }, minimal: { output_fg: nil, output_border: :dark_gray, error_fg: :red, command_echo_fg: :dark_gray, system_fg: :yellow, input_fg: nil, input_border: :dark_gray, input_title_fg: :white, cursor_fg: :black, cursor_bg: :white, status_bar_fg: :black, status_bar_bg: :white, completion_fg: :white, completion_bg: :dark_gray, completion_selected_fg: :black, completion_selected_bg: :white } }.freeze
Instance Attribute Summary collapse
-
#colors ⇒ Object
readonly
Returns the value of attribute colors.
Instance Method Summary collapse
- #[](key) ⇒ Object
- #command_echo_style ⇒ Object
- #completion_bg_style ⇒ Object
- #completion_selected_style ⇒ Object
- #completion_style ⇒ Object
- #cursor_style ⇒ Object
- #error_style ⇒ Object
-
#initialize(theme = :default) ⇒ Theme
constructor
A new instance of Theme.
- #input_border_style ⇒ Object
- #input_title_style ⇒ Object
- #output_border_style ⇒ Object
- #output_style ⇒ Object
- #status_bar_style ⇒ Object
- #style(key) ⇒ Object
- #system_style ⇒ Object
Constructor Details
Instance Attribute Details
#colors ⇒ Object (readonly)
Returns the value of attribute colors.
84 85 86 |
# File 'lib/thor/interactive/tui/theme.rb', line 84 def colors @colors end |
Instance Method Details
#[](key) ⇒ Object
94 95 96 |
# File 'lib/thor/interactive/tui/theme.rb', line 94 def [](key) @colors[key] end |
#command_echo_style ⇒ Object
112 113 114 |
# File 'lib/thor/interactive/tui/theme.rb', line 112 def command_echo_style RatatuiRuby::Style::Style.new(fg: @colors[:command_echo_fg]) end |
#completion_bg_style ⇒ Object
144 145 146 |
# File 'lib/thor/interactive/tui/theme.rb', line 144 def completion_bg_style RatatuiRuby::Style::Style.new(bg: @colors[:completion_bg]) end |
#completion_selected_style ⇒ Object
148 149 150 151 152 153 154 |
# File 'lib/thor/interactive/tui/theme.rb', line 148 def completion_selected_style RatatuiRuby::Style::Style.new( fg: @colors[:completion_selected_fg], bg: @colors[:completion_selected_bg], modifiers: [:bold] ) end |
#completion_style ⇒ Object
140 141 142 |
# File 'lib/thor/interactive/tui/theme.rb', line 140 def completion_style RatatuiRuby::Style::Style.new(fg: @colors[:completion_fg]) end |
#cursor_style ⇒ Object
128 129 130 |
# File 'lib/thor/interactive/tui/theme.rb', line 128 def cursor_style RatatuiRuby::Style::Style.new(fg: @colors[:cursor_fg], bg: @colors[:cursor_bg], modifiers: [:bold]) end |
#error_style ⇒ Object
108 109 110 |
# File 'lib/thor/interactive/tui/theme.rb', line 108 def error_style RatatuiRuby::Style::Style.new(fg: @colors[:error_fg]) end |
#input_border_style ⇒ Object
120 121 122 |
# File 'lib/thor/interactive/tui/theme.rb', line 120 def input_border_style RatatuiRuby::Style::Style.new(fg: @colors[:input_border]) end |
#input_title_style ⇒ Object
124 125 126 |
# File 'lib/thor/interactive/tui/theme.rb', line 124 def input_title_style RatatuiRuby::Style::Style.new(fg: @colors[:input_title_fg], modifiers: [:bold]) end |
#output_border_style ⇒ Object
132 133 134 |
# File 'lib/thor/interactive/tui/theme.rb', line 132 def output_border_style RatatuiRuby::Style::Style.new(fg: @colors[:output_border]) end |
#output_style ⇒ Object
103 104 105 106 |
# File 'lib/thor/interactive/tui/theme.rb', line 103 def output_style fg = @colors[:output_fg] fg ? RatatuiRuby::Style::Style.new(fg: fg) : nil end |
#status_bar_style ⇒ Object
136 137 138 |
# File 'lib/thor/interactive/tui/theme.rb', line 136 def RatatuiRuby::Style::Style.new(fg: @colors[:status_bar_fg], bg: @colors[:status_bar_bg]) end |
#style(key) ⇒ Object
98 99 100 101 |
# File 'lib/thor/interactive/tui/theme.rb', line 98 def style(key) color = @colors[key] color ? RatatuiRuby::Style::Style.new(fg: color) : nil end |
#system_style ⇒ Object
116 117 118 |
# File 'lib/thor/interactive/tui/theme.rb', line 116 def system_style RatatuiRuby::Style::Style.new(fg: @colors[:system_fg]) end |