Skip to content

status.span

status.span(
    spec,
) -> {
    kind: "span",
    text: string,
    fg: number | string?,
    bg: number | string?,
    bold: boolean?,
    italic: boolean?,
    underline: boolean?,
    dim: boolean?,
    reverse: boolean?,
    strikethrough: boolean?,
} | {
    kind: "fill",
    glyph: string?,
    fg: number | string?,
    bg: number | string?,
    bold: boolean?,
    italic: boolean?,
    underline: boolean?,
    dim: boolean?,
    reverse: boolean?,
    strikethrough: boolean?,
}

Build a styled span of text.

Accepts { text = "...", fg = <color>, bg = <color>, bold = true, italic = true, underline = true, dim = true, reverse = true, strikethrough = true }; a color is a "#rrggbb" hex string, a color name, a CSS color spec, or a palette index 0-255. Returns a span element for status.flat or a status.zones group.

local status = require('status')
local dim = status.span { text = 'idle', dim = true }

Parameters

  • spec: {text: string, fg: number | string?, bg: number | string?, bold: boolean?, italic: boolean?, underline: boolean?, dim: boolean?, reverse: boolean?, strikethrough: boolean?}
    • text — The text of the run, unsanitized. Sanitization is deferred to the layout pass.
    • fg
    • bg
    • bold
    • italic
    • underline
    • dim
    • reverse
    • strikethrough

Returns

  • {kind: "span", text: string, fg: number | string?, bg: number | string?, bold: boolean?, italic: boolean?, underline: boolean?, dim: boolean?, reverse: boolean?, strikethrough: boolean?} | {kind: "fill", glyph: string?, fg: number | string?, bg: number | string?, bold: boolean?, italic: boolean?, underline: boolean?, dim: boolean?, reverse: boolean?, strikethrough: boolean?}
    • kind
    • text — The text of the run, unsanitized. Sanitization is deferred to the layout pass.
    • fg
    • bg
    • bold
    • italic
    • underline
    • dim
    • reverse
    • strikethrough
    • kind
    • glyph — The glyph to repeat. Absent defaults to a space in the layout pass. An empty string is a parse error.
    • fg
    • bg
    • bold
    • italic
    • underline
    • dim
    • reverse
    • strikethrough