#!/usr/bin/env bash
# ══════════════════════════════════════════════════════════════════════════════
#   violet-chaton v2 — palette source de verite
#
#   Inspiration : Mitsuri Kanroji — gradient rose → vert pastel
#   Identite    : univers violet profond, accents chauds/frais, zero emprunt
#
#   Usage :
#     source palette.sh
#     echo "$VC_MAGENTA"           → #ff4da6
#     echo "${VC_RGB_MAGENTA}"     → 255;77;166
#     echo "${VC_ANSI_MAGENTA}"    → \033[38;2;255;77;166m
# ══════════════════════════════════════════════════════════════════════════════

# ── Fond (signature violet-chaton) ───────────────────────────────────────────
VC_CRUST="#1a0e27"          # le plus profond — borders, shadows
VC_BASE="#261537"           # fond principal
VC_MANTLE="#341c4a"         # fond secondaire
VC_SURFACE0="#3d2454"       # elements poses
VC_SURFACE1="#493161"       # elements hover
VC_SURFACE2="#5a3875"       # selection, highlight

# ── Texte (teinte violet — pas du blanc pur) ─────────────────────────────────
VC_TEXT="#f0eaf8"           # texte principal
VC_SUBTEXT1="#c4b8d4"       # texte secondaire
VC_SUBTEXT0="#9a8fad"       # labels, placeholders
VC_MUTED="#716686"          # desactive, commentaires

# ── Accents ──────────────────────────────────────────────────────────────────
VC_MAGENTA="#ff4da6"        # accent primaire — chaud, vif
VC_LILAC="#c9a0ff"          # accent secondaire — doux, aerien
VC_MITSURI="#9adba8"        # vert pastel — frais, unique
VC_LAVANDE="#a4b4ff"        # bleu-violet — info, fonctions
VC_CHAMPAGNE="#e8c87a"      # or chaud — casse le bicolore

# ── Semantiques (derivees des accents) ───────────────────────────────────────
VC_DANGER="#f25c7a"         # rouge vif, teinte violet
VC_WARNING="#e8c87a"        # = champagne
VC_SUCCESS="#9adba8"        # = mitsuri green
VC_INFO="#a4b4ff"           # = lavande

# ── Gradient signature (cava, barres, transitions) ───────────────────────────
# magenta → lilac → lavande → mitsuri
VC_GRADIENT_1="$VC_MAGENTA"
VC_GRADIENT_2="#e276d4"     # magenta → lilac mid
VC_GRADIENT_3="$VC_LILAC"
VC_GRADIENT_4="#b6a8ff"     # lilac → lavande mid
VC_GRADIENT_5="$VC_LAVANDE"
VC_GRADIENT_6="#9fc8d4"     # lavande → mitsuri mid
VC_GRADIENT_7="#9adba8"     # = mitsuri
VC_GRADIENT_8="#82e8a0"     # mitsuri bright tip

# ══════════════════════════════════════════════════════════════════════════════
#   LIGHT — meme univers violet, fonds lavande clairs
#   Les accents sont legerement assombris pour le contraste sur fond clair
# ══════════════════════════════════════════════════════════════════════════════

# ── Fond light (lavande — identite violet conservee) ────────────────────────
VCL_CRUST="#f8f4fc"          # le plus clair — presque blanc violet
VCL_BASE="#f3edf8"           # fond principal
VCL_MANTLE="#ebe4f2"         # fond secondaire
VCL_SURFACE0="#ddd4e8"       # elements poses
VCL_SURFACE1="#d0c6de"       # elements hover
VCL_SURFACE2="#c4b8d4"       # selection, highlight

# ── Texte light (violet fonce — inversion du dark) ──────────────────────────
VCL_TEXT="#261537"            # texte principal (= base dark)
VCL_SUBTEXT1="#3d2454"       # texte secondaire
VCL_SUBTEXT0="#5a3875"       # labels
VCL_MUTED="#8a7ba0"          # desactive, commentaires

# ── Accents light (assombris pour contraste WCAG AA sur fond clair) ─────────
VCL_MAGENTA="#d4348a"        # accent primaire
VCL_LILAC="#8a5cb8"          # accent secondaire
VCL_MITSURI="#3d9e68"        # vert mitsuri assombri
VCL_LAVANDE="#5a6ad0"        # bleu-violet assombri
VCL_CHAMPAGNE="#b89840"      # or chaud assombri

