config

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2026 License: MIT Imports: 7 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package config handles user configuration files and custom theme definitions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CandidateConfigFilePaths

func CandidateConfigFilePaths() ([]string, error)

CandidateConfigFilePaths returns config file paths to try in order of preference.

func ConfigDir

func ConfigDir() (string, error)

ConfigDir returns the path to the diffmantic config directory, respecting $XDG_CONFIG_HOME or falling back to ~/.config/diffmantic.

func LoadExternalThemes

func LoadExternalThemes(dir string) (map[string]ThemeConfig, error)

LoadExternalThemes loads all .yml and .yaml theme definitions from the given directory.

func ThemesDir

func ThemesDir() (string, error)

ThemesDir returns the path to the directory where external theme files live.

Types

type ActionColorsConfig

type ActionColorsConfig struct {
	DeleteFg     string `yaml:"delete_fg"`
	InsertFg     string `yaml:"insert_fg"`
	UpdateFg     string `yaml:"update_fg"`
	MoveFg       string `yaml:"move_fg"`
	MoveUpdateFg string `yaml:"move_update_fg"`

	DeleteBg     string `yaml:"delete_bg"`
	InsertBg     string `yaml:"insert_bg"`
	UpdateBg     string `yaml:"update_bg"`
	MoveBg       string `yaml:"move_bg"`
	MoveUpdateBg string `yaml:"move_update_bg"`
}

ActionColorsConfig defines hex colors for AST diff actions.

type Config

type Config struct {
	Theme           string                 `yaml:"theme"`
	ThemeStyle      string                 `yaml:"theme_style"`
	Format          string                 `yaml:"format"`
	IgnoreComments  bool                   `yaml:"ignore_comments"`
	ParseErrorLimit int                    `yaml:"parse_error_limit"`
	TUI             TUIConfig              `yaml:"tui"`
	Themes          map[string]ThemeConfig `yaml:"themes"`
}

Config holds all user configuration settings for diffmantic.

func DefaultConfig

func DefaultConfig() Config

DefaultConfig returns the baseline configuration when no config file is found.

func Load

func Load() (*Config, error)

Load reads configuration from ~/.config/diffmantic/config.yml (or config.yaml) and any external themes from ~/.config/diffmantic/themes/*.{yml,yaml}. If no config file exists, it returns DefaultConfig.

type TUIConfig

type TUIConfig struct {
	TabWidth int    `yaml:"tab_width"`
	Mouse    bool   `yaml:"mouse"`
	Icons    string `yaml:"icons"` // "unicode" | "ascii" | "nerd-font"
}

TUIConfig controls TUI layout, mouse support, and glyph styles.

type ThemeConfig

type ThemeConfig struct {
	Name    string             `yaml:"name"`
	Dark    *bool              `yaml:"dark"`
	UI      UIColorsConfig     `yaml:"ui"`
	Actions ActionColorsConfig `yaml:"actions"`
}

ThemeConfig defines overrides for a color theme palette.

type UIColorsConfig

type UIColorsConfig struct {
	Base      string `yaml:"base"`
	Mantle    string `yaml:"mantle"`
	Crust     string `yaml:"crust"`
	Surface0  string `yaml:"surface0"`
	Surface1  string `yaml:"surface1"`
	Surface2  string `yaml:"surface2"`
	Overlay0  string `yaml:"overlay0"`
	Overlay1  string `yaml:"overlay1"`
	Overlay2  string `yaml:"overlay2"`
	Subtext0  string `yaml:"subtext0"`
	Subtext1  string `yaml:"subtext1"`
	Text      string `yaml:"text"`
	Lavender  string `yaml:"lavender"`
	Mauve     string `yaml:"mauve"`
	Blue      string `yaml:"blue"`
	Green     string `yaml:"green"`
	Peach     string `yaml:"peach"`
	Sky       string `yaml:"sky"`
	Yellow    string `yaml:"yellow"`
	Pink      string `yaml:"pink"`
	Red       string `yaml:"red"`
	Teal      string `yaml:"teal"`
	Rosewater string `yaml:"rosewater"`
	Sapphire  string `yaml:"sapphire"`
	Maroon    string `yaml:"maroon"`
	Flamingo  string `yaml:"flamingo"`
}

UIColorsConfig defines hex color overrides for TUI chrome.

Jump to

Keyboard shortcuts

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