Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

Remove old theme constructs

Marshall Bowersba789fc0c486
diff --git a/crates/storybook2/src/stories/focus.rs b/crates/storybook2/src/stories/focus.rs
index aeb0a243b25..b1db0187d68 100644
--- a/crates/storybook2/src/stories/focus.rs
+++ b/crates/storybook2/src/stories/focus.rs
@@ -1,9 +1,9 @@
-use crate::themes::rose_pine;
use gpui2::{
div, Focusable, KeyBinding, ParentElement, StatelessInteractive, Styled, View, VisualContext,
WindowContext,
};
use serde::Deserialize;
+use theme2::theme;
#[derive(Clone, Default, PartialEq, Deserialize)]
struct ActionA;
@@ -27,14 +27,14 @@ impl FocusStory {
]);
cx.register_action_type::<ActionA>();
cx.register_action_type::<ActionB>();
- let theme = rose_pine();
+ let theme = theme(cx);
- let color_1 = theme.lowest.negative.default.foreground;
- let color_2 = theme.lowest.positive.default.foreground;
- let color_3 = theme.lowest.warning.default.foreground;
- let color_4 = theme.lowest.accent.default.foreground;
- let color_5 = theme.lowest.variant.default.foreground;
- let color_6 = theme.highest.negative.default.foreground;
+ let color_1 = theme.git_created;
+ let color_2 = theme.git_modified;
+ let color_3 = theme.git_deleted;
+ let color_4 = theme.git_conflict;
+ let color_5 = theme.git_ignored;
+ let color_6 = theme.git_renamed;
let child_1 = cx.focus_handle();
let child_2 = cx.focus_handle();
diff --git a/crates/storybook2/src/stories/scroll.rs b/crates/storybook2/src/stories/scroll.rs
index 662d44328b1..1b8877ef5cf 100644
--- a/crates/storybook2/src/stories/scroll.rs
+++ b/crates/storybook2/src/stories/scroll.rs
@@ -1,7 +1,7 @@
-use crate::themes::rose_pine;
use gpui2::{
div, px, Component, ParentElement, SharedString, Styled, View, VisualContext, WindowContext,
};
+use theme2::theme;
pub struct ScrollStory {
text: View<()>,
@@ -9,25 +9,21 @@ pub struct ScrollStory {
impl ScrollStory {
pub fn view(cx: &mut WindowContext) -> View<()> {
- let theme = rose_pine();
-
- {
- cx.build_view(|cx| (), move |_, cx| checkerboard(1))
- }
+ cx.build_view(|cx| (), move |_, cx| checkerboard(cx, 1))
}
}
-fn checkerboard<S>(depth: usize) -> impl Component<S>
+fn checkerboard<S>(cx: &mut WindowContext, depth: usize) -> impl Component<S>
where
S: 'static + Send + Sync,
{
- let theme = rose_pine();
- let color_1 = theme.lowest.positive.default.background;
- let color_2 = theme.lowest.warning.default.background;
+ let theme = theme(cx);
+ let color_1 = theme.git_created;
+ let color_2 = theme.git_modified;
div()
.id("parent")
- .bg(theme.lowest.base.default.background)
+ .bg(theme.background)
.size_full()
.overflow_scroll()
.children((0..10).map(|row| {
diff --git a/crates/storybook2/src/storybook2.rs b/crates/storybook2/src/storybook2.rs
index 493997ccfe4..584a9abe394 100644
--- a/crates/storybook2/src/storybook2.rs
+++ b/crates/storybook2/src/storybook2.rs
@@ -4,7 +4,6 @@ mod assets;
mod stories;
mod story;
mod story_selector;
-mod themes;
use std::sync::Arc;
@@ -50,7 +49,6 @@ 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.clone()).unwrap();
let asset_source = Arc::new(Assets);
gpui2::App::production(asset_source).run(move |cx| {
diff --git a/crates/storybook2/src/themes.rs b/crates/storybook2/src/themes.rs
deleted file mode 100644
index ade7cbea87d..00000000000
--- a/crates/storybook2/src/themes.rs
+++ /dev/null
@@ -1,30 +0,0 @@
-mod rose_pine;
-
-pub use rose_pine::*;
-
-use anyhow::{Context, Result};
-use gpui2::serde_json;
-use serde::Deserialize;
-use ui::Theme;
-
-use crate::assets::Assets;
-
-#[derive(Deserialize)]
-struct LegacyTheme {
- pub base_theme: serde_json::Value,
-}
-
-/// Loads the [`Theme`] with the given name.
-pub fn load_theme(name: String) -> Result<Theme> {
- let theme_contents = Assets::get(&format!("themes/{name}.json"))
- .with_context(|| format!("theme file not found: '{name}'"))?;
-
- let legacy_theme: LegacyTheme =
- serde_json::from_str(std::str::from_utf8(&theme_contents.data)?)
- .context("failed to parse legacy theme")?;
-
- let theme: Theme = serde_json::from_value(legacy_theme.base_theme.clone())
- .context("failed to parse `base_theme`")?;
-
- Ok(theme)
-}
diff --git a/crates/storybook2/src/themes/rose_pine.rs b/crates/storybook2/src/themes/rose_pine.rs
deleted file mode 100644
index a553f87d777..00000000000
--- a/crates/storybook2/src/themes/rose_pine.rs
+++ /dev/null
@@ -1,1686 +0,0 @@
-use gpui2::serde_json::{self, json};
-use ui::Theme;
-
-pub fn rose_pine() -> Theme {
- serde_json::from_value(json! {
- {
- "name": "Rosé Pine",
- "is_light": false,
- "ramps": {},
- "lowest": {
- "base": {
- "default": {
- "background": "#292739",
- "border": "#423f55",
- "foreground": "#e0def4"
- },
- "hovered": {
- "background": "#423f55",
- "border": "#423f55",
- "foreground": "#e0def4"
- },
- "pressed": {
- "background": "#4e4b63",
- "border": "#423f55",
- "foreground": "#e0def4"
- },
- "active": {
- "background": "#47445b",
- "border": "#36334a",
- "foreground": "#e0def4"
- },
- "disabled": {
- "background": "#292739",
- "border": "#353347",
- "foreground": "#2f2b43"
- },
- "inverted": {
- "background": "#e0def4",
- "border": "#191724",
- "foreground": "#4b4860"
- }
- },
- "variant": {
- "default": {
- "background": "#292739",
- "border": "#423f55",
- "foreground": "#75718e"
- },
- "hovered": {
- "background": "#423f55",
- "border": "#423f55",
- "foreground": "#75718e"
- },
- "pressed": {
- "background": "#4e4b63",
- "border": "#423f55",
- "foreground": "#75718e"
- },
- "active": {
- "background": "#47445b",
- "border": "#36334a",
- "foreground": "#e0def4"
- },
- "disabled": {
- "background": "#292739",
- "border": "#353347",
- "foreground": "#2f2b43"
- },
- "inverted": {
- "background": "#e0def4",
- "border": "#191724",
- "foreground": "#4b4860"
- }
- },
- "on": {
- "default": {
- "background": "#1d1b2a",
- "border": "#232132",
- "foreground": "#e0def4"
- },
- "hovered": {
- "background": "#232132",
- "border": "#232132",
- "foreground": "#e0def4"
- },
- "pressed": {
- "background": "#2f2d40",
- "border": "#232132",
- "foreground": "#e0def4"
- },
- "active": {
- "background": "#403e53",
- "border": "#504d65",
- "foreground": "#e0def4"
- },
- "disabled": {
- "background": "#1d1b2a",
- "border": "#1e1c2c",
- "foreground": "#3b384f"
- },
- "inverted": {
- "background": "#e0def4",
- "border": "#191724",
- "foreground": "#3b394e"
- }
- },
- "accent": {
- "default": {
- "background": "#2f3739",
- "border": "#435255",
- "foreground": "#9cced7"
- },
- "hovered": {
- "background": "#435255",
- "border": "#435255",
- "foreground": "#9cced7"
- },
- "pressed": {
- "background": "#4e6164",
- "border": "#435255",
- "foreground": "#9cced7"
- },
- "active": {
- "background": "#5d757a",
- "border": "#6e8f94",
- "foreground": "#fbfdfd"
- },
- "disabled": {
- "background": "#2f3739",
- "border": "#3a4446",
- "foreground": "#85aeb5"
- },
- "inverted": {
- "background": "#fbfdfd",
- "border": "#171717",
- "foreground": "#587074"
- }
- },
- "positive": {
- "default": {
- "background": "#182e23",
- "border": "#254839",
- "foreground": "#5dc2a3"
- },
- "hovered": {
- "background": "#254839",
- "border": "#254839",
- "foreground": "#5dc2a3"
- },
- "pressed": {
- "background": "#2c5645",
- "border": "#254839",
- "foreground": "#5dc2a3"
- },
- "active": {
- "background": "#356b57",
- "border": "#40836c",
- "foreground": "#f9fdfb"
- },
- "disabled": {
- "background": "#182e23",
- "border": "#1e3b2e",
- "foreground": "#4ea287"
- },
- "inverted": {
- "background": "#f9fdfb",
- "border": "#000e00",
- "foreground": "#326552"
- }
- },
- "warning": {
- "default": {
- "background": "#50341a",
- "border": "#6d4d2b",
- "foreground": "#f5c177"
- },
- "hovered": {
- "background": "#6d4d2b",
- "border": "#6d4d2b",
- "foreground": "#f5c177"
- },
- "pressed": {
- "background": "#7e5a34",
- "border": "#6d4d2b",
- "foreground": "#f5c177"
- },
- "active": {
- "background": "#946e41",
- "border": "#b0854f",
- "foreground": "#fffcf9"
- },
- "disabled": {
- "background": "#50341a",
- "border": "#5e4023",
- "foreground": "#d2a263"
- },
- "inverted": {
- "background": "#fffcf9",
- "border": "#2c1600",
- "foreground": "#8e683c"
- }
- },
- "negative": {
- "default": {
- "background": "#431820",
- "border": "#612834",
- "foreground": "#ea6f92"
- },
- "hovered": {
- "background": "#612834",
- "border": "#612834",
- "foreground": "#ea6f92"
- },
- "pressed": {
- "background": "#71303f",
- "border": "#612834",
- "foreground": "#ea6f92"
- },
- "active": {
- "background": "#883c4f",
- "border": "#a44961",
- "foreground": "#fff9fa"
- },
- "disabled": {
- "background": "#431820",
- "border": "#52202a",
- "foreground": "#c75c79"
- },
- "inverted": {
- "background": "#fff9fa",
- "border": "#230000",
- "foreground": "#82384a"
- }
- }
- },
- "middle": {
- "base": {
- "default": {
- "background": "#1d1b2a",
- "border": "#232132",
- "foreground": "#e0def4"
- },
- "hovered": {
- "background": "#232132",
- "border": "#232132",
- "foreground": "#e0def4"
- },
- "pressed": {
- "background": "#2f2d40",
- "border": "#232132",
- "foreground": "#e0def4"
- },
- "active": {
- "background": "#403e53",
- "border": "#504d65",
- "foreground": "#e0def4"
- },
- "disabled": {
- "background": "#1d1b2a",
- "border": "#1e1c2c",
- "foreground": "#3b384f"
- },
- "inverted": {
- "background": "#e0def4",
- "border": "#191724",
- "foreground": "#3b394e"
- }
- },
- "variant": {
- "default": {
- "background": "#1d1b2a",
- "border": "#232132",
- "foreground": "#75718e"
- },
- "hovered": {
- "background": "#232132",
- "border": "#232132",
- "foreground": "#75718e"
- },
- "pressed": {
- "background": "#2f2d40",
- "border": "#232132",
- "foreground": "#75718e"
- },
- "active": {
- "background": "#403e53",
- "border": "#504d65",
- "foreground": "#e0def4"
- },
- "disabled": {
- "background": "#1d1b2a",
- "border": "#1e1c2c",
- "foreground": "#3b384f"
- },
- "inverted": {
- "background": "#e0def4",
- "border": "#191724",
- "foreground": "#3b394e"
- }
- },
- "on": {
- "default": {
- "background": "#191724",
- "border": "#1c1a29",
- "foreground": "#e0def4"
- },
- "hovered": {
- "background": "#1c1a29",
- "border": "#1c1a29",
- "foreground": "#e0def4"
- },
- "pressed": {
- "background": "#1d1b2b",
- "border": "#1c1a29",
- "foreground": "#e0def4"
- },
- "active": {
- "background": "#222031",
- "border": "#353347",
- "foreground": "#e0def4"
- },
- "disabled": {
- "background": "#191724",
- "border": "#1a1826",
- "foreground": "#4e4b63"
- },
- "inverted": {
- "background": "#e0def4",
- "border": "#191724",
- "foreground": "#1f1d2e"
- }
- },
- "accent": {
- "default": {
- "background": "#2f3739",
- "border": "#435255",
- "foreground": "#9cced7"
- },
- "hovered": {
- "background": "#435255",
- "border": "#435255",
- "foreground": "#9cced7"
- },
- "pressed": {
- "background": "#4e6164",
- "border": "#435255",
- "foreground": "#9cced7"
- },
- "active": {
- "background": "#5d757a",
- "border": "#6e8f94",
- "foreground": "#fbfdfd"
- },
- "disabled": {
- "background": "#2f3739",
- "border": "#3a4446",
- "foreground": "#85aeb5"
- },
- "inverted": {
- "background": "#fbfdfd",
- "border": "#171717",
- "foreground": "#587074"
- }
- },
- "positive": {
- "default": {
- "background": "#182e23",
- "border": "#254839",
- "foreground": "#5dc2a3"
- },
- "hovered": {
- "background": "#254839",
- "border": "#254839",
- "foreground": "#5dc2a3"
- },
- "pressed": {
- "background": "#2c5645",
- "border": "#254839",
- "foreground": "#5dc2a3"
- },
- "active": {
- "background": "#356b57",
- "border": "#40836c",
- "foreground": "#f9fdfb"
- },
- "disabled": {
- "background": "#182e23",
- "border": "#1e3b2e",
- "foreground": "#4ea287"
- },
- "inverted": {
- "background": "#f9fdfb",
- "border": "#000e00",
- "foreground": "#326552"
- }
- },
- "warning": {
- "default": {
- "background": "#50341a",
- "border": "#6d4d2b",
- "foreground": "#f5c177"
- },
- "hovered": {
- "background": "#6d4d2b",
- "border": "#6d4d2b",
- "foreground": "#f5c177"
- },
- "pressed": {
- "background": "#7e5a34",
- "border": "#6d4d2b",
- "foreground": "#f5c177"
- },
- "active": {
- "background": "#946e41",
- "border": "#b0854f",
- "foreground": "#fffcf9"
- },
- "disabled": {
- "background": "#50341a",
- "border": "#5e4023",
- "foreground": "#d2a263"
- },
- "inverted": {
- "background": "#fffcf9",
- "border": "#2c1600",
- "foreground": "#8e683c"
- }
- },
- "negative": {
- "default": {
- "background": "#431820",
- "border": "#612834",
- "foreground": "#ea6f92"
- },
- "hovered": {
- "background": "#612834",
- "border": "#612834",
- "foreground": "#ea6f92"
- },
- "pressed": {
- "background": "#71303f",
- "border": "#612834",
- "foreground": "#ea6f92"
- },
- "active": {
- "background": "#883c4f",
- "border": "#a44961",
- "foreground": "#fff9fa"
- },
- "disabled": {
- "background": "#431820",
- "border": "#52202a",
- "foreground": "#c75c79"
- },
- "inverted": {
- "background": "#fff9fa",
- "border": "#230000",
- "foreground": "#82384a"
- }
- }
- },
- "highest": {
- "base": {
- "default": {
- "background": "#191724",
- "border": "#1c1a29",
- "foreground": "#e0def4"
- },
- "hovered": {
- "background": "#1c1a29",
- "border": "#1c1a29",
- "foreground": "#e0def4"
- },
- "pressed": {
- "background": "#1d1b2b",
- "border": "#1c1a29",
- "foreground": "#e0def4"
- },
- "active": {
- "background": "#222031",
- "border": "#353347",
- "foreground": "#e0def4"
- },
- "disabled": {
- "background": "#191724",
- "border": "#1a1826",
- "foreground": "#4e4b63"
- },
- "inverted": {
- "background": "#e0def4",
- "border": "#191724",
- "foreground": "#1f1d2e"
- }
- },
- "variant": {
- "default": {
- "background": "#191724",
- "border": "#1c1a29",
- "foreground": "#75718e"
- },
- "hovered": {
- "background": "#1c1a29",
- "border": "#1c1a29",
- "foreground": "#75718e"
- },
- "pressed": {
- "background": "#1d1b2b",
- "border": "#1c1a29",
- "foreground": "#75718e"
- },
- "active": {
- "background": "#222031",
- "border": "#353347",
- "foreground": "#e0def4"
- },
- "disabled": {
- "background": "#191724",
- "border": "#1a1826",
- "foreground": "#4e4b63"
- },
- "inverted": {
- "background": "#e0def4",
- "border": "#191724",
- "foreground": "#1f1d2e"
- }
- },
- "on": {
- "default": {
- "background": "#1d1b2a",
- "border": "#232132",
- "foreground": "#e0def4"
- },
- "hovered": {
- "background": "#232132",
- "border": "#232132",
- "foreground": "#e0def4"
- },
- "pressed": {
- "background": "#2f2d40",
- "border": "#232132",
- "foreground": "#e0def4"
- },
- "active": {
- "background": "#403e53",
- "border": "#504d65",
- "foreground": "#e0def4"
- },
- "disabled": {
- "background": "#1d1b2a",
- "border": "#1e1c2c",
- "foreground": "#3b384f"
- },
- "inverted": {
- "background": "#e0def4",
- "border": "#191724",
- "foreground": "#3b394e"
- }
- },
- "accent": {
- "default": {
- "background": "#2f3739",
- "border": "#435255",
- "foreground": "#9cced7"
- },
- "hovered": {
- "background": "#435255",
- "border": "#435255",
- "foreground": "#9cced7"
- },
- "pressed": {
- "background": "#4e6164",
- "border": "#435255",
- "foreground": "#9cced7"
- },
- "active": {
- "background": "#5d757a",
- "border": "#6e8f94",
- "foreground": "#fbfdfd"
- },
- "disabled": {
- "background": "#2f3739",
- "border": "#3a4446",
- "foreground": "#85aeb5"
- },
- "inverted": {
- "background": "#fbfdfd",
- "border": "#171717",
- "foreground": "#587074"
- }
- },
- "positive": {
- "default": {
- "background": "#182e23",
- "border": "#254839",
- "foreground": "#5dc2a3"
- },
- "hovered": {
- "background": "#254839",
- "border": "#254839",
- "foreground": "#5dc2a3"
- },
- "pressed": {
- "background": "#2c5645",
- "border": "#254839",
- "foreground": "#5dc2a3"
- },
- "active": {
- "background": "#356b57",
- "border": "#40836c",
- "foreground": "#f9fdfb"
- },
- "disabled": {
- "background": "#182e23",
- "border": "#1e3b2e",
- "foreground": "#4ea287"
- },
- "inverted": {
- "background": "#f9fdfb",
- "border": "#000e00",
- "foreground": "#326552"
- }
- },
- "warning": {
- "default": {
- "background": "#50341a",
- "border": "#6d4d2b",
- "foreground": "#f5c177"
- },
- "hovered": {
- "background": "#6d4d2b",
- "border": "#6d4d2b",
- "foreground": "#f5c177"
- },
- "pressed": {
- "background": "#7e5a34",
- "border": "#6d4d2b",
- "foreground": "#f5c177"
- },
- "active": {
- "background": "#946e41",
- "border": "#b0854f",
- "foreground": "#fffcf9"
- },
- "disabled": {
- "background": "#50341a",
- "border": "#5e4023",
- "foreground": "#d2a263"
- },
- "inverted": {
- "background": "#fffcf9",
- "border": "#2c1600",
- "foreground": "#8e683c"
- }
- },
- "negative": {
- "default": {
- "background": "#431820",
- "border": "#612834",
- "foreground": "#ea6f92"
- },
- "hovered": {
- "background": "#612834",
- "border": "#612834",
- "foreground": "#ea6f92"
- },
- "pressed": {
- "background": "#71303f",
- "border": "#612834",
- "foreground": "#ea6f92"
- },
- "active": {
- "background": "#883c4f",
- "border": "#a44961",
- "foreground": "#fff9fa"
- },
- "disabled": {
- "background": "#431820",
- "border": "#52202a",
- "foreground": "#c75c79"
- },
- "inverted": {
- "background": "#fff9fa",
- "border": "#230000",
- "foreground": "#82384a"
- }
- }
- },
- "popover_shadow": {
- "blur": 4,
- "color": "#00000033",
- "offset": [
- 1,
- 2
- ]
- },
- "modal_shadow": {
- "blur": 16,
- "color": "#00000033",
- "offset": [
- 0,
- 2
- ]
- },
- "players": {
- "0": {
- "selection": "#9cced73d",
- "cursor": "#9cced7"
- },
- "1": {
- "selection": "#5dc2a33d",
- "cursor": "#5dc2a3"
- },
- "2": {
- "selection": "#9d76913d",
- "cursor": "#9d7691"
- },
- "3": {
- "selection": "#c4a7e63d",
- "cursor": "#c4a7e6"
- },
- "4": {
- "selection": "#c4a7e63d",
- "cursor": "#c4a7e6"
- },
- "5": {
- "selection": "#32748f3d",
- "cursor": "#32748f"
- },
- "6": {
- "selection": "#ea6f923d",
- "cursor": "#ea6f92"
- },
- "7": {
- "selection": "#f5c1773d",
- "cursor": "#f5c177"
- }
- },
- "syntax": {
- "comment": {
- "color": "#6e6a86"
- },
- "operator": {
- "color": "#31748f"
- },
- "punctuation": {
- "color": "#908caa"
- },
- "variable": {
- "color": "#e0def4"
- },
- "string": {
- "color": "#f6c177"
- },
- "type": {
- "color": "#9ccfd8"
- },
- "type.builtin": {
- "color": "#9ccfd8"
- },
- "boolean": {
- "color": "#ebbcba"
- },
- "function": {
- "color": "#ebbcba"
- },
- "keyword": {
- "color": "#31748f"
- },
- "tag": {
- "color": "#9ccfd8"
- },
- "function.method": {
- "color": "#ebbcba"
- },
- "title": {
- "color": "#f6c177"
- },
- "link_text": {
- "color": "#9ccfd8",
- "italic": false
- },
- "link_uri": {
- "color": "#ebbcba"
- }
- },
- "color_family": {
- "neutral": {
- "low": 11.568627450980392,
- "high": 91.37254901960785,
- "range": 79.80392156862746,
- "scaling_value": 1.2530712530712529
- },
- "red": {
- "low": 6.862745098039216,
- "high": 100,
- "range": 93.13725490196079,
- "scaling_value": 1.0736842105263158
- },
- "orange": {
- "low": 5.490196078431373,
- "high": 100,
- "range": 94.50980392156863,
- "scaling_value": 1.058091286307054
- },
- "yellow": {
- "low": 8.627450980392156,
- "high": 100,
- "range": 91.37254901960785,
- "scaling_value": 1.094420600858369
- },
- "green": {
- "low": 2.7450980392156863,
- "high": 100,
- "range": 97.25490196078431,
- "scaling_value": 1.028225806451613
- },
- "cyan": {
- "low": 0,
- "high": 100,
- "range": 100,
- "scaling_value": 1
- },
- "blue": {
- "low": 9.019607843137255,
- "high": 100,
- "range": 90.98039215686275,
- "scaling_value": 1.0991379310344827
- },
- "violet": {
- "low": 5.490196078431373,
- "high": 100,
- "range": 94.50980392156863,
- "scaling_value": 1.058091286307054
- },
- "magenta": {
- "low": 0,
- "high": 100,
- "range": 100,
- "scaling_value": 1
- }
- }
- }
- })
- .unwrap()
-}
-
-pub fn rose_pine_dawn() -> Theme {
- serde_json::from_value(json!({
- "name": "Rosé Pine Dawn",
- "is_light": true,
- "ramps": {},
- "lowest": {
- "base": {
- "default": {
- "background": "#dcd8d8",
- "border": "#dcd6d5",
- "foreground": "#575279"
- },
- "hovered": {
- "background": "#dcd6d5",
- "border": "#dcd6d5",
- "foreground": "#575279"
- },
- "pressed": {
- "background": "#efe6df",
- "border": "#dcd6d5",
- "foreground": "#575279"
- },
- "active": {
- "background": "#c1bac1",
- "border": "#a9a3b0",
- "foreground": "#575279"
- },
- "disabled": {
- "background": "#dcd8d8",
- "border": "#d0cccf",
- "foreground": "#938fa3"
- },
- "inverted": {
- "background": "#575279",
- "border": "#faf4ed",
- "foreground": "#c7c0c5"
- }
- },
- "variant": {
- "default": {
- "background": "#dcd8d8",
- "border": "#dcd6d5",
- "foreground": "#706c8c"
- },
- "hovered": {
- "background": "#dcd6d5",
- "border": "#dcd6d5",
- "foreground": "#706c8c"
- },
- "pressed": {
- "background": "#efe6df",
- "border": "#dcd6d5",
- "foreground": "#706c8c"
- },
- "active": {
- "background": "#c1bac1",
- "border": "#a9a3b0",
- "foreground": "#575279"
- },
- "disabled": {
- "background": "#dcd8d8",
- "border": "#d0cccf",
- "foreground": "#938fa3"
- },
- "inverted": {
- "background": "#575279",
- "border": "#faf4ed",
- "foreground": "#c7c0c5"
- }
- },
- "on": {
- "default": {
- "background": "#fef9f2",
- "border": "#e5e0df",
- "foreground": "#575279"
- },
- "hovered": {
- "background": "#e5e0df",
- "border": "#e5e0df",
- "foreground": "#575279"
- },
- "pressed": {
- "background": "#d4d0d2",
- "border": "#e5e0df",
- "foreground": "#575279"
- },
- "active": {
- "background": "#dbd5d4",
- "border": "#dbd3d1",
- "foreground": "#575279"
- },
- "disabled": {
- "background": "#fef9f2",
- "border": "#f6f1eb",
- "foreground": "#b1abb5"
- },
- "inverted": {
- "background": "#575279",
- "border": "#faf4ed",
- "foreground": "#d6d1d1"
- }
- },
- "accent": {
- "default": {
- "background": "#dde9eb",
- "border": "#c3d7db",
- "foreground": "#57949f"
- },
- "hovered": {
- "background": "#c3d7db",
- "border": "#c3d7db",
- "foreground": "#57949f"
- },
- "pressed": {
- "background": "#b6cfd3",
- "border": "#c3d7db",
- "foreground": "#57949f"
- },
- "active": {
- "background": "#a3c3c9",
- "border": "#8db6bd",
- "foreground": "#06090a"
- },
- "disabled": {
- "background": "#dde9eb",
- "border": "#d0e0e3",
- "foreground": "#72a5ae"
- },
- "inverted": {
- "background": "#06090a",
- "border": "#ffffff",
- "foreground": "#a8c7cd"
- }
- },
- "positive": {
- "default": {
- "background": "#dbeee7",
- "border": "#bee0d5",
- "foreground": "#3eaa8e"
- },
- "hovered": {
- "background": "#bee0d5",
- "border": "#bee0d5",
- "foreground": "#3eaa8e"
- },
- "pressed": {
- "background": "#b0dacb",
- "border": "#bee0d5",
- "foreground": "#3eaa8e"
- },
- "active": {
- "background": "#9bd0bf",
- "border": "#82c6b1",
- "foreground": "#060a09"
- },
- "disabled": {
- "background": "#dbeee7",
- "border": "#cde7de",
- "foreground": "#63b89f"
- },
- "inverted": {
- "background": "#060a09",
- "border": "#ffffff",
- "foreground": "#a1d4c3"
- }
- },
- "warning": {
- "default": {
- "background": "#ffebd6",
- "border": "#ffdab7",
- "foreground": "#e99d35"
- },
- "hovered": {
- "background": "#ffdab7",
- "border": "#ffdab7",
- "foreground": "#e99d35"
- },
- "pressed": {
- "background": "#fed2a6",
- "border": "#ffdab7",
- "foreground": "#e99d35"
- },
- "active": {
- "background": "#fbc891",
- "border": "#f7bc77",
- "foreground": "#330704"
- },
- "disabled": {
- "background": "#ffebd6",
- "border": "#ffe2c7",
- "foreground": "#f1ac57"
- },
- "inverted": {
- "background": "#330704",
- "border": "#ffffff",
- "foreground": "#fccb97"
- }
- },
- "negative": {
- "default": {
- "background": "#f1dfe3",
- "border": "#e6c6cd",
- "foreground": "#b4647a"
- },
- "hovered": {
- "background": "#e6c6cd",
- "border": "#e6c6cd",
- "foreground": "#b4647a"
- },
- "pressed": {
- "background": "#e0bac2",
- "border": "#e6c6cd",
- "foreground": "#b4647a"
- },
- "active": {
- "background": "#d8a8b3",
- "border": "#ce94a3",
- "foreground": "#0b0708"
- },
- "disabled": {
- "background": "#f1dfe3",
- "border": "#ecd2d8",
- "foreground": "#c17b8e"
- },
- "inverted": {
- "background": "#0b0708",
- "border": "#ffffff",
- "foreground": "#dbadb8"
- }
- }
- },
- "middle": {
- "base": {
- "default": {
- "background": "#fef9f2",
- "border": "#e5e0df",
- "foreground": "#575279"
- },
- "hovered": {
- "background": "#e5e0df",
- "border": "#e5e0df",
- "foreground": "#575279"
- },
- "pressed": {
- "background": "#d4d0d2",
- "border": "#e5e0df",
- "foreground": "#575279"
- },
- "active": {
- "background": "#dbd5d4",
- "border": "#dbd3d1",
- "foreground": "#575279"
- },
- "disabled": {
- "background": "#fef9f2",
- "border": "#f6f1eb",
- "foreground": "#b1abb5"
- },
- "inverted": {
- "background": "#575279",
- "border": "#faf4ed",
- "foreground": "#d6d1d1"
- }
- },
- "variant": {
- "default": {
- "background": "#fef9f2",
- "border": "#e5e0df",
- "foreground": "#706c8c"
- },
- "hovered": {
- "background": "#e5e0df",
- "border": "#e5e0df",
- "foreground": "#706c8c"
- },
- "pressed": {
- "background": "#d4d0d2",
- "border": "#e5e0df",
- "foreground": "#706c8c"
- },
- "active": {
- "background": "#dbd5d4",
- "border": "#dbd3d1",
- "foreground": "#575279"
- },
- "disabled": {
- "background": "#fef9f2",
- "border": "#f6f1eb",
- "foreground": "#b1abb5"
- },
- "inverted": {
- "background": "#575279",
- "border": "#faf4ed",
- "foreground": "#d6d1d1"
- }
- },
- "on": {
- "default": {
- "background": "#faf4ed",
- "border": "#fdf8f1",
- "foreground": "#575279"
- },
- "hovered": {
- "background": "#fdf8f1",
- "border": "#fdf8f1",
- "foreground": "#575279"
- },
- "pressed": {
- "background": "#fdf8f2",
- "border": "#fdf8f1",
- "foreground": "#575279"
- },
- "active": {
- "background": "#e6e1e0",
- "border": "#d0cccf",
- "foreground": "#575279"
- },
- "disabled": {
- "background": "#faf4ed",
- "border": "#fcf6ef",
- "foreground": "#efe6df"
- },
- "inverted": {
- "background": "#575279",
- "border": "#faf4ed",
- "foreground": "#ede9e5"
- }
- },
- "accent": {
- "default": {
- "background": "#dde9eb",
- "border": "#c3d7db",
- "foreground": "#57949f"
- },
- "hovered": {
- "background": "#c3d7db",
- "border": "#c3d7db",
- "foreground": "#57949f"
- },
- "pressed": {
- "background": "#b6cfd3",
- "border": "#c3d7db",
- "foreground": "#57949f"
- },
- "active": {
- "background": "#a3c3c9",
- "border": "#8db6bd",
- "foreground": "#06090a"
- },
- "disabled": {
- "background": "#dde9eb",
- "border": "#d0e0e3",
- "foreground": "#72a5ae"
- },
- "inverted": {
- "background": "#06090a",
- "border": "#ffffff",
- "foreground": "#a8c7cd"
- }
- },
- "positive": {
- "default": {
- "background": "#dbeee7",
- "border": "#bee0d5",
- "foreground": "#3eaa8e"
- },
- "hovered": {
- "background": "#bee0d5",
- "border": "#bee0d5",
- "foreground": "#3eaa8e"
- },
- "pressed": {
- "background": "#b0dacb",
- "border": "#bee0d5",
- "foreground": "#3eaa8e"
- },
- "active": {
- "background": "#9bd0bf",
- "border": "#82c6b1",
- "foreground": "#060a09"
- },
- "disabled": {
- "background": "#dbeee7",
- "border": "#cde7de",
- "foreground": "#63b89f"
- },
- "inverted": {
- "background": "#060a09",
- "border": "#ffffff",
- "foreground": "#a1d4c3"
- }
- },
- "warning": {
- "default": {
- "background": "#ffebd6",
- "border": "#ffdab7",
- "foreground": "#e99d35"
- },
- "hovered": {
- "background": "#ffdab7",
- "border": "#ffdab7",
- "foreground": "#e99d35"
- },
- "pressed": {
- "background": "#fed2a6",
- "border": "#ffdab7",
- "foreground": "#e99d35"
- },
- "active": {
- "background": "#fbc891",
- "border": "#f7bc77",
- "foreground": "#330704"
- },
- "disabled": {
- "background": "#ffebd6",
- "border": "#ffe2c7",
- "foreground": "#f1ac57"
- },
- "inverted": {
- "background": "#330704",
- "border": "#ffffff",
- "foreground": "#fccb97"
- }
- },
- "negative": {
- "default": {
- "background": "#f1dfe3",
- "border": "#e6c6cd",
- "foreground": "#b4647a"
- },
- "hovered": {
- "background": "#e6c6cd",
- "border": "#e6c6cd",
- "foreground": "#b4647a"
- },
- "pressed": {
- "background": "#e0bac2",
- "border": "#e6c6cd",
- "foreground": "#b4647a"
- },
- "active": {
- "background": "#d8a8b3",
- "border": "#ce94a3",
- "foreground": "#0b0708"
- },
- "disabled": {
- "background": "#f1dfe3",
- "border": "#ecd2d8",
- "foreground": "#c17b8e"
- },
- "inverted": {
- "background": "#0b0708",
- "border": "#ffffff",
- "foreground": "#dbadb8"
- }
- }
- },
- "highest": {
- "base": {
- "default": {
- "background": "#faf4ed",
- "border": "#fdf8f1",
- "foreground": "#575279"
- },
- "hovered": {
- "background": "#fdf8f1",
- "border": "#fdf8f1",
- "foreground": "#575279"
- },
- "pressed": {
- "background": "#fdf8f2",
- "border": "#fdf8f1",
- "foreground": "#575279"
- },
- "active": {
- "background": "#e6e1e0",
- "border": "#d0cccf",
- "foreground": "#575279"
- },
- "disabled": {
- "background": "#faf4ed",
- "border": "#fcf6ef",
- "foreground": "#efe6df"
- },
- "inverted": {
- "background": "#575279",
- "border": "#faf4ed",
- "foreground": "#ede9e5"
- }
- },
- "variant": {
- "default": {
- "background": "#faf4ed",
- "border": "#fdf8f1",
- "foreground": "#706c8c"
- },
- "hovered": {
- "background": "#fdf8f1",
- "border": "#fdf8f1",
- "foreground": "#706c8c"
- },
- "pressed": {
- "background": "#fdf8f2",
- "border": "#fdf8f1",
- "foreground": "#706c8c"
- },
- "active": {
- "background": "#e6e1e0",
- "border": "#d0cccf",
- "foreground": "#575279"
- },
- "disabled": {
- "background": "#faf4ed",
- "border": "#fcf6ef",
- "foreground": "#efe6df"
- },
- "inverted": {
- "background": "#575279",
- "border": "#faf4ed",
- "foreground": "#ede9e5"
- }
- },
- "on": {
- "default": {
- "background": "#fef9f2",
- "border": "#e5e0df",
- "foreground": "#575279"
- },
- "hovered": {
- "background": "#e5e0df",
- "border": "#e5e0df",
- "foreground": "#575279"
- },
- "pressed": {
- "background": "#d4d0d2",
- "border": "#e5e0df",
- "foreground": "#575279"
- },
- "active": {
- "background": "#dbd5d4",
- "border": "#dbd3d1",
- "foreground": "#575279"
- },
- "disabled": {
- "background": "#fef9f2",
- "border": "#f6f1eb",
- "foreground": "#b1abb5"
- },
- "inverted": {
- "background": "#575279",
- "border": "#faf4ed",
- "foreground": "#d6d1d1"
- }
- },
- "accent": {
- "default": {
- "background": "#dde9eb",
- "border": "#c3d7db",
- "foreground": "#57949f"
- },
- "hovered": {
- "background": "#c3d7db",
- "border": "#c3d7db",
- "foreground": "#57949f"
- },
- "pressed": {
- "background": "#b6cfd3",
- "border": "#c3d7db",
- "foreground": "#57949f"
- },
- "active": {
- "background": "#a3c3c9",
- "border": "#8db6bd",
- "foreground": "#06090a"
- },
- "disabled": {
- "background": "#dde9eb",
- "border": "#d0e0e3",
- "foreground": "#72a5ae"
- },
- "inverted": {
- "background": "#06090a",
- "border": "#ffffff",
- "foreground": "#a8c7cd"
- }
- },
- "positive": {
- "default": {
- "background": "#dbeee7",
- "border": "#bee0d5",
- "foreground": "#3eaa8e"
- },
- "hovered": {
- "background": "#bee0d5",
- "border": "#bee0d5",
- "foreground": "#3eaa8e"
- },
- "pressed": {
- "background": "#b0dacb",
- "border": "#bee0d5",
- "foreground": "#3eaa8e"
- },
- "active": {
- "background": "#9bd0bf",
- "border": "#82c6b1",
- "foreground": "#060a09"
- },
- "disabled": {
- "background": "#dbeee7",
- "border": "#cde7de",
- "foreground": "#63b89f"
- },
- "inverted": {
- "background": "#060a09",
- "border": "#ffffff",
- "foreground": "#a1d4c3"
- }
- },
- "warning": {
- "default": {
- "background": "#ffebd6",
- "border": "#ffdab7",
- "foreground": "#e99d35"
- },
- "hovered": {
- "background": "#ffdab7",
- "border": "#ffdab7",
- "foreground": "#e99d35"
- },
- "pressed": {
- "background": "#fed2a6",
- "border": "#ffdab7",
- "foreground": "#e99d35"
- },
- "active": {
- "background": "#fbc891",
- "border": "#f7bc77",
- "foreground": "#330704"
- },
- "disabled": {
- "background": "#ffebd6",
- "border": "#ffe2c7",
- "foreground": "#f1ac57"
- },
- "inverted": {
- "background": "#330704",
- "border": "#ffffff",
- "foreground": "#fccb97"
- }
- },
- "negative": {
- "default": {
- "background": "#f1dfe3",
- "border": "#e6c6cd",
- "foreground": "#b4647a"
- },
- "hovered": {
- "background": "#e6c6cd",
- "border": "#e6c6cd",
- "foreground": "#b4647a"
- },
- "pressed": {
- "background": "#e0bac2",
- "border": "#e6c6cd",
- "foreground": "#b4647a"
- },
- "active": {
- "background": "#d8a8b3",
- "border": "#ce94a3",
- "foreground": "#0b0708"
- },
- "disabled": {
- "background": "#f1dfe3",
- "border": "#ecd2d8",
- "foreground": "#c17b8e"
- },
- "inverted": {
- "background": "#0b0708",
- "border": "#ffffff",
- "foreground": "#dbadb8"
- }
- }
- },
- "popover_shadow": {
- "blur": 4,
- "color": "#2c2a4d33",
- "offset": [
- 1,
- 2
- ]
- },
- "modal_shadow": {
- "blur": 16,
- "color": "#2c2a4d33",
- "offset": [
- 0,
- 2
- ]
- },
- "players": {
- "0": {
- "selection": "#57949f3d",
- "cursor": "#57949f"
- },
- "1": {
- "selection": "#3eaa8e3d",
- "cursor": "#3eaa8e"
- },
- "2": {
- "selection": "#7c697f3d",
- "cursor": "#7c697f"
- },
- "3": {
- "selection": "#907aa93d",
- "cursor": "#907aa9"
- },
- "4": {
- "selection": "#907aa93d",
- "cursor": "#907aa9"
- },
- "5": {
- "selection": "#2a69833d",
- "cursor": "#2a6983"
- },
- "6": {
- "selection": "#b4647a3d",
- "cursor": "#b4647a"
- },
- "7": {
- "selection": "#e99d353d",
- "cursor": "#e99d35"
- }
- },
- "syntax": {
- "comment": {
- "color": "#9893a5"
- },
- "operator": {
- "color": "#286983"
- },
- "punctuation": {
- "color": "#797593"
- },
- "variable": {
- "color": "#575279"
- },
- "string": {
- "color": "#ea9d34"
- },
- "type": {
- "color": "#56949f"
- },
- "type.builtin": {
- "color": "#56949f"
- },
- "boolean": {
- "color": "#d7827e"
- },
- "function": {
- "color": "#d7827e"
- },
- "keyword": {
- "color": "#286983"
- },
- "tag": {
- "color": "#56949f"
- },
- "function.method": {
- "color": "#d7827e"
- },
- "title": {
- "color": "#ea9d34"
- },
- "link_text": {
- "color": "#56949f",
- "italic": false
- },
- "link_uri": {
- "color": "#d7827e"
- }
- },
- "color_family": {
- "neutral": {
- "low": 39.80392156862745,
- "high": 95.49019607843137,
- "range": 55.686274509803916,
- "scaling_value": 1.7957746478873242
- },
- "red": {
- "low": 0,
- "high": 100,
- "range": 100,
- "scaling_value": 1
- },
- "orange": {
- "low": 0,
- "high": 100,
- "range": 100,
- "scaling_value": 1
- },
- "yellow": {
- "low": 8.823529411764707,
- "high": 100,
- "range": 91.17647058823529,
- "scaling_value": 1.0967741935483872
- },
- "green": {
- "low": 0,
- "high": 100,
- "range": 100,
- "scaling_value": 1
- },
- "cyan": {
- "low": 0,
- "high": 100,
- "range": 100,
- "scaling_value": 1
- },
- "blue": {
- "low": 0,
- "high": 100,
- "range": 100,
- "scaling_value": 1
- },
- "violet": {
- "low": 0,
- "high": 100,
- "range": 100,
- "scaling_value": 1
- },
- "magenta": {
- "low": 0,
- "high": 100,
- "range": 100,
- "scaling_value": 1
- }
- }
- }))
- .unwrap()
-}
diff --git a/crates/theme2/src/theme2.rs b/crates/theme2/src/theme2.rs
index 9a7d58a6c7b..6d4d5269e3c 100644
--- a/crates/theme2/src/theme2.rs
+++ b/crates/theme2/src/theme2.rs
@@ -18,6 +18,10 @@ pub fn active_theme<'a>(cx: &'a AppContext) -> &'a Arc<Theme> {
&ThemeSettings::get_global(cx).active_theme
}
+pub fn theme(cx: &AppContext) -> Arc<Theme> {
+ active_theme(cx).clone()
+}
+
pub struct Theme {
pub metadata: ThemeMetadata,
diff --git a/crates/ui2/src/lib.rs b/crates/ui2/src/lib.rs
index 689e9c53723..c1da5e410da 100644
--- a/crates/ui2/src/lib.rs
+++ b/crates/ui2/src/lib.rs
@@ -23,7 +23,6 @@ mod elevation;
pub mod prelude;
pub mod settings;
mod static_data;
-mod theme;
pub use components::*;
pub use elements::*;
@@ -38,7 +37,6 @@ pub use static_data::*;
// AFAICT this is something to do with conflicting names between crates and modules that
// interfaces with declaring the `ClassDecl`.
pub use crate::settings::*;
-pub use crate::theme::*;
#[cfg(feature = "stories")]
mod story;
diff --git a/crates/ui2/src/prelude.rs b/crates/ui2/src/prelude.rs
index 5d701fc5d7e..63405fc2cb1 100644
--- a/crates/ui2/src/prelude.rs
+++ b/crates/ui2/src/prelude.rs
@@ -5,7 +5,8 @@ pub use gpui2::{
pub use crate::elevation::*;
use crate::settings::user_settings;
-pub use crate::{theme, ButtonVariant};
+pub use crate::ButtonVariant;
+pub use theme2::theme;
use gpui2::{rems, Hsla, Rems};
use strum::EnumIter;
diff --git a/crates/ui2/src/theme.rs b/crates/ui2/src/theme.rs
deleted file mode 100644
index 98c93f9bddb..00000000000
--- a/crates/ui2/src/theme.rs
+++ /dev/null
@@ -1,134 +0,0 @@
-use gpui2::{AppContext, Hsla, Result};
-use serde::{de::Visitor, Deserialize, Deserializer};
-use std::collections::HashMap;
-use std::fmt;
-use std::sync::Arc;
-
-#[derive(Deserialize, Clone, Default, Debug)]
-pub struct Theme {
- pub name: String,
- pub is_light: bool,
- pub lowest: Layer,
- pub middle: Layer,
- pub highest: Layer,
- pub popover_shadow: Shadow,
- pub modal_shadow: Shadow,
- #[serde(deserialize_with = "deserialize_player_colors")]
- pub players: Vec<PlayerColors>,
- #[serde(deserialize_with = "deserialize_syntax_colors")]
- pub syntax: HashMap<String, Hsla>,
-}
-
-#[derive(Deserialize, Clone, Default, Debug)]
-pub struct Layer {
- pub base: StyleSet,
- pub variant: StyleSet,
- pub on: StyleSet,
- pub accent: StyleSet,
- pub positive: StyleSet,
- pub warning: StyleSet,
- pub negative: StyleSet,
-}
-
-#[derive(Deserialize, Clone, Default, Debug)]
-pub struct StyleSet {
- #[serde(rename = "default")]
- pub default: ContainerColors,
- pub hovered: ContainerColors,
- pub pressed: ContainerColors,
- pub active: ContainerColors,
- pub disabled: ContainerColors,
- pub inverted: ContainerColors,
-}
-
-#[derive(Deserialize, Clone, Default, Debug)]
-pub struct ContainerColors {
- pub background: Hsla,
- pub foreground: Hsla,
- pub border: Hsla,
-}
-
-#[derive(Deserialize, Clone, Default, Debug)]
-pub struct PlayerColors {
- pub selection: Hsla,
- pub cursor: Hsla,
-}
-
-#[derive(Deserialize, Clone, Default, Debug)]
-pub struct Shadow {
- pub blur: u8,
- pub color: Hsla,
- pub offset: Vec<u8>,
-}
-
-fn deserialize_player_colors<'de, D>(deserializer: D) -> Result<Vec<PlayerColors>, D::Error>
-where
- D: Deserializer<'de>,
-{
- struct PlayerArrayVisitor;
-
- impl<'de> Visitor<'de> for PlayerArrayVisitor {
- type Value = Vec<PlayerColors>;
-
- fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
- formatter.write_str("an object with integer keys")
- }
-
- fn visit_map<A: serde::de::MapAccess<'de>>(
- self,
- mut map: A,
- ) -> Result<Self::Value, A::Error> {
- let mut players = Vec::with_capacity(8);
- while let Some((key, value)) = map.next_entry::<usize, PlayerColors>()? {
- if key < 8 {
- players.push(value);
- } else {
- return Err(serde::de::Error::invalid_value(
- serde::de::Unexpected::Unsigned(key as u64),
- &"a key in range 0..7",
- ));
- }
- }
- Ok(players)
- }
- }
-
- deserializer.deserialize_map(PlayerArrayVisitor)
-}
-
-fn deserialize_syntax_colors<'de, D>(deserializer: D) -> Result<HashMap<String, Hsla>, D::Error>
-where
- D: serde::Deserializer<'de>,
-{
- #[derive(Deserialize)]
- struct ColorWrapper {
- color: Hsla,
- }
-
- struct SyntaxVisitor;
-
- impl<'de> Visitor<'de> for SyntaxVisitor {
- type Value = HashMap<String, Hsla>;
-
- fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
- formatter.write_str("a map with keys and objects with a single color field as values")
- }
-
- fn visit_map<M>(self, mut map: M) -> Result<HashMap<String, Hsla>, M::Error>
- where
- M: serde::de::MapAccess<'de>,
- {
- let mut result = HashMap::new();
- while let Some(key) = map.next_key()? {
- let wrapper: ColorWrapper = map.next_value()?; // Deserialize values as Hsla
- result.insert(key, wrapper.color);
- }
- Ok(result)
- }
- }
- deserializer.deserialize_map(SyntaxVisitor)
-}
-
-pub fn theme(cx: &AppContext) -> Arc<theme2::Theme> {
- theme2::active_theme(cx).clone()
-}