class

Opal::Theme

Inherits Reference < Object

Represents a semantic color and styling theme for consistent, accessible TUI interfaces.

Constructors

[](name : Symbol | String) : Theme
Source
build(name : String, &block : ThemeBuilder -> Nil) : Theme

Declarative Theme Builder DSL entry point

Source
catppuccin_latte
Source
catppuccin_mocha
Source
current
Source
current=(theme : Theme | Symbol | String) : Theme
Source
cyberpunk
Source
default
Source
dracula
Source
from_brand(name : String, brand : Color | String | Symbol, mode : Symbol = :dark) : Theme

Generates a balanced, harmonious theme from a single brand color and dark/light mode

Source
get(name : Symbol | String) : Theme
Source
gruvbox
Source
high_contrast
Source
monokai
Source
new(name : String, primary : Color, secondary : Color, accent : Color, background : Color, surface : Color, text : Color, text_muted : Color, border : Color, success : Color, warning : Color, danger : Color, info : Color, window_border : Border = Border.rounded, box_border : Border = Border.rounded, glyphs : GlyphSet = GlyphSet.new)
Source
nord
Source
register(theme : Theme) : Theme
Source
solarized_dark
Source
tokyo_night
Source

Class methods

find(name : Symbol | String) : Theme | Nil
Source

Instance methods

accent
Source
accent=(accent : Color)
Source
audit_contrast

Audits theme contrast ratios against WCAG 2.1 criteria

Source
background
Source
background=(background : Color)
Source
border
Source
border=(border : Color)
Source
box_border
Source
box_border=(box_border : Border)
Source
danger
Source
danger=(danger : Color)
Source
derive(name : String, primary : Color | String | Symbol | Nil = nil, secondary : Color | String | Symbol | Nil = nil, accent : Color | String | Symbol | Nil = nil, background : Color | String | Symbol | Nil = nil, surface : Color | String | Symbol | Nil = nil, text : Color | String | Symbol | Nil = nil, text_muted : Color | String | Symbol | Nil = nil, border : Color | String | Symbol | Nil = nil, success : Color | String | Symbol | Nil = nil, warning : Color | String | Symbol | Nil = nil, danger : Color | String | Symbol | Nil = nil, info : Color | String | Symbol | Nil = nil, window_border : Border | Symbol | String | Nil = nil, box_border : Border | Symbol | String | Nil = nil, glyphs : GlyphSet | Nil = nil) : Theme

Returns a new theme derived from this theme with selective overrides

Source
ensure_contrast(min_ratio : Float64 = 4.5) : Theme

Adjusts text and primary contrast against background to satisfy minimum WCAG ratio

Source
glyphs
Source
glyphs=(glyphs : GlyphSet)
Source
info
Source
info=(info : Color)
Source
name
Source
primary
Source
primary=(primary : Color)
Source
secondary
Source
secondary=(secondary : Color)
Source
success
Source
success=(success : Color)
Source
surface
Source
surface=(surface : Color)
Source
text
Source
text=(text : Color)
Source
text_muted
Source
text_muted=(text_muted : Color)
Source
warning
Source
warning=(warning : Color)
Source
window_border
Source
window_border=(window_border : Border)
Source