struct

Glimmer::Style::StylePrimitive

Inherits Struct < Value < Object

StylePrimitive represents styling attributes that can be applied to text.

Use the fluent with_* methods to build styles:

style = StylePrimitive.new

.with_foreground(ANSI256Color.new(39))

.with_bold

.with_prefix("## ")

Constructors

new(foreground : Color | Nil = nil, background : Color | Nil = nil, bold : Bool = false, italic : Bool = false, underline : Bool = false, strikethrough : Bool = false, overline : Bool = false, prefix : String = "", suffix : String = "")
Source

Instance methods

background
Source
bold?
Source
foreground
Source
italic?
Source
merge(other : StylePrimitive) : StylePrimitive

Returns a new StylePrimitive that combines this style with another.

The other style takes precedence for any attributes it sets.

Source
overline?
Source
prefix
Source
render(text : String, profile : ColorProfile = ColorProfile::TrueColor) : String

Renders the given text with this style applied.

Source
strikethrough?
Source
suffix
Source
underline?
Source
with_background(color : Color) : StylePrimitive
Source
with_bold(value : Bool = true) : StylePrimitive
Source
with_foreground(color : Color) : StylePrimitive
Source
with_italic(value : Bool = true) : StylePrimitive
Source
with_overline(value : Bool = true) : StylePrimitive
Source
with_prefix(str : String) : StylePrimitive
Source
with_strikethrough(value : Bool = true) : StylePrimitive
Source
with_suffix(str : String) : StylePrimitive
Source
with_underline(value : Bool = true) : StylePrimitive
Source