# ── Semantiques light ──────────────────────────────────────────────────────
VCL_DANGER="#c93a5a"
VCL_WARNING="#b89840"
VCL_SUCCESS="#3d9e68"
VCL_INFO="#5a6ad0"

# ── Font ─────────────────────────────────────────────────────────────────────
VC_FONT="Maple Mono NF"
VC_FONT_FALLBACK="MapleMono Nerd Font"
VC_FONT_SIZE=13

# ── RGB (pour les contextes qui n'acceptent pas le hex) ──────────────────────
_hex2rgb() { printf '%d;%d;%d' "0x${1:1:2}" "0x${1:3:2}" "0x${1:5:2}"; }

VC_RGB_CRUST=$(_hex2rgb "$VC_CRUST")
VC_RGB_BASE=$(_hex2rgb "$VC_BASE")
VC_RGB_MANTLE=$(_hex2rgb "$VC_MANTLE")
VC_RGB_SURFACE0=$(_hex2rgb "$VC_SURFACE0")
VC_RGB_SURFACE1=$(_hex2rgb "$VC_SURFACE1")
VC_RGB_SURFACE2=$(_hex2rgb "$VC_SURFACE2")
VC_RGB_TEXT=$(_hex2rgb "$VC_TEXT")
VC_RGB_SUBTEXT1=$(_hex2rgb "$VC_SUBTEXT1")
VC_RGB_SUBTEXT0=$(_hex2rgb "$VC_SUBTEXT0")
VC_RGB_MUTED=$(_hex2rgb "$VC_MUTED")
VC_RGB_MAGENTA=$(_hex2rgb "$VC_MAGENTA")
VC_RGB_LILAC=$(_hex2rgb "$VC_LILAC")
VC_RGB_MITSURI=$(_hex2rgb "$VC_MITSURI")
VC_RGB_LAVANDE=$(_hex2rgb "$VC_LAVANDE")
VC_RGB_CHAMPAGNE=$(_hex2rgb "$VC_CHAMPAGNE")
VC_RGB_DANGER=$(_hex2rgb "$VC_DANGER")
VC_RGB_WARNING=$(_hex2rgb "$VC_WARNING")
VC_RGB_SUCCESS=$(_hex2rgb "$VC_SUCCESS")
VC_RGB_INFO=$(_hex2rgb "$VC_INFO")

# ── ANSI (pour echo -e dans les scripts) ─────────────────────────────────────
_hex2ansi() { echo "\033[38;2;$(_hex2rgb "$1")m"; }

VC_ANSI_CRUST=$(_hex2ansi "$VC_CRUST")
VC_ANSI_BASE=$(_hex2ansi "$VC_BASE")
VC_ANSI_MANTLE=$(_hex2ansi "$VC_MANTLE")
VC_ANSI_SURFACE0=$(_hex2ansi "$VC_SURFACE0")
VC_ANSI_SURFACE1=$(_hex2ansi "$VC_SURFACE1")
VC_ANSI_SURFACE2=$(_hex2ansi "$VC_SURFACE2")
VC_ANSI_TEXT=$(_hex2ansi "$VC_TEXT")
VC_ANSI_SUBTEXT1=$(_hex2ansi "$VC_SUBTEXT1")
VC_ANSI_SUBTEXT0=$(_hex2ansi "$VC_SUBTEXT0")
VC_ANSI_MUTED=$(_hex2ansi "$VC_MUTED")
VC_ANSI_MAGENTA=$(_hex2ansi "$VC_MAGENTA")
VC_ANSI_LILAC=$(_hex2ansi "$VC_LILAC")
VC_ANSI_MITSURI=$(_hex2ansi "$VC_MITSURI")
VC_ANSI_LAVANDE=$(_hex2ansi "$VC_LAVANDE")
VC_ANSI_CHAMPAGNE=$(_hex2ansi "$VC_CHAMPAGNE")
VC_ANSI_DANGER=$(_hex2ansi "$VC_DANGER")
VC_ANSI_WARNING=$(_hex2ansi "$VC_WARNING")
VC_ANSI_SUCCESS=$(_hex2ansi "$VC_SUCCESS")
VC_ANSI_INFO=$(_hex2ansi "$VC_INFO")
VC_ANSI_RESET='\033[0m'
VC_ANSI_BOLD='\033[1m'
VC_ANSI_ITALIC='\033[3m'
