use std::sync::OnceLock;
use crate::tui::render::theme::Theme;
use crate::tui::render::user_themes::build_theme;
const PACK_SOURCES: &[(&str, &str)] = &[
("aura", include_str!("pack/aura.toml")),
("ayu", include_str!("pack/ayu.toml")),
("carbonfox", include_str!("pack/carbonfox.toml")),
(
"catppuccin-macchiato",
include_str!("pack/catppuccin-macchiato.toml"),
),
("cobalt2", include_str!("pack/cobalt2.toml")),
("cursor", include_str!("pack/cursor.toml")),
("everforest", include_str!("pack/everforest.toml")),
("flexoki", include_str!("pack/flexoki.toml")),
("github", include_str!("pack/github.toml")),
("gruvbox", include_str!("pack/gruvbox.toml")),
("kanagawa", include_str!("pack/kanagawa.toml")),
("material", include_str!("pack/material.toml")),
("matrix", include_str!("pack/matrix.toml")),
("mercury", include_str!("pack/mercury.toml")),
("nightowl", include_str!("pack/nightowl.toml")),
("nord", include_str!("pack/nord.toml")),
("one-dark", include_str!("pack/one-dark.toml")),
("opencode", include_str!("pack/opencode.toml")),
("orng", include_str!("pack/orng.toml")),
("osaka-jade", include_str!("pack/osaka-jade.toml")),
("palenight", include_str!("pack/palenight.toml")),
("rosepine", include_str!("pack/rosepine.toml")),
("synthwave84", include_str!("pack/synthwave84.toml")),
("tokyonight", include_str!("pack/tokyonight.toml")),
("vercel", include_str!("pack/vercel.toml")),
("vesper", include_str!("pack/vesper.toml")),
("zenburn", include_str!("pack/zenburn.toml")),
(
"catppuccin-frappe",
include_str!("pack/catppuccin-frappe.toml"),
),
("gruvbox-light", include_str!("pack/gruvbox-light.toml")),
("rosepine-dawn", include_str!("pack/rosepine-dawn.toml")),
(
"tokyonight-storm",
include_str!("pack/tokyonight-storm.toml"),
),
];
static PACK_THEMES: OnceLock<Vec<Theme>> = OnceLock::new();
pub fn themes() -> &'static [Theme] {
PACK_THEMES.get_or_init(|| {
PACK_SOURCES
.iter()
.filter_map(|(name, toml)| match build_theme(name, toml) {
Ok(theme) => Some(theme),
Err(e) => {
tracing::warn!(
theme = name,
error = %e,
"embedded pack theme failed validation; skipping"
);
None
}
})
.collect()
})
}
pub fn themes_if_built() -> Option<&'static [Theme]> {
PACK_THEMES.get().map(Vec::as_slice)
}
pub fn sources() -> &'static [(&'static str, &'static str)] {
PACK_SOURCES
}