struct

Lipgloss::Style

Inherits Raven::Mixin::InitializeWith < Struct < Value < Object

Style is the core styling primitive - a complete Lipgloss port

Constants

WRAP_CACHE_MAX = 256

Constructors

new
new_style

Create a new style (factory method like Lipgloss)

Class methods

join_horizontal(pos : Position, strs : Array(View)) : String
join_horizontal(pos : Position, strs : Array(String)) : String
join_horizontal(pos : Float64, strs : Array(View)) : String
join_horizontal(pos : Float64, strs : Array(String)) : String
join_horizontal(pos : Position, *strs : String) : String

JoinHorizontal is a utility function for horizontally joining two potentially multi-lined strings along a vertical axis.

pos: Vertical alignment (Top, Bottom, Center)

join_horizontal(pos : Position, *strs : View) : String
join_horizontal(pos : Float64, *strs : String) : String
join_horizontal(pos : Float64, *strs : View) : String
join_vertical(pos : Position, strs : Array(View)) : String
join_vertical(pos : Position, strs : Array(String)) : String
join_vertical(pos : Float64, strs : Array(View)) : String
join_vertical(pos : Float64, strs : Array(String)) : String
join_vertical(pos : Position, *strs : String) : String

JoinVertical is a utility function for vertically joining two potentially multi-lined strings along a horizontal axis.

pos: Horizontal alignment (Left, Right, Center)

join_vertical(pos : Position, *strs : View) : String
join_vertical(pos : Float64, *strs : String) : String
join_vertical(pos : Float64, *strs : View) : String

Instance methods

align(h : Position, v : Position) : Style

Alignment - two arguments set horizontal and vertical

align(p : Position) : Style

Alignment - single argument sets horizontal

align
align_horizontal(p : Position) : Style
align_horizontal
align_horizontal_value
align_value
align_vertical(p : Position) : Style
align_vertical
align_vertical_value
background(c : Color | AdaptiveColor | CompleteColor | CompleteAdaptiveColor | NoColor) : Style
background(spec : String) : Style
background

DEPRECATED Use #background_color instead

background_color
bg_hex(hex : String) : Style
bg_indexed(idx : Int32) : Style

Compatibility helpers for older example code.

black
blue
bold(v : Bool = true) : Style

Text formatting

bold=(value : Bool) : Bool
bold?

Crystal-idiomatic boolean getters

border(b : Border) : Style

Border [FIX] Explicit overload for single argument to satisfy compiler

border(b : Border, *sides : Bool) : Style
border
border_background(*colors : Color | AdaptiveColor | CompleteColor | CompleteAdaptiveColor | NoColor) : Style
border_bottom(v : Bool = true) : Style
border_bottom?
border_bottom_background(c : Color | AdaptiveColor | CompleteColor | CompleteAdaptiveColor | NoColor) : Style
border_bottom_background_color
border_bottom_foreground(c : Color | AdaptiveColor | CompleteAdaptiveColor | CompleteColor | NoColor) : Style
border_bottom_foreground_color
border_bottom_size
border_foreground(*colors : Color | AdaptiveColor | CompleteColor | CompleteAdaptiveColor | NoColor) : Style
border_foreground_blend
border_foreground_blend(*colors : Color | AdaptiveColor | CompleteColor | CompleteAdaptiveColor | NoColor) : Style
border_foreground_blend_offset(v : Int32) : Style
border_foreground_blend_offset
border_left(v : Bool = true) : Style
border_left?
border_left_background(c : Color | AdaptiveColor | CompleteColor | CompleteAdaptiveColor | NoColor) : Style
border_left_background_color
border_left_foreground(c : Color | AdaptiveColor | CompleteAdaptiveColor | CompleteColor | NoColor) : Style
border_left_foreground_color
border_left_size
border_right(v : Bool = true) : Style
border_right?
border_right_background(c : Color | AdaptiveColor | CompleteColor | CompleteAdaptiveColor | NoColor) : Style
border_right_background_color
border_right_foreground(c : Color | AdaptiveColor | CompleteColor | CompleteAdaptiveColor | NoColor) : Style
border_right_foreground_color
border_right_size
border_style(b : Border) : Style
border_style
border_top(v : Bool = true) : Style
border_top?
border_top_background(c : Color | AdaptiveColor | CompleteColor | CompleteAdaptiveColor | NoColor) : Style
border_top_background_color
border_top_foreground(c : Color | AdaptiveColor | CompleteColor | CompleteAdaptiveColor | NoColor) : Style
border_top_foreground_color

Border color getters

border_top_size
bright_blue
bright_cyan
bright_gray
bright_green
bright_magenta
bright_red
bright_yellow
color_whitespace(v : Bool = true) : Style
color_whitespace?
copy
cyan
dark_gray
faint(v : Bool = true) : Style
faint=(value : Bool) : Bool
faint?
fg_hex(hex : String) : Style
fg_indexed(idx : Int32) : Style

Compatibility helpers for older example code.

