Skip to content

Styling & Themes

Tachikoma provides a comprehensive styling system with ANSI 256 colors, true RGB colors, text attributes, and a theme engine with 11 built-in palettes.

Style

Style controls how text and backgrounds appear:

julia
Style(; fg=NoColor(), bg=NoColor(), bold=false, dim=false,
        italic=false, underline=false)
julia
# Explicit style
s = Style(fg=Color256(196), bg=Color256(0), bold=false, italic=true)

# Theme-aware style (preferred)
s = tstyle(:primary, bold=true)
style_demo example

Color Types

Color256

ANSI 256-color palette (0–255):

julia
Color256(196)     # bright red
Color256(46)      # green
Color256(0)       # black
Color256(255)     # white
color256_swatches example

ColorRGB

True 24-bit RGB color:

julia
ColorRGB(255, 100, 50)   # orange
ColorRGB(0x1a, 0x1b, 0x2e)  # dark blue
colorrgb_swatches example

NoColor

Transparent / terminal default:

julia
NoColor()   # inherits terminal default

Theme-Aware Styles with tstyle

The tstyle function creates styles from the current theme's color fields:

julia
tstyle(:primary)                  # theme's primary color as fg
tstyle(:primary, bold=true)       # primary fg, bold
tstyle(:accent, dim=true)         # accent fg, dimmed
tstyle(:error, underline=true)    # error fg, underlined
tstyle_demo example

Available theme fields:

FieldUsage
:borderNormal border color
:border_focusFocused border color
:textStandard text
:text_dimSubdued text
:text_brightEmphasized text
:primaryPrimary accent
:secondarySecondary accent
:accentHighlight / interactive elements
:successSuccess indicators
:warningWarning indicators
:errorError indicators
:titleTitle text

Always prefer tstyle over hardcoded colors — your app automatically adapts when the user switches themes.

Themes

Tachikoma ships with 11 built-in themes:

ThemeConstantDescription
KokakuKOKAKUDeep teal cyberpunk (default)
EsperESPERCool blue noir
MotokoMOTOKOWarm purple cyborg
KanedaKANEDAHot red/orange Neo-Tokyo
NeuromancerNEUROMANCERGreen-on-dark hacker
CatppuccinCATPPUCCINWarm pastel
SolarizedSOLARIZEDEthan Schoonover's palette
DraculaDRACULADark purple classic
OutrunOUTRUNNeon synthwave
ZenburnZENBURNLow-contrast warm
IcebergICEBERGCool blue minimal

Theme API

julia
theme()                    # get current Theme
set_theme!(KANEDA)         # set by Theme value
set_theme!(:kaneda)        # set by Symbol name
ALL_THEMES                 # tuple of all 11 themes

Theme changes take effect immediately — the next view call uses the new colors.

Theme Struct

Each Theme contains:

julia
struct Theme
    name::String
    border::Color256
    border_focus::Color256
    text::Color256
    text_dim::Color256
    text_bright::Color256
    primary::Color256
    secondary::Color256
    accent::Color256
    success::Color256
    warning::Color256
    error::Color256
    title::Color256
end
theme_demo example

Color Utilities

Interpolation and Manipulation

julia
color_lerp(a::ColorRGB, b::ColorRGB, t)    # interpolate, t ∈ [0,1]
to_rgb(c::Color256)  ColorRGB              # convert palette → RGB
brighten(c::ColorRGB, amount)  ColorRGB    # brighten by 0–1
dim_color(c::ColorRGB, amount)  ColorRGB   # dim by 0–1
hue_shift(c::ColorRGB, degrees)  ColorRGB  # rotate hue
desaturate(c::ColorRGB, amount)  ColorRGB  # reduce saturation

Animated Color

julia
# Smooth color cycling (see Animation section)
color_wave(tick, x, colors; speed=0.04, spread=0.08)  ColorRGB
colorwave_demo example

Render Backends

Tachikoma supports three rendering backends that affect how canvases and visual effects are drawn:

julia
@enum RenderBackend braille_backend block_backend sixel_backend

render_backend()                    # get current
set_render_backend!(braille_backend)  # set + save
cycle_render_backend!(1)            # cycle forward
cycle_render_backend!(-1)           # cycle backward
BackendResolutionDescription
braille_backend2×4 per cellUnicode braille dots, works everywhere
block_backend2×2 per cellQuadrant block characters, gap-free
sixel_backend~16×32 per cellPixel-perfect raster, Kitty or sixel

Decay Parameters

The decay system adds a "bit-rot" aesthetic — noise, jitter, and corruption effects:

julia
mutable struct DecayParams
    decay::Float64        # 0–1 master intensity
    jitter::Float64       # 0–1 RGB noise
    rot_prob::Float64     # 0–1 corruption probability
    noise_scale::Float64  # spatial noise scale
end

decay_params()  DecayParams   # get current (mutable)

Adjust via the settings overlay (Ctrl+S) or programmatically. Values are saved via Preferences.jl.

Box Styles

Four border box styles for Block:

julia
BOX_ROUNDED    # ╭─╮╰─╯  (default)
BOX_HEAVY      # ┏━┓┗━┛
BOX_DOUBLE     # ╔═╗╚═╝
BOX_PLAIN      # ┌─┐└─┘
julia
Block(title="Panel", box=BOX_HEAVY)

Visual Constants

julia
DOT = '·'                              # separator dot
BARS_V = ('▁','▂','▃','▄','▅','▆','▇','█')  # vertical bar chars
BARS_H = ('▏','▎','▍','▌','▋','▊','▉','█')  # horizontal bar chars
BLOCKS = ('█','▓','▒','░')             # density blocks
SCANLINE = '╌'                         # interlace separator
MARKER = '▸'                           # list selection marker
SPINNER_BRAILLE = ['⠋','⠙','⠹','⠸','⠼','⠴','⠦','⠧','⠇','⠏']
SPINNER_DOTS = ['⣾','⣽','⣻','⢿','⡿','⣟','⣯','⣷']