Module: TermColor::Rule
Overview
Rule processor
}
Defined Under Namespace
Classes: Compiled
Constant Summary collapse
- Colors =
Named Standard ANSI Color constants (Basic named values for ‘fg` and `bg` rule option attributes)
{ black: 0, red: 1, green: 2, yellow: 3, blue: 4, magenta: 5, cyan: 6, white: 7 }.freeze
- ColorTargets =
Numerical modifiers used with Color Values to target foreground or background.
-
For Named Standard Colors, value is added to given color’s numerical value
-
For XTerm 256/16m color codes, value is added to mode base
-
{ fg: 30, # Foreground target bg: 40 # Background target }.freeze
- Styles =
Style option constants (Values that can be included in style ‘enable` and `disable` rule option attributes)
{ bold: 1, ## # Alias for bold intense: 1, dim: 2, ## # Alias for dim dark: 2, italic: 3, underline: 4, inverse: 7, strikethrough: 9 }.freeze
- StyleActions =
Style action codes (Numerical modifiers applied to Style Codes to enable/disable them based on which option attribute action was used)
{ # Enable style(s) action enable: 0, # Disable style(s) action disable: 20 }
- Resets =
Reset option constants (Values for ‘reset` rule option attribute)
{ # Reset everything all: 0, # Reset foreground color only fg: 39, # Reset background color only bg: 49 }.freeze
- Parts =
Descriptive aliases for part names
{ # Style applied on rule open inside: :inside, # Style appled when rule close is given after: :after }
- Ops =
Valid rule operations mapped to accepted const values (colors [fg, bg] can also accept integers)
{ # Foreground color option fg: Colors.keys, # Background color option bg: Colors.keys, # Enable style(s) action enable: Styles.keys, # Disable style(s) action disable: Styles.keys, # Reset action reset: [ :fg, # Reset fg color :bg, # Reset bg color :style, # Reset all styles :all # Reset colors and styles ] }
- XTERM_COLOR_TARGET =
Value added to ColorTarget when using XTerm colors
8- XTERM_COLOR_256 =
Mode constant for XTerm 256 Colors
5- XTERM_COLOR_16M =
Mode constant for XTerm 16m Colors
2
Instance Method Summary collapse
-
#compile(rule) ⇒ Compiled
Compile rule into frozen instance of ‘Compiled` struct.
Instance Method Details
#compile(rule) ⇒ Compiled
Compile rule into frozen instance of ‘Compiled` struct
172 173 174 175 176 177 178 179 |
# File 'lib/term_color/rule.rb', line 172 def compile(rule) evaluated = evaluate(rule) return Compiled.new( rule, evaluated, codes(evaluated) ).freeze end |