feat: compute scope intersection for theme pair

This commit is contained in:
Jan-Bulthuis 2026-07-19 19:41:40 +02:00
parent 2bb0a5c099
commit b4a8084350

View File

@ -1,5 +1,5 @@
use std::{
collections::{HashMap, HashSet},
collections::{BTreeSet, HashMap, HashSet},
error::Error,
fs,
path::Path,
@ -218,6 +218,21 @@ pub fn init(config: &AppConfig) {
}
}
/// The intersection of scopes between two themes.
pub fn shared_scopes(light: &str, dark: &str) -> Option<BTreeSet<String>> {
let registry = REGISTRY.get()?;
let light = registry.themes.get(light)?;
let dark = registry.themes.get(dark)?;
Some(
light
.styles
.keys()
.filter(|k| dark.styles.contains_key(*k))
.cloned()
.collect(),
)
}
pub fn theme_css_func() -> Func {
theme_css::func()
}