class RatatuiRuby::Text::Span
A styled string fragment.
Text is rarely uniform. You need to bold a keyword, colorize an error, or dim a timestamp.
This class attaches style to content. It pairs a string with visual attributes.
combine spans into a {Line} to create rich text.
Examples
Text::Span.new(content: "Error", style: Style.new(fg: :red, modifiers: [:bold]))
Attributes
The text content.
The style to apply.
Public Class Methods
Source
# File lib/ratatui_ruby/schema/text.rb, line 70 def initialize(content:, style: nil) super end
Source
# File lib/ratatui_ruby/schema/text.rb, line 77 def self.styled(content, style = nil) new(content:, style:) end
Concise helper for styling.
Text::Span.styled("Bold", Style.new(modifiers: [:bold]))