Visual attributes for a rendered cell.
%Harlock.Render.Style{fg: :cyan, bold: true}
%Harlock.Render.Style{reverse: true}
%Harlock.Render.Style{bg: {:rgb, 30, 30, 40}}Fields:
:fg/:bg— foreground / background colour. Atoms for the 16 standard colours (:red,:bright_blue, …),{:color256, n}for 256-color,{:rgb, r, g, b}for truecolor, or:defaultfor "no override.":bold/:dim/:italic/:underline/:reverse— boolean attributes, allfalseby default.
Construct with the struct directly, or with from/1 for keyword/map
input. merge/2 layers one style on top of another — useful for
applying a theme :focus token to a user-set element style without
losing fg/bg.
Compared by value, hashed by value — used as a key into the renderer's internal style table.
Summary
Functions
Layer over on top of under. Non-default colors in over win;
boolean attributes OR (any true wins). Used to apply theme tokens on
top of element-provided styles without losing user-set fg/bg.
Emit an SGR escape sequence that fully sets the cell's attributes. Starts
with \e[0m so the previous style doesn't bleed through. The diff renderer
emits this once per style transition; we don't try to be clever about
diffing individual attribute changes — terminals process SGR fast enough
that the extra bytes are cheaper than the bookkeeping.
Types
@type color() ::
:default
| :black
| :red
| :green
| :yellow
| :blue
| :magenta
| :cyan
| :white
| :bright_black
| :bright_red
| :bright_green
| :bright_yellow
| :bright_blue
| :bright_magenta
| :bright_cyan
| :bright_white
| {:color256, 0..255}
| {:rgb, 0..255, 0..255, 0..255}
Functions
@spec default() :: t()
Layer over on top of under. Non-default colors in over win;
boolean attributes OR (any true wins). Used to apply theme tokens on
top of element-provided styles without losing user-set fg/bg.
Emit an SGR escape sequence that fully sets the cell's attributes. Starts
with \e[0m so the previous style doesn't bleed through. The diff renderer
emits this once per style transition; we don't try to be clever about
diffing individual attribute changes — terminals process SGR fast enough
that the extra bytes are cheaper than the bookkeeping.