feat: adopt the native OS theme (#66)
Reviewed-on: #66
This commit was merged in pull request #66.
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
use anyhow::Context;
|
||||
use gpui::{AssetSource, Result, SharedString};
|
||||
use rust_embed::RustEmbed;
|
||||
|
||||
/// The Lucide icons the app and the kit components draw, vendored so they ship
|
||||
/// with the binary and resolve like any other coop asset.
|
||||
#[derive(RustEmbed)]
|
||||
#[folder = "../../assets"]
|
||||
#[include = "fonts/**/*"]
|
||||
@@ -10,11 +11,28 @@ use rust_embed::RustEmbed;
|
||||
#[exclude = "*.DS_Store"]
|
||||
pub struct Assets;
|
||||
|
||||
/// Coop's bundled assets, with the GPUI Kit component icon bundle as the
|
||||
/// fallback for any icon not vendored here.
|
||||
pub struct CombinedAssets;
|
||||
|
||||
impl AssetSource for CombinedAssets {
|
||||
fn load(&self, path: &str) -> Result<Option<std::borrow::Cow<'static, [u8]>>> {
|
||||
if let Ok(Some(data)) = Assets.load(path) {
|
||||
return Ok(Some(data));
|
||||
}
|
||||
gpui_kit::assets::Assets.load(path)
|
||||
}
|
||||
|
||||
fn list(&self, path: &str) -> Result<Vec<SharedString>> {
|
||||
let mut paths = Assets.list(path).unwrap_or_default();
|
||||
paths.extend(gpui_kit::assets::Assets.list(path)?);
|
||||
Ok(paths)
|
||||
}
|
||||
}
|
||||
|
||||
impl AssetSource for Assets {
|
||||
fn load(&self, path: &str) -> Result<Option<std::borrow::Cow<'static, [u8]>>> {
|
||||
Self::get(path)
|
||||
.map(|f| Some(f.data))
|
||||
.with_context(|| format!("loading asset at path {path:?}"))
|
||||
Ok(Self::get(path).map(|f| f.data))
|
||||
}
|
||||
|
||||
fn list(&self, path: &str) -> Result<Vec<SharedString>> {
|
||||
|
||||
Reference in New Issue
Block a user