eazygit 0.5.1

A fast TUI for Git with staging, conflicts, rebase, and palette-first UX
Documentation
use serde::Deserialize;

/// Theme configuration with color definitions.
#[derive(Debug, Clone, Deserialize)]
#[serde(default)]
pub struct ThemeConfig {
    pub name: String,
    // Base text
    pub fg: String,
    pub bg: String,
    pub muted: String,
    pub accent: String,
    // UI colors
    pub border: String,
    pub border_focused: String,
    pub selection_bg: String,
    pub selection_fg: String,
    // Diff colors
    pub diff_add: String,
    pub diff_remove: String,
    pub diff_context: String,
    pub diff_hunk: String,
    // Status colors
    pub staged: String,
    pub unstaged: String,
    pub untracked: String,
    // General
    pub header: String,
    pub footer: String,
    pub error: String,
    pub warning: String,
    pub success: String,
    #[serde(skip)]
    pub enable_transparency: bool,
}

impl Default for ThemeConfig {
    fn default() -> Self {
        Self {
            name: "dark".to_string(),
            fg: "white".to_string(),
            bg: "black".to_string(),
            muted: "darkgray".to_string(),
            accent: "cyan".to_string(),
            border: "gray".to_string(),
            border_focused: "cyan".to_string(),
            selection_bg: "white".to_string(),
            selection_fg: "black".to_string(),
            diff_add: "green".to_string(),
            diff_remove: "red".to_string(),
            diff_context: "gray".to_string(),
            diff_hunk: "cyan".to_string(),
            staged: "green".to_string(),
            unstaged: "yellow".to_string(),
            untracked: "gray".to_string(),
            header: "blue".to_string(),
            footer: "gray".to_string(),
            error: "red".to_string(),
            warning: "yellow".to_string(),
            success: "green".to_string(),
            enable_transparency: false,
        }
    }
}

/// Partial theme used for user overrides; every field is optional so we only overwrite
/// what the user explicitly set in `[colors]`.
#[derive(Debug, Clone, Deserialize, Default, serde::Serialize)]
pub struct PartialThemeConfig {
    pub fg: Option<String>,
    pub bg: Option<String>,
    pub muted: Option<String>,
    pub accent: Option<String>,
    pub border: Option<String>,
    pub border_focused: Option<String>,
    pub selection_bg: Option<String>,
    pub selection_fg: Option<String>,
    pub diff_add: Option<String>,
    pub diff_remove: Option<String>,
    pub diff_context: Option<String>,
    pub diff_hunk: Option<String>,
    pub staged: Option<String>,
    pub unstaged: Option<String>,
    pub untracked: Option<String>,
    pub header: Option<String>,
    pub footer: Option<String>,
    pub error: Option<String>,
    pub warning: Option<String>,
    pub success: Option<String>,
}

pub const ROLES: &[&str] = &[
    "fg",
    "bg",
    "muted",
    "accent",
    "border",
    "border_focused",
    "selection_bg",
    "selection_fg",
    "diff_add",
    "diff_remove",
    "diff_context",
    "diff_hunk",
    "staged",
    "unstaged",
    "untracked",
    "header",
    "footer",
    "error",
    "warning",
    "success",
];