Theme/Skin System Documentation

Overview

The flux9s theme system allows you to customize the appearance of the TUI by loading color schemes from YAML files. Themes follow the k9s skin format for familiarity and compatibility.

How It Works

Theme Resolution Order

When loading a theme, flux9s checks in this order:

  1. User Skins Directory: $XDG_CONFIG_HOME/flux9s/skins/{name}.yaml (default: ~/.config/flux9s/skins/)
  2. Legacy Data Directory: $XDG_DATA_HOME/flux9s/skins/{name}.yaml (default: ~/.local/share/flux9s/skins/)
  3. Embedded Themes: Built-in themes embedded in the binary (17 popular themes)
  4. Built-in Default: Falls back to hardcoded default theme

Setting a Theme

Via Configuration File

Edit ~/.config/flux9s/config.yaml:

ui:
  skin: dracula

Or use the CLI:

flux9s config set ui.skin dracula

Via Environment Variable

export FLUX9S_SKIN=dracula
flux9s

Via TUI Command

While in the TUI, you can change themes in two ways:

Direct command:

:skin dracula

This changes the theme immediately (temporary, doesn’t persist to config file).

Interactive submenu:

:skin

This opens an interactive theme selection menu with live preview. Navigate with j/k, press Enter to apply, s to save to config, or Esc to cancel.

Theme Submenu

The submenu shows:

Theme File Format

Themes use k9s-style YAML format:

k9s:
  body:
    fg: "#ffffff" # Foreground color
    bg: "#000000" # Background color
    logo: "#00ff00" # Logo/ASCII art color

  frame:
    border:
      fg: "#00ffff" # Border color
    menu:
      fg: "#ffffff"
      bg: "#000000"
      key: "#00ff00" # Keybinding color
    crumbs:
      fg: "#ffff00"
      active: "#ffffff"
    status:
      new: "#00ff00" # Success/ready color
      error: "#ff0000" # Error color
    title:
      fg: "#ffffff"
      bg: "#000000"

  views:
    table:
      fg: "#ffffff"
      bg: "#000000"
      cursor:
        fg: "#000000"
        bg: "#ffffff"
      header:
        fg: "#ffffff"
        bg: "#000000"
    yaml:
      key: "#00ffff"
      value: "#ffffff"
    logs:
      fg: "#ffffff"
      bg: "#000000"

Color Format Support

Color Mapping

The k9s skin format is mapped to flux9s Theme fields:

Built-in Themes

flux9s includes 17 popular themes embedded in the binary, so they’re available immediately without installation:

Dark Themes:

Light Themes:

Default Theme

The default theme is built-in and uses:

Creating Custom Themes

  1. Create a YAML file in ~/.config/flux9s/skins/ (or ~/.local/share/flux9s/skins/ for legacy)
  2. Name it {theme-name}.yaml
  3. Use the k9s format shown above
  4. Set it with flux9s config set ui.skin {theme-name} or use the :skin submenu in TUI

Implementation Details

Code Structure

Key Functions

Theme Submenu Features

The :skin command without arguments opens an interactive submenu with:

The submenu saves themes to ui.skin in normal mode, or ui.skinReadOnly when readonly mode is enabled.

Current Status

Implemented:

🚧 Future Enhancements:

Troubleshooting

Theme not loading?

Colors not applying correctly?