foreground(c : Color | AdaptiveColor | CompleteColor | CompleteAdaptiveColor | NoColor) : Style

Colors

foreground(spec : String) : Style
foreground

DEPRECATED Use #foreground_color instead

foreground_color
frame_size
get_align

ameba:disable Naming/AccessorMethodName

get_align_horizontal

ameba:disable Naming/AccessorMethodName

get_align_vertical

ameba:disable Naming/AccessorMethodName

get_background

ameba:disable Naming/AccessorMethodName

get_bold

Go parity accessors from get.go. ameba:disable Naming/AccessorMethodName

get_bool(prop : Props) : Bool
get_border

ameba:disable Naming/AccessorMethodName

get_border_bottom

ameba:disable Naming/AccessorMethodName

get_border_bottom_background

ameba:disable Naming/AccessorMethodName

get_border_bottom_foreground

ameba:disable Naming/AccessorMethodName

get_border_bottom_size

ameba:disable Naming/AccessorMethodName

get_border_foreground_blend

ameba:disable Naming/AccessorMethodName

get_border_foreground_blend_offset

ameba:disable Naming/AccessorMethodName

get_border_left

ameba:disable Naming/AccessorMethodName

get_border_left_background

ameba:disable Naming/AccessorMethodName

get_border_left_foreground

ameba:disable Naming/AccessorMethodName

get_border_left_size

ameba:disable Naming/AccessorMethodName

get_border_right

ameba:disable Naming/AccessorMethodName

get_border_right_background

ameba:disable Naming/AccessorMethodName

get_border_right_foreground

ameba:disable Naming/AccessorMethodName

get_border_right_size

ameba:disable Naming/AccessorMethodName

get_border_style

ameba:disable Naming/AccessorMethodName

get_border_top

ameba:disable Naming/AccessorMethodName

get_border_top_background

ameba:disable Naming/AccessorMethodName

get_border_top_foreground

ameba:disable Naming/AccessorMethodName

get_border_top_size

ameba:disable Naming/AccessorMethodName

get_border_top_width

ameba:disable Naming/AccessorMethodName

get_color_whitespace

ameba:disable Naming/AccessorMethodName

get_faint

ameba:disable Naming/AccessorMethodName

get_foreground

ameba:disable Naming/AccessorMethodName

get_frame_size

ameba:disable Naming/AccessorMethodName

get_height

ameba:disable Naming/AccessorMethodName

get_horizontal_border_size

ameba:disable Naming/AccessorMethodName

get_horizontal_frame_size

ameba:disable Naming/AccessorMethodName

get_horizontal_margins

ameba:disable Naming/AccessorMethodName

get_horizontal_padding

ameba:disable Naming/AccessorMethodName

get_inline

ameba:disable Naming/AccessorMethodName

get_italic

ameba:disable Naming/AccessorMethodName

get_margin

ameba:disable Naming/AccessorMethodName

get_margin_bottom

ameba:disable Naming/AccessorMethodName

get_margin_char

ameba:disable Naming/AccessorMethodName

get_margin_left

ameba:disable Naming/AccessorMethodName

get_margin_right

ameba:disable Naming/AccessorMethodName

get_margin_top

ameba:disable Naming/AccessorMethodName

get_max_height

ameba:disable Naming/AccessorMethodName

get_max_width

ameba:disable Naming/AccessorMethodName

get_padding

ameba:disable Naming/AccessorMethodName

get_padding_bottom

ameba:disable Naming/AccessorMethodName

get_padding_char

ameba:disable Naming/AccessorMethodName

get_padding_left

ameba:disable Naming/AccessorMethodName

get_padding_right

ameba:disable Naming/AccessorMethodName

get_padding_top

ameba:disable Naming/AccessorMethodName

get_reverse

ameba:disable Naming/AccessorMethodName

get_strikethrough

ameba:disable Naming/AccessorMethodName

get_strikethrough_spaces

ameba:disable Naming/AccessorMethodName

get_tab_width

ameba:disable Naming/AccessorMethodName

get_transform

ameba:disable Naming/AccessorMethodName

get_underline

ameba:disable Naming/AccessorMethodName

get_underline_color

ameba:disable Naming/AccessorMethodName

get_underline_spaces

ameba:disable Naming/AccessorMethodName

get_underline_style

ameba:disable Naming/AccessorMethodName

get_vertical_border_size

ameba:disable Naming/AccessorMethodName

get_vertical_frame_size

ameba:disable Naming/AccessorMethodName

get_vertical_margins

ameba:disable Naming/AccessorMethodName

get_vertical_padding

ameba:disable Naming/AccessorMethodName

get_width

ameba:disable Naming/AccessorMethodName

green
height(h : Int32) : Style
height
height=(h : Int32) : Int32
height_value
horizontal_border_size
horizontal_frame_size

Frame size calculations

horizontal_margins
horizontal_padding
inherit(other : Style) : Style

