#pragma once
// lexer_theme.h -- Color themes for syntax highlighting
//
// Each theme maps Token_Type values to 24-bit RGB colors, plus a background.
// Themes use true-color ANSI escapes (supported by Windows Terminal, most
// modern terminals).

#include "base/base_core.h"
#include "lexer/lexer.h"

////////////////////////////////
// RGB color

typedef struct RGB { U8 r, g, b; } RGB;

// Use for static initializers (no compound literal — MSVC C11 compat)
#define RGB_HEX(hex) { ((hex) >> 16) & 0xFF, ((hex) >> 8) & 0xFF, (hex) & 0xFF }

////////////////////////////////
// Theme

typedef struct Theme {
    const char *name;
    B32  use_truecolor;       // if false, use ansi_colors[] with term_fg() instead
    RGB  colors[TOK_COUNT];   // foreground color per token type (true color)
    U8   ansi_colors[TOK_COUNT]; // foreground per token type (256-color fallback)
    RGB  background;          // terminal background color
    B32  set_background;      // whether to override terminal background

    // UI chrome colors
    RGB  status_bg;           // status bar background
    RGB  status_fg;           // status bar foreground (focused)
    RGB  status_fg_dim;       // status bar foreground (unfocused)
    RGB  mb_bg;               // minibuffer item background (highlighted)
    RGB  mb_fg;               // minibuffer item foreground (highlighted)
    RGB  mb_detail;           // minibuffer detail text color
    RGB  fb_bg;               // file browser background (0,0,0 = use WindowBg)
    B32  set_fb_bg;           // whether to override file browser background
} Theme;

////////////////////////////////
// Built-in themes

#define THEME_COUNT 13

extern Theme g_themes[THEME_COUNT];
extern S32   g_active_theme_idx;

// Convenience: pointer to the active theme
static inline Theme *theme_active(void) { return &g_themes[g_active_theme_idx]; }
