class Eagle::Theme

Overview

Colors, fonts and sizes shared by UI controls. Assign a theme to any control and every control below it uses it. Theme.default is a dark theme, and #light gives a light variant.

theme = Theme.default.light
theme.accent = Color.hex("#c98a12")
theme.corner_radius = 0
theme.font = Font.load("res://fonts/Inter.ttf", 18)

menu = Panel.new
menu.theme = theme # everything inside the menu uses it

Defined in:

eagle/ui/theme.cr

Constructors

Class Method Summary

Instance Method Summary

Constructor Detail

def self.default : Theme #

The shared default theme. Change it to restyle every control that has no theme of its own.


Class Method Detail

def self.default=(t : Theme) #

Replaces the default theme.


Instance Method Detail

def accent : Color #

Highlight color for sliders, progress bars and checked boxes.


def accent=(accent : Color) #

Highlight color for sliders, progress bars and checked boxes.


def accent_text : Color #

Text drawn on top of the accent color.


def accent_text=(accent_text : Color) #

Text drawn on top of the accent color.


def border_width : Float32 #

Border thickness. 0 hides borders.


def border_width=(border_width : Float32) #

Border thickness. 0 hides borders.


def button : Color #

Button background.


def button=(button : Color) #

Button background.


def button_border : Color #

Button border.


def button_border=(button_border : Color) #

Button border.


def button_hover : Color #

Button background under the mouse.


def button_hover=(button_hover : Color) #

Button background under the mouse.


def button_pressed : Color #

Button background while pressed.


def button_pressed=(button_pressed : Color) #

Button background while pressed.


def control_height : Float32 #

Default height of buttons, fields and sliders.


def control_height=(control_height : Float32) #

Default height of buttons, fields and sliders.


def corner_radius : Float32 #

Corner rounding for panels and buttons. 0 gives square corners.


def corner_radius=(corner_radius : Float32) #

Corner rounding for panels and buttons. 0 gives square corners.


def focus : Color #

Color of the focus ring.


def focus=(focus : Color) #

Color of the focus ring.


def font : Font | Nil #

Font for all controls. nil uses Font.default.


def font=(font : Font | Nil) #

Font for all controls. nil uses Font.default.


def font_or_default : Font #

The font in effect.


def font_scale : Float32 #

Text scale for all controls.


def font_scale=(font_scale : Float32) #

Text scale for all controls.


def input_bg : Color #

Text field background.


def input_bg=(input_bg : Color) #

Text field background.


def light : Theme #

A copy of this theme with light colors.


def padding : Float32 #

Default container padding.


def padding=(padding : Float32) #

Default container padding.


def panel : Color #

Panel background.


def panel=(panel : Color) #

Panel background.


def panel_border : Color #

Panel border.


def panel_border=(panel_border : Color) #

Panel border.


def spacing : Float32 #

Default gap between children in containers.


def spacing=(spacing : Float32) #

Default gap between children in containers.


def text : Color #

Text color.


def text=(text : Color) #

Text color.


def text_disabled : Color #

Text color for disabled controls.


def text_disabled=(text_disabled : Color) #

Text color for disabled controls.


def track : Color #

Slider and progress bar track color.


def track=(track : Color) #

Slider and progress bar track color.