struct
Termisu::Cell
- Termisu::Cell
- Struct
- Value
- Object
Overview
Cell represents a single character cell in the terminal buffer.
Cell contains:
- ch: The unicode character (rune)
- fg: Foreground color (supports ANSI-8, ANSI-256, and RGB)
- bg: Background color (supports ANSI-8, ANSI-256, and RGB)
- attr: Text attributes (bold, underline, etc.)
Example:
# Using named colors
cell = Termisu::Cell.new('A', fg: Color.green, bg: Color.black, attr: Attribute::Bold)
# Using 256-color palette
cell = Termisu::Cell.new('B', fg: Color.ansi256(208), bg: Color.ansi256(235))
# Using RGB/TrueColor
cell = Termisu::Cell.new('C', fg: Color.rgb(255, 128, 64), bg: Color.rgb(30, 30, 30))
Defined in:
termisu/cell.crConstructors
-
.default : Cell
Creates a default empty cell (space with default colors).
-
.new(ch : Char = ' ', fg : Color = Color.white, bg : Color = Color.default, attr : Attribute = Attribute::None)
Creates a new Cell with the specified character and colors.
Instance Method Summary
-
#==(other : Cell) : Bool
Checks if this cell equals another cell.
- #attr : Attribute
- #attr=(attr : Attribute)
- #bg : Color
- #bg=(bg : Color)
- #ch : Char
- #ch=(ch : Char)
- #fg : Color
- #fg=(fg : Color)
-
#reset
Resets the cell to default state (space, white on default background, no attributes).
Constructor Detail
def self.new(ch : Char = ' ', fg : Color = Color.white, bg : Color = Color.default, attr : Attribute = Attribute::None)
#
Creates a new Cell with the specified character and colors.
Parameters:
- ch: Unicode character to display
- fg: Foreground color (default: white)
- bg: Background color (default: default terminal color)
- attr: Text attributes (default: None)