Inherit overlays the style in the argument onto this style Only unset rules on the receiver are inherited. Margins, padding, and underlying string values are not inherited.

inline(v : Bool = true) : Style

Other

inline?
italic(v : Bool = true) : Style
italic=(value : Bool) : Bool
italic?
magenta
margin(top : Int32, right : Int32, bottom : Int32, left : Int32) : Style
margin(top : Int32, horizontal : Int32, bottom : Int32) : Style
margin(vertical : Int32, horizontal : Int32) : Style
margin(all : Int32) : Style

Margin - CSS shorthand style

margin
margin_background(c : Color | AdaptiveColor | CompleteColor | CompleteAdaptiveColor | NoColor) : Style
margin_background_color
margin_bottom(i : Int32) : Style
margin_bottom
margin_char(char : Char) : Style
margin_char
margin_left(i : Int32) : Style
margin_left
margin_right(i : Int32) : Style
margin_right
margin_top(i : Int32) : Style
margin_top
max_height(h : Int32) : Style
max_height
max_height_value
max_width(w : Int32) : Style
max_width
max_width_value
merge(other : Style) : Style

Merge another style into this one Properties that are set in the other style will override this style's properties

on_black
on_blue
on_bright_blue
on_bright_cyan
on_bright_gray
on_bright_green
on_bright_magenta
on_bright_red
on_bright_yellow
on_cyan
on_dark_gray
on_green
on_magenta
on_red
on_white
on_yellow
padding(top : Int32, right : Int32, bottom : Int32, left : Int32) : Style
padding(top : Int32, horizontal : Int32, bottom : Int32) : Style
padding(vertical : Int32, horizontal : Int32) : Style
padding(all : Int32) : Style

Padding - CSS shorthand style

padding
padding_bottom(i : Int32) : Style
padding_bottom
padding_char(char : Char) : Style
padding_char
padding_left(i : Int32) : Style
padding_left
padding_right(i : Int32) : Style
padding_right
padding_top(i : Int32) : Style
padding_top
red
render(strs : Array(String)) : String
render
render(*strs : String) : String

Render applies the style to the given string(s)

renderer(r : StyleRenderer) : Style
reverse(v : Bool = true) : Style
reverse=(value : Bool) : Bool
reverse?
set?(prop : Props) : Bool
set_height(h : Int32) : Style

ameba:disable Naming/AccessorMethodName

set_string(*strs : String) : Style

Go parity helper for SetString. ameba:disable Naming/AccessorMethodName

set_width(w : Int32) : Style

ameba:disable Naming/AccessorMethodName

strikethrough(v : Bool = true) : Style
strikethrough=(value : Bool) : Bool
strikethrough?
strikethrough_spaces(v : Bool = true) : Style
strikethrough_spaces?
string

Stringer-style getter parity with Go's Style.String().

string(*strs : String) : Style

SetString sets the underlying string value for the style

string=(str : String) : Style
tab_width(n : Int32) : Style
tab_width
to_s(io : IO) : Nil

Same as #inspect(io).

to_s

Stringer parity: rendering with the currently set underlying value.

transform(fn : Proc(String, String)) : Style
transform
underline(v : Bool = true) : Style
underline=(value : Bool) : Bool
underline?
underline_color(c : Color | AdaptiveColor | CompleteColor | CompleteAdaptiveColor | NoColor) : Style
underline_color(hex : String) : Style
underline_color
underline_spaces(v : Bool = true) : Style
underline_spaces?
underline_style(style : UnderlineStyle) : Style
underline_style
unset_align
unset_align_horizontal
unset_align_vertical
unset_background
unset_bold
unset_border_background
unset_border_bottom
unset_border_bottom_background
unset_border_bottom_foreground
unset_border_foreground
unset_border_foreground_blend
unset_border_foreground_blend_offset
unset_border_left
unset_border_left_background
unset_border_left_foreground
unset_border_right
unset_border_right_background
unset_border_right_foreground
unset_border_style
unset_border_top
unset_border_top_background
unset_border_top_background_color

Deprecated Go parity alias.

unset_border_top_foreground
unset_color_whitespace
unset_faint
unset_foreground
unset_height
unset_inline
unset_italic
unset_margin_background
unset_margin_bottom
unset_margin_left
unset_margin_right
unset_margin_top
unset_margins
unset_max_height
unset_max_width
unset_padding
unset_padding_bottom
unset_padding_char
unset_padding_left
unset_padding_right
unset_padding_top
unset_reverse
unset_strikethrough
unset_strikethrough_spaces
unset_string
unset_tab_width
unset_transform
unset_underline
unset_underline_color
unset_underline_spaces
unset_underline_style
unset_width
value

Value returns the raw, unformatted string value

vertical_border_size
vertical_frame_size
vertical_margins
vertical_padding
white
width(w : Int32) : Style

Dimensions

width

Backwards compatibility aliases

width=(w : Int32) : Int32
width_value

Crystal-idiomatic property getters

with_attrs

Create a copy with modified attributes

yellow

Nested types