Get playground rendering with backward compatible theming

This commit is contained in:
Nathan Sobo
2023-08-30 11:09:34 -06:00
parent d763946b18
commit 1d491fcd78
7 changed files with 115 additions and 40 deletions
+10 -1
View File
@@ -10,11 +10,12 @@ use gpui::{
fonts::{HighlightStyle, TextStyle},
platform, AppContext, AssetSource, Border, MouseState,
};
use parking_lot::Mutex;
use schemars::JsonSchema;
use serde::{de::DeserializeOwned, Deserialize};
use serde_json::Value;
use settings::SettingsStore;
use std::{collections::HashMap, ops::Deref, sync::Arc};
use std::{any::Any, collections::HashMap, ops::Deref, sync::Arc};
use ui::{CheckboxStyle, CopilotCTAButton, IconStyle, ModalStyle};
pub use theme_registry::*;
@@ -67,6 +68,14 @@ pub struct Theme {
pub welcome: WelcomeStyle,
pub titlebar: Titlebar,
pub component_test: ComponentTest,
// Nathan: New elements are styled in Rust, directly from the base theme.
// We store it on the legacy theme so we can mix both kinds of elements during the transition.
#[schemars(skip)]
pub base_theme: serde_json::Value,
// A place to cache deserialized base theme.
#[serde(skip_deserializing)]
#[schemars(skip)]
pub deserialized_base_theme: Mutex<Option<Box<dyn Any + Send + Sync>>>,
}
#[derive(Deserialize, Default, Clone, JsonSchema)]