theme

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 4, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package theme is the single source of truth for conduit's color palette.

Built-in themes are direct ports of Claude Code's THEME_NAMES with the same RGB values, so settings.json values written by either tool render identically.

Users can also define custom themes via settings.json's "themes" field (a map of name to Palette), or tweak individual fields via "themeOverrides".

Index

Constants

View Source
const (
	AnsiBold      = "\033[1m"
	AnsiDim       = "\033[2m"
	AnsiReset     = "\033[0m"
	AnsiResetSoft = "\033[22;23;39m"
)

Variables

View Source
var Dark = Palette{
	Name:            "dark",
	Primary:         "#FFFFFF",
	Secondary:       "#999999",
	Tertiary:        "#505050",
	Accent:          "#D77757",
	Success:         "#4EBA65",
	Danger:          "#FF6B80",
	Warning:         "#FFC107",
	Info:            "#B1B9F9",
	Background:      "",
	ModalBg:         "#373737",
	CodeBg:          "#413C41",
	Border:          "#888888",
	BorderActive:    "#D77757",
	ModeAcceptEdits: "#AF87FF",
	ModePlan:        "#48968C",
	ModeAuto:        "#FFC107",
}

Dark — direct port of darkTheme from CC.

View Source
var DarkAnsi = Palette{
	Name:            "dark-ansi",
	Primary:         "15",
	Secondary:       "7",
	Tertiary:        "7",
	Accent:          "9",
	Success:         "10",
	Danger:          "9",
	Warning:         "11",
	Info:            "12",
	Background:      "",
	ModalBg:         "8",
	CodeBg:          "0",
	Border:          "7",
	BorderActive:    "9",
	ModeAcceptEdits: "13",
	ModePlan:        "14",
	ModeAuto:        "11",
}

DarkAnsi — direct port of darkAnsiTheme. Uses 16-color ANSI codes.

View Source
var DarkDaltonized = Palette{
	Name:            "dark-daltonized",
	Primary:         "#FFFFFF",
	Secondary:       "#999999",
	Tertiary:        "#505050",
	Accent:          "#FF9933",
	Success:         "#3399FF",
	Danger:          "#FF6666",
	Warning:         "#FFCC00",
	Info:            "#99CCFF",
	Background:      "",
	ModalBg:         "#373737",
	CodeBg:          "#413C41",
	Border:          "#888888",
	BorderActive:    "#FF9933",
	ModeAcceptEdits: "#AF87FF",
	ModePlan:        "#669999",
	ModeAuto:        "#FFCC00",
}

DarkDaltonized — direct port of darkDaltonizedTheme from CC.

View Source
var Light = Palette{
	Name:            "light",
	Primary:         "#555555",
	Secondary:       "#8C8C8C",
	Tertiary:        "#AFAFAF",
	Accent:          "#D77757",
	Success:         "#2C7A39",
	Danger:          "#AB2B3F",
	Warning:         "#966C1E",
	Info:            "#5769F7",
	Background:      "",
	ModalBg:         "#F0F0F0",
	CodeBg:          "#FAF5FA",
	Border:          "#999999",
	BorderActive:    "#D77757",
	ModeAcceptEdits: "#8700FF",
	ModePlan:        "#006666",
	ModeAuto:        "#966C1E",
}

Light — direct port of lightTheme from CC.

View Source
var LightAnsi = Palette{
	Name:            "light-ansi",
	Primary:         "7",
	Secondary:       "8",
	Tertiary:        "8",
	Accent:          "9",
	Success:         "2",
	Danger:          "1",
	Warning:         "3",
	Info:            "4",
	Background:      "",
	ModalBg:         "7",
	CodeBg:          "15",
	Border:          "7",
	BorderActive:    "9",
	ModeAcceptEdits: "5",
	ModePlan:        "6",
	ModeAuto:        "3",
}

LightAnsi — based on lightAnsiTheme. CC's text="ansi:black" assumes a light terminal; we use 7 (white/light gray) instead so Primary remains visible on dark terminals too. Mirrors dark-ansi's Primary=15 one notch dimmer to keep the "light theme" feel.

View Source
var LightDaltonized = Palette{
	Name:            "light-daltonized",
	Primary:         "#555555",
	Secondary:       "#8C8C8C",
	Tertiary:        "#AFAFAF",
	Accent:          "#FF9933",
	Success:         "#006699",
	Danger:          "#CC0000",
	Warning:         "#FF9900",
	Info:            "#3366FF",
	Background:      "",
	ModalBg:         "#DCDCDC",
	CodeBg:          "#FAF5FA",
	Border:          "#999999",
	BorderActive:    "#FF9933",
	ModeAcceptEdits: "#8700FF",
	ModePlan:        "#336666",
	ModeAuto:        "#FF9900",
}

LightDaltonized — direct port of lightDaltonizedTheme from CC.

Functions

func AnsiBG

func AnsiBG(value string) string

AnsiBG returns an ANSI escape that sets the background.

func AnsiFG

func AnsiFG(value string) string

AnsiFG returns an ANSI escape that sets the foreground. Hex must be #RRGGBB or a string-encoded 0..255 ANSI code.

func AvailableThemes

func AvailableThemes() []string

AvailableThemes returns the list of names selectable in the /theme picker.

All Claude Code built-in palettes are listed (including light variants) so a user who shares settings.json between conduit and Claude Code can pick light themes here without conduit silently rewriting their config to a different palette. Light text on dark terminals is the user's call.

Order: user-defined themes first, then built-in dark, then built-in light.

func OnChange

func OnChange(cb func())

OnChange registers a callback fired after each successful Set.

func Set

func Set(name string) bool

Set switches the active palette by name. Returns true if recognised.

Resolution order:

  1. settings.json custom themes (userThemes)
  2. Built-in CC-named themes
  3. Aliases (dark-accessible → dark-daltonized, etc.)
  4. "auto" → Dark (TODO: detect system preference)

Unknown names return false and leave the current palette unchanged.

func SetOverrides

func SetOverrides(o map[string]string)

SetOverrides applies per-field colour tweaks on top of the active palette. Pass nil to clear.

func SetUserThemes

func SetUserThemes(themes map[string]Palette)

SetUserThemes registers custom palettes loaded from settings.json. Pass nil to clear. Triggers OnChange listeners so the active palette can be re-resolved if it now matches a user override.

Types

type Palette

type Palette struct {
	Name string

	Primary   string
	Secondary string
	Tertiary  string

	Accent string

	Success string
	Danger  string
	Warning string
	Info    string

	Background   string
	ModalBg      string
	CodeBg       string
	Border       string
	BorderActive string

	ModeAcceptEdits string
	ModePlan        string
	ModeAuto        string
}

Palette is the semantic color set. Maps to a subset of Claude Code's Theme struct fields:

Primary   ← text
Secondary ← inactive
Tertiary  ← subtle
Accent    ← claude
Success   ← success
Danger    ← error
Warning   ← warning
Info      ← suggestion / permission
Background  ← (intentionally empty for terminal-bg passthrough)
ModalBg     ← userMessageBackground
CodeBg      ← bashMessageBackgroundColor
Border      ← promptBorder
BorderActive ← claude
ModeAcceptEdits ← autoAccept
ModePlan        ← planMode
ModeAuto        ← warning

func Active

func Active() Palette

Active returns the currently active palette.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL