feat: compute scope intersection for theme pair
This commit is contained in:
parent
2bb0a5c099
commit
b4a8084350
@ -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()
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user