theme: build out the theme engine core with resolve pipeline
This commit is contained in:
@@ -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;
|
||||
Reference in New Issue
Block a user