theme: build out the theme engine core with resolve pipeline

This commit is contained in:
2026-10-28 10:54:02 +07:00
parent b4d3359d4f
commit 12d4120bfd
14 changed files with 1434 additions and 37 deletions
+28
View File
@@ -0,0 +1,28 @@
//! Platform adapters behind one seam: `snapshot()` reads the running
//! system, `install_watchers()` forwards real change events.
use gpui::AsyncApp;
use crate::ThemeVariant;
use crate::system::SystemTheme;
pub(crate) trait ThemeSource: 'static {
fn snapshot(&self, variant: ThemeVariant) -> SystemTheme;
fn install_watchers(&mut self, _async_cx: AsyncApp) {}
fn label(&self) -> &'static str;
}
#[cfg(target_os = "macos")]
pub(crate) fn platform_source() -> Box<dyn ThemeSource> {
Box::new(macos::MacosSource::default())
}
#[cfg(not(target_os = "macos"))]
pub(crate) fn platform_source() -> Box<dyn ThemeSource> {
Box::new(fallback::FallbackSource)
}
#[cfg(target_os = "macos")]
pub(crate) mod macos;
pub(crate) mod fallback;