mirror of
https://github.com/zed-industries/zed.git
synced 2025-01-05 23:51:08 +00:00
Load Theme
from theme2
into the storybook
This commit is contained in:
parent
a01b507ef4
commit
dd34bb273e
3 changed files with 13 additions and 3 deletions
1
Cargo.lock
generated
1
Cargo.lock
generated
|
@ -9364,6 +9364,7 @@ dependencies = [
|
|||
"smallvec",
|
||||
"strum",
|
||||
"theme",
|
||||
"theme2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
|
@ -10,13 +10,15 @@ use std::sync::Arc;
|
|||
|
||||
use clap::Parser;
|
||||
use gpui2::{
|
||||
div, px, size, view, AnyView, AppContext, Bounds, Context, Element, ViewContext,
|
||||
WindowBounds, WindowOptions,
|
||||
div, px, size, view, AnyView, AppContext, Bounds, Context, Element, ViewContext, WindowBounds,
|
||||
WindowOptions,
|
||||
};
|
||||
use log::LevelFilter;
|
||||
use simplelog::SimpleLogger;
|
||||
use story_selector::ComponentStory;
|
||||
use theme2::ThemeRegistry;
|
||||
use ui::{prelude::*, themed};
|
||||
use util::ResultExt;
|
||||
|
||||
use crate::assets::Assets;
|
||||
use crate::story_selector::StorySelector;
|
||||
|
@ -48,7 +50,7 @@ fn main() {
|
|||
|
||||
let story_selector = args.story.clone();
|
||||
let theme_name = args.theme.unwrap_or("One Dark".to_string());
|
||||
let theme = themes::load_theme(theme_name).unwrap();
|
||||
let theme = themes::load_theme(theme_name.clone()).unwrap();
|
||||
|
||||
let asset_source = Arc::new(Assets);
|
||||
gpui2::App::production(asset_source).run(move |cx| {
|
||||
|
@ -57,6 +59,12 @@ fn main() {
|
|||
let selector =
|
||||
story_selector.unwrap_or(StorySelector::Component(ComponentStory::Workspace));
|
||||
|
||||
let theme_registry = cx.default_global::<ThemeRegistry>();
|
||||
|
||||
if let Some(new_theme) = theme_registry.get(&theme_name).log_err() {
|
||||
cx.set_global(new_theme);
|
||||
}
|
||||
|
||||
cx.set_global(theme.clone());
|
||||
ui::settings::init(cx);
|
||||
|
||||
|
|
|
@ -14,6 +14,7 @@ settings = { path = "../settings" }
|
|||
smallvec.workspace = true
|
||||
strum = { version = "0.25.0", features = ["derive"] }
|
||||
theme = { path = "../theme" }
|
||||
theme2 = { path = "../theme2" }
|
||||
rand = "0.8"
|
||||
|
||||
[features]
|
||||
|
|
Loading…
Reference in a new issue