Style API
Types
Style
pub const Style = struct {
fg: ?Color = null,
bg: ?Color = null,
underline_color: ?Color = null,
bold: bool = false,
dim: bool = false,
italic: bool = false,
underline: bool = false,
blink: bool = false,
rapid_blink: bool = false,
reverse: bool = false,
hidden: bool = false,
strikethrough: bool = false,
super_script: bool = false,
sub_script: bool = false,
fraktur: bool = false,
overline: bool = false,
frame: bool = false,
encircle: bool = false,
};StyleOptions
pub const StyleOptions = struct {
fg: ?Color = null,
bg: ?Color = null,
underline_color: ?Color = null,
bold: bool = false,
dim: bool = false,
italic: bool = false,
underline: bool = false,
blink: bool = false,
rapid_blink: bool = false,
reverse: bool = false,
hidden: bool = false,
strikethrough: bool = false,
super_script: bool = false,
sub_script: bool = false,
fraktur: bool = false,
overline: bool = false,
frame: bool = false,
encircle: bool = false,
};Functions
tint.style
pub fn style(opts: StyleOptions) StyleCreates a composable style with the given options.
Methods
Style.init
pub fn init(opts: StyleOptions) StyleCreates a new Style with the given options.
Style.with
pub fn with(self: Style, opts: StyleOptions) StyleCreates a new Style based on this one with the given overrides. Boolean fields are OR'd together.
Style.withFg
pub fn withFg(self: Style, c: Color) StyleCreates a new Style with the given foreground color.
Style.withBg
pub fn withBg(self: Style, c: Color) StyleCreates a new Style with the given background color.
Style.withUnderline
pub fn withUnderline(self: Style, c: Color) StyleCreates a new Style with the given underline color.
Style.compose
pub fn compose(a: Style, b: Style) StyleMerges two styles. Style b overrides colors from style a. Boolean fields are OR'd.
Style.toAnsi
pub fn toAnsi(self: Style) []const u8Generates the complete ANSI escape sequence for this style.
Presets
tint.presets.err_style
pub fn err_style(fg: Color) StyleBold text with given foreground color.
tint.presets.warning
pub fn warning(fg: Color) StyleBold text with given foreground color.
tint.presets.success
pub fn success(fg: Color) StyleBold text with given foreground color.
tint.presets.info
pub fn info(fg: Color) StyleNormal text with given foreground color.
tint.presets.debug
pub fn debug(fg: Color) StyleDim text with given foreground color.
tint.presets.link
pub fn link(fg: Color) StyleUnderlined text with given foreground color.
tint.presets.code
pub fn code(fg: Color, bg: Color) StyleText with given foreground and background colors.
tint.presets.header
pub fn header(fg: Color) StyleBold underlined text with given foreground color.
tint.presets.muted
pub fn muted(fg: Color) StyleDim text with given foreground color.
tint.presets.highlight
pub fn highlight(fg: Color, bg: Color) StyleBold text with given foreground and background colors.
tint.presets.strikethrough_text
pub fn strikethrough_text(fg: Color) StyleStrikethrough text with given foreground color.
tint.presets.blink_text
pub fn blink_text(fg: Color) StyleBlinking text with given foreground color.
tint.presets.reverse_text
pub fn reverse_text(fg: Color) StyleReverse video text with given foreground color.
tint.presets.hidden_text
pub fn hidden_text(fg: Color) StyleHidden text with given foreground color.
tint.presets.overlined
pub fn overlined(fg: Color) StyleOverlined text with given foreground color.
tint.presets.framed
pub fn framed(fg: Color) StyleFramed text with given foreground color.
tint.presets.encircled
pub fn encircled(fg: Color) StyleEncircled text with given foreground color.
