From 74853ea55f8993c1dd2ed494f267d852d3b12906 Mon Sep 17 00:00:00 2001 From: Marshall Bowers Date: Tue, 7 Nov 2023 16:41:36 +0100 Subject: [PATCH] Rename `ThemeVariant` to `Theme` (#3252) This PR renames the `ThemeVariant` type to `Theme`. This better reflects its purpose, as well as matches the same name as we had before, which should make porting crates slightly easier. Release Notes: - N/A --- crates/editor2/src/display_map.rs | 4 ++-- crates/editor2/src/editor.rs | 4 ++-- crates/editor2/src/items.rs | 4 ++-- crates/language2/src/language2.rs | 6 +++--- crates/theme2/src/default_theme.rs | 12 +++++------ crates/theme2/src/registry.rs | 8 ++++---- crates/theme2/src/settings.rs | 4 ++-- crates/theme2/src/theme2.rs | 10 ++++----- crates/theme2/src/themes/andromeda.rs | 6 +++--- crates/theme2/src/themes/ayu.rs | 8 ++++---- crates/theme2/src/themes/dracula.rs | 4 ++-- crates/theme2/src/themes/gruvbox.rs | 14 ++++++------- crates/theme2/src/themes/night_owl.rs | 6 +++--- crates/theme2/src/themes/nord.rs | 4 ++-- crates/theme2/src/themes/notctis.rs | 24 +++++++++++----------- crates/theme2/src/themes/palenight.rs | 8 ++++---- crates/theme2/src/themes/rose_pine.rs | 8 ++++---- crates/theme2/src/themes/solarized.rs | 6 +++--- crates/theme2/src/themes/synthwave_84.rs | 4 ++-- crates/theme_importer/src/theme_printer.rs | 4 ++-- crates/theme_importer/src/vscode.rs | 8 ++++---- crates/workspace2/src/item.rs | 8 ++++---- 22 files changed, 82 insertions(+), 82 deletions(-) diff --git a/crates/editor2/src/display_map.rs b/crates/editor2/src/display_map.rs index 51f5b0a192b6a2bd96468bd496db93efbe0cfe3b..93ceb4f9df95d609953579fdac2d42332ec1aeee 100644 --- a/crates/editor2/src/display_map.rs +++ b/crates/editor2/src/display_map.rs @@ -21,7 +21,7 @@ use lsp::DiagnosticSeverity; use std::{any::TypeId, borrow::Cow, fmt::Debug, num::NonZeroU32, ops::Range, sync::Arc}; use sum_tree::{Bias, TreeMap}; use tab_map::TabMap; -use theme::ThemeVariant; +use theme::Theme; use wrap_map::WrapMap; pub use block_map::{ @@ -505,7 +505,7 @@ impl DisplaySnapshot { &'a self, display_rows: Range, language_aware: bool, - theme: &'a ThemeVariant, + theme: &'a Theme, ) -> impl Iterator> { self.chunks( display_rows, diff --git a/crates/editor2/src/editor.rs b/crates/editor2/src/editor.rs index be8375336c604f9ca87f390128ab01c3991b37f1..6a73b5cf3a9311a666fdd3911a66395107ca584a 100644 --- a/crates/editor2/src/editor.rs +++ b/crates/editor2/src/editor.rs @@ -81,7 +81,7 @@ use std::{ pub use sum_tree::Bias; use sum_tree::TreeMap; use text::Rope; -use theme::{ActiveTheme, PlayerColor, ThemeColors, ThemeSettings, ThemeVariant}; +use theme::{ActiveTheme, PlayerColor, Theme, ThemeColors, ThemeSettings}; use util::{post_inc, RangeExt, ResultExt, TryFutureExt}; use workspace::{ItemNavHistory, SplitDirection, ViewId, Workspace}; @@ -9962,7 +9962,7 @@ pub fn highlight_diagnostic_message( (message_without_backticks, highlights) } -pub fn diagnostic_style(severity: DiagnosticSeverity, valid: bool, theme: &ThemeVariant) -> Hsla { +pub fn diagnostic_style(severity: DiagnosticSeverity, valid: bool, theme: &Theme) -> Hsla { match (severity, valid) { (DiagnosticSeverity::ERROR, true) => theme.status().error, (DiagnosticSeverity::ERROR, false) => theme.status().error, diff --git a/crates/editor2/src/items.rs b/crates/editor2/src/items.rs index e0b4423f82dec1cc3f732d40743f2e534a3f3477..9c49e5f14317579eb1ca6e103c5058de97e76d40 100644 --- a/crates/editor2/src/items.rs +++ b/crates/editor2/src/items.rs @@ -27,7 +27,7 @@ use std::{ sync::Arc, }; use text::Selection; -use theme::{ActiveTheme, ThemeVariant}; +use theme::{ActiveTheme, Theme}; use util::{paths::PathExt, ResultExt, TryFutureExt}; use workspace::item::{BreadcrumbText, FollowableItemHandle}; use workspace::{ @@ -777,7 +777,7 @@ impl Item for Editor { ToolbarItemLocation::PrimaryLeft { flex: None } } - fn breadcrumbs(&self, variant: &ThemeVariant, cx: &AppContext) -> Option> { + fn breadcrumbs(&self, variant: &Theme, cx: &AppContext) -> Option> { todo!(); // let cursor = self.selections.newest_anchor().head(); // let multibuffer = &self.buffer().read(cx); diff --git a/crates/language2/src/language2.rs b/crates/language2/src/language2.rs index 826817c99a54f2034ca7867565d80c36eae2edc5..bdea440c08d3c209dfb363ec33c1ae725ffb742e 100644 --- a/crates/language2/src/language2.rs +++ b/crates/language2/src/language2.rs @@ -43,7 +43,7 @@ use std::{ }, }; use syntax_map::SyntaxSnapshot; -use theme::{SyntaxTheme, ThemeVariant}; +use theme::{SyntaxTheme, Theme}; use tree_sitter::{self, Query}; use unicase::UniCase; use util::{http::HttpClient, paths::PathExt}; @@ -643,7 +643,7 @@ struct LanguageRegistryState { next_available_language_id: AvailableLanguageId, loading_languages: HashMap>>>>, subscription: (watch::Sender<()>, watch::Receiver<()>), - theme: Option>, + theme: Option>, version: usize, reload_count: usize, } @@ -744,7 +744,7 @@ impl LanguageRegistry { self.state.read().reload_count } - pub fn set_theme(&self, theme: Arc) { + pub fn set_theme(&self, theme: Arc) { let mut state = self.state.write(); state.theme = Some(theme.clone()); for language in &state.languages { diff --git a/crates/theme2/src/default_theme.rs b/crates/theme2/src/default_theme.rs index d7360b6f71ecb3167d08907d87d91aff4cee3724..dacd26be3e2eb7a5c376985327d96aa7ba94f92b 100644 --- a/crates/theme2/src/default_theme.rs +++ b/crates/theme2/src/default_theme.rs @@ -1,10 +1,10 @@ use crate::{ colors::{GitStatusColors, PlayerColors, StatusColors, SystemColors, ThemeColors, ThemeStyles}, - default_color_scales, Appearance, SyntaxTheme, ThemeFamily, ThemeVariant, + default_color_scales, Appearance, SyntaxTheme, Theme, ThemeFamily, }; -fn zed_pro_daylight() -> ThemeVariant { - ThemeVariant { +fn zed_pro_daylight() -> Theme { + Theme { id: "zed_pro_daylight".to_string(), name: "Zed Pro Daylight".into(), appearance: Appearance::Light, @@ -19,8 +19,8 @@ fn zed_pro_daylight() -> ThemeVariant { } } -pub(crate) fn zed_pro_moonlight() -> ThemeVariant { - ThemeVariant { +pub(crate) fn zed_pro_moonlight() -> Theme { + Theme { id: "zed_pro_moonlight".to_string(), name: "Zed Pro Moonlight".into(), appearance: Appearance::Dark, @@ -51,7 +51,7 @@ impl Default for ThemeFamily { } } -impl Default for ThemeVariant { +impl Default for Theme { fn default() -> Self { zed_pro_daylight() } diff --git a/crates/theme2/src/registry.rs b/crates/theme2/src/registry.rs index 98797e2cad573d1c11ae4d2e0c8a6baadcf475fb..45ba75941c47b5ae8c21c913c21d4bb77493e3b1 100644 --- a/crates/theme2/src/registry.rs +++ b/crates/theme2/src/registry.rs @@ -1,10 +1,10 @@ -use crate::{zed_pro_family, ThemeFamily, ThemeVariant}; +use crate::{zed_pro_family, Theme, ThemeFamily}; use anyhow::{anyhow, Result}; use gpui::SharedString; use std::{collections::HashMap, sync::Arc}; pub struct ThemeRegistry { - themes: HashMap>, + themes: HashMap>, } impl ThemeRegistry { @@ -14,7 +14,7 @@ impl ThemeRegistry { } } - fn insert_themes(&mut self, themes: impl IntoIterator) { + fn insert_themes(&mut self, themes: impl IntoIterator) { for theme in themes.into_iter() { self.themes.insert(theme.name.clone(), Arc::new(theme)); } @@ -28,7 +28,7 @@ impl ThemeRegistry { self.themes.values().map(|theme| theme.name.clone()) } - pub fn get(&self, name: &str) -> Result> { + pub fn get(&self, name: &str) -> Result> { self.themes .get(name) .ok_or_else(|| anyhow!("theme not found: {}", name)) diff --git a/crates/theme2/src/settings.rs b/crates/theme2/src/settings.rs index 5e8f9de873a09ea3d2681f3ff7e787f45be6f6be..c57576840119e42e42e3f305cd0dd4fc5463cf81 100644 --- a/crates/theme2/src/settings.rs +++ b/crates/theme2/src/settings.rs @@ -1,4 +1,4 @@ -use crate::{ThemeRegistry, ThemeVariant}; +use crate::{Theme, ThemeRegistry}; use anyhow::Result; use gpui::{px, AppContext, Font, FontFeatures, FontStyle, FontWeight, Pixels}; use schemars::{ @@ -21,7 +21,7 @@ pub struct ThemeSettings { pub buffer_font: Font, pub buffer_font_size: Pixels, pub buffer_line_height: BufferLineHeight, - pub active_theme: Arc, + pub active_theme: Arc, } #[derive(Default)] diff --git a/crates/theme2/src/theme2.rs b/crates/theme2/src/theme2.rs index 40e782c61790ba90c9b4d12ae731e3a0de570dbd..99ac40a9665206022ea14d14819adafa4c710b1b 100644 --- a/crates/theme2/src/theme2.rs +++ b/crates/theme2/src/theme2.rs @@ -33,11 +33,11 @@ pub fn init(cx: &mut AppContext) { } pub trait ActiveTheme { - fn theme(&self) -> &Arc; + fn theme(&self) -> &Arc; } impl ActiveTheme for AppContext { - fn theme(&self) -> &Arc { + fn theme(&self) -> &Arc { &ThemeSettings::get_global(self).active_theme } } @@ -46,20 +46,20 @@ pub struct ThemeFamily { pub id: String, pub name: SharedString, pub author: SharedString, - pub themes: Vec, + pub themes: Vec, pub scales: ColorScales, } impl ThemeFamily {} -pub struct ThemeVariant { +pub struct Theme { pub id: String, pub name: SharedString, pub appearance: Appearance, pub styles: ThemeStyles, } -impl ThemeVariant { +impl Theme { /// Returns the [`ThemeColors`] for the theme. #[inline(always)] pub fn players(&self) -> &PlayerColors { diff --git a/crates/theme2/src/themes/andromeda.rs b/crates/theme2/src/themes/andromeda.rs index b0400a8c4b584999b07ce6965c0f1fa5b5c1b395..10e546aea8b333cb48e31891e5c58044938a477b 100644 --- a/crates/theme2/src/themes/andromeda.rs +++ b/crates/theme2/src/themes/andromeda.rs @@ -2,7 +2,7 @@ use gpui::rgba; use crate::{ default_color_scales, Appearance, GitStatusColors, PlayerColor, PlayerColors, StatusColors, - SyntaxTheme, SystemColors, ThemeColors, ThemeFamily, ThemeStyles, ThemeVariant, + SyntaxTheme, SystemColors, Theme, ThemeColors, ThemeFamily, ThemeStyles, }; pub fn andromeda() -> ThemeFamily { @@ -11,7 +11,7 @@ pub fn andromeda() -> ThemeFamily { name: "Andromeda".into(), author: "Eliver Lara (EliverLara)".into(), themes: vec![ - ThemeVariant { + Theme { id: "3bfb3b6e-365a-4cd2-9a80-2d2c81434729".into(), name: "Andromeda".into(), appearance: Appearance::Dark, @@ -178,7 +178,7 @@ pub fn andromeda() -> ThemeFamily { }, }, }, - ThemeVariant { + Theme { id: "7bc92ac8-152c-46d5-b346-df68e4db2e7c".into(), name: "Andromeda Bordered".into(), appearance: Appearance::Dark, diff --git a/crates/theme2/src/themes/ayu.rs b/crates/theme2/src/themes/ayu.rs index a2c054ac28db9f717b6ebba9df8518560d1b28fc..c3503e23c73ca376dbe4f8b99c065517291aba2e 100644 --- a/crates/theme2/src/themes/ayu.rs +++ b/crates/theme2/src/themes/ayu.rs @@ -2,7 +2,7 @@ use gpui::rgba; use crate::{ default_color_scales, Appearance, GitStatusColors, PlayerColor, PlayerColors, StatusColors, - SyntaxTheme, SystemColors, ThemeColors, ThemeFamily, ThemeStyles, ThemeVariant, + SyntaxTheme, SystemColors, Theme, ThemeColors, ThemeFamily, ThemeStyles, }; pub fn ayu() -> ThemeFamily { @@ -11,7 +11,7 @@ pub fn ayu() -> ThemeFamily { name: "Ayu".into(), author: "dempfi (Ike Ku)".into(), themes: vec![ - ThemeVariant { + Theme { id: "733aeb9b-98fd-4492-984e-d71540daf72e".into(), name: "Ayu Light".into(), appearance: Appearance::Light, @@ -178,7 +178,7 @@ pub fn ayu() -> ThemeFamily { }, }, }, - ThemeVariant { + Theme { id: "50f68427-2e1d-4bf1-981a-d08c6b38e846".into(), name: "Ayu Mirage".into(), appearance: Appearance::Dark, @@ -345,7 +345,7 @@ pub fn ayu() -> ThemeFamily { }, }, }, - ThemeVariant { + Theme { id: "22d8dede-57da-46e1-946a-16876679b4d2".into(), name: "Ayu Dark".into(), appearance: Appearance::Dark, diff --git a/crates/theme2/src/themes/dracula.rs b/crates/theme2/src/themes/dracula.rs index 7318057c53aef8d098621f7520ee0e8e2e4cf578..d7648c8ffe6cfaa4435129d161ca60fdfbb68799 100644 --- a/crates/theme2/src/themes/dracula.rs +++ b/crates/theme2/src/themes/dracula.rs @@ -2,7 +2,7 @@ use gpui::rgba; use crate::{ default_color_scales, Appearance, GitStatusColors, PlayerColor, PlayerColors, StatusColors, - SyntaxTheme, SystemColors, ThemeColors, ThemeFamily, ThemeStyles, ThemeVariant, + SyntaxTheme, SystemColors, Theme, ThemeColors, ThemeFamily, ThemeStyles, }; pub fn dracula() -> ThemeFamily { @@ -10,7 +10,7 @@ pub fn dracula() -> ThemeFamily { id: "0abb0e55-f034-45d9-a84d-e880dfd65711".into(), name: "Dracula".into(), author: "Zeno Rocha".into(), - themes: vec![ThemeVariant { + themes: vec![Theme { id: "d20497ef-85be-4ea2-9070-a182d03aac73".into(), name: "Dracula".into(), appearance: Appearance::Dark, diff --git a/crates/theme2/src/themes/gruvbox.rs b/crates/theme2/src/themes/gruvbox.rs index 756a0b658be61dfaec2241dc3ce103f5a1d27082..dc276f88f2b5f5e0ff28f84ecada5025887bbe19 100644 --- a/crates/theme2/src/themes/gruvbox.rs +++ b/crates/theme2/src/themes/gruvbox.rs @@ -2,7 +2,7 @@ use gpui::rgba; use crate::{ default_color_scales, Appearance, GitStatusColors, PlayerColor, PlayerColors, StatusColors, - SyntaxTheme, SystemColors, ThemeColors, ThemeFamily, ThemeStyles, ThemeVariant, + SyntaxTheme, SystemColors, Theme, ThemeColors, ThemeFamily, ThemeStyles, }; pub fn gruvbox() -> ThemeFamily { @@ -11,7 +11,7 @@ pub fn gruvbox() -> ThemeFamily { name: "Gruvbox".into(), author: "morhetz".into(), themes: vec![ - ThemeVariant { + Theme { id: "0db938b2-2267-453b-af84-f82c5f3400e7".into(), name: "Gruvbox Dark Hard".into(), appearance: Appearance::Dark, @@ -178,7 +178,7 @@ pub fn gruvbox() -> ThemeFamily { }, }, }, - ThemeVariant { + Theme { id: "8e1a1896-ed0f-40be-b127-6c389eacc9f1".into(), name: "Gruvbox Dark Medium".into(), appearance: Appearance::Dark, @@ -345,7 +345,7 @@ pub fn gruvbox() -> ThemeFamily { }, }, }, - ThemeVariant { + Theme { id: "94410e6f-f4c4-4669-bb4d-5a20b4e4b1f3".into(), name: "Gruvbox Dark Soft".into(), appearance: Appearance::Dark, @@ -512,7 +512,7 @@ pub fn gruvbox() -> ThemeFamily { }, }, }, - ThemeVariant { + Theme { id: "e4a58582-478a-4934-ad73-135e23a0d66e".into(), name: "Gruvbox Light Hard".into(), appearance: Appearance::Light, @@ -679,7 +679,7 @@ pub fn gruvbox() -> ThemeFamily { }, }, }, - ThemeVariant { + Theme { id: "0e875280-93fa-4c76-8874-f858c7d985c1".into(), name: "Gruvbox Light Medium".into(), appearance: Appearance::Light, @@ -846,7 +846,7 @@ pub fn gruvbox() -> ThemeFamily { }, }, }, - ThemeVariant { + Theme { id: "914dbe6f-bc0f-4e6f-8d8c-5f4cabc1ca2d".into(), name: "Gruvbox Light Soft".into(), appearance: Appearance::Light, diff --git a/crates/theme2/src/themes/night_owl.rs b/crates/theme2/src/themes/night_owl.rs index ed727127bdee22a1d3cd6162f0bbcfe58e331bb5..7fab35f1c16cb5818f4cc5de25e5cb7540d89907 100644 --- a/crates/theme2/src/themes/night_owl.rs +++ b/crates/theme2/src/themes/night_owl.rs @@ -2,7 +2,7 @@ use gpui::rgba; use crate::{ default_color_scales, Appearance, GitStatusColors, PlayerColor, PlayerColors, StatusColors, - SyntaxTheme, SystemColors, ThemeColors, ThemeFamily, ThemeStyles, ThemeVariant, + SyntaxTheme, SystemColors, Theme, ThemeColors, ThemeFamily, ThemeStyles, }; pub fn night_owl() -> ThemeFamily { @@ -11,7 +11,7 @@ pub fn night_owl() -> ThemeFamily { name: "Night Owl".into(), author: "Sarah Drasner (sdras)".into(), themes: vec![ - ThemeVariant { + Theme { id: "e5de91ed-fc95-46fb-a60b-ebd0602d04c7".into(), name: "Night Owl".into(), appearance: Appearance::Dark, @@ -178,7 +178,7 @@ pub fn night_owl() -> ThemeFamily { }, }, }, - ThemeVariant { + Theme { id: "998fc053-40c1-4a32-a31f-a17c9c07949a".into(), name: "Night Owl Light".into(), appearance: Appearance::Light, diff --git a/crates/theme2/src/themes/nord.rs b/crates/theme2/src/themes/nord.rs index 25e6da2c5e8440b9cbc5a3b4ce8d5d32f1184f3c..4b1e30870c205848d93d0cc31a7f09d51c7a2835 100644 --- a/crates/theme2/src/themes/nord.rs +++ b/crates/theme2/src/themes/nord.rs @@ -2,7 +2,7 @@ use gpui::rgba; use crate::{ default_color_scales, Appearance, GitStatusColors, PlayerColor, PlayerColors, StatusColors, - SyntaxTheme, SystemColors, ThemeColors, ThemeFamily, ThemeStyles, ThemeVariant, + SyntaxTheme, SystemColors, Theme, ThemeColors, ThemeFamily, ThemeStyles, }; pub fn nord() -> ThemeFamily { @@ -10,7 +10,7 @@ pub fn nord() -> ThemeFamily { id: "3295b94b-731f-41a8-8d5e-ad02638f8e0d".into(), name: "Nord".into(), author: "Sven Greb (svengreb)".into(), - themes: vec![ThemeVariant { + themes: vec![Theme { id: "dfdfd9f6-bc57-46dd-b919-42b18df35bdd".into(), name: "Nord".into(), appearance: Appearance::Dark, diff --git a/crates/theme2/src/themes/notctis.rs b/crates/theme2/src/themes/notctis.rs index 70c57bac57bd2cb9144bf33c32f07ba8a1cf2ac6..4ec66ec09437ca82b9b08556dfad2bb7f4101e57 100644 --- a/crates/theme2/src/themes/notctis.rs +++ b/crates/theme2/src/themes/notctis.rs @@ -2,7 +2,7 @@ use gpui::rgba; use crate::{ default_color_scales, Appearance, GitStatusColors, PlayerColor, PlayerColors, StatusColors, - SyntaxTheme, SystemColors, ThemeColors, ThemeFamily, ThemeStyles, ThemeVariant, + SyntaxTheme, SystemColors, Theme, ThemeColors, ThemeFamily, ThemeStyles, }; pub fn notctis() -> ThemeFamily { @@ -11,7 +11,7 @@ pub fn notctis() -> ThemeFamily { name: "Notctis".into(), author: "Liviu Schera (liviuschera)".into(), themes: vec![ - ThemeVariant { + Theme { id: "2dc5fee8-30ff-4a50-bfae-c13bd19c9f89".into(), name: "Noctis Azureus".into(), appearance: Appearance::Dark, @@ -178,7 +178,7 @@ pub fn notctis() -> ThemeFamily { }, }, }, - ThemeVariant { + Theme { id: "ba4f5a34-987a-4e2c-939c-7f1b02d0e432".into(), name: "Noctis Bordo".into(), appearance: Appearance::Dark, @@ -345,7 +345,7 @@ pub fn notctis() -> ThemeFamily { }, }, }, - ThemeVariant { + Theme { id: "a2e4f327-82e8-41c1-a66f-bc7f27419c2e".into(), name: "Noctus Hibernus".into(), appearance: Appearance::Light, @@ -512,7 +512,7 @@ pub fn notctis() -> ThemeFamily { }, }, }, - ThemeVariant { + Theme { id: "2fde44fb-e5b2-4cc2-962f-f1c77a4eb12a".into(), name: "Noctis Lilac".into(), appearance: Appearance::Dark, @@ -679,7 +679,7 @@ pub fn notctis() -> ThemeFamily { }, }, }, - ThemeVariant { + Theme { id: "2b89f218-c238-4905-9578-674d6995d2e0".into(), name: "Noctis Lux".into(), appearance: Appearance::Light, @@ -846,7 +846,7 @@ pub fn notctis() -> ThemeFamily { }, }, }, - ThemeVariant { + Theme { id: "f88e2cd7-2415-4118-a638-5cfd3132ecf8".into(), name: "Noctis Minimus".into(), appearance: Appearance::Dark, @@ -1013,7 +1013,7 @@ pub fn notctis() -> ThemeFamily { }, }, }, - ThemeVariant { + Theme { id: "c4d43fc2-6166-47b7-8c5c-dd24afd4b735".into(), name: "Noctis".into(), appearance: Appearance::Dark, @@ -1180,7 +1180,7 @@ pub fn notctis() -> ThemeFamily { }, }, }, - ThemeVariant { + Theme { id: "7253a515-c612-403c-89de-5b62dc5cbac7".into(), name: "Noctis Obscuro".into(), appearance: Appearance::Dark, @@ -1347,7 +1347,7 @@ pub fn notctis() -> ThemeFamily { }, }, }, - ThemeVariant { + Theme { id: "b0f2d7b8-ac5f-466f-9bbf-e7cac242149c".into(), name: "Noctis Sereno".into(), appearance: Appearance::Dark, @@ -1514,7 +1514,7 @@ pub fn notctis() -> ThemeFamily { }, }, }, - ThemeVariant { + Theme { id: "331ce3fd-8faf-4a46-ad89-2c678abc4cd3".into(), name: "Noctis Uva".into(), appearance: Appearance::Dark, @@ -1681,7 +1681,7 @@ pub fn notctis() -> ThemeFamily { }, }, }, - ThemeVariant { + Theme { id: "209964f1-6a61-4e40-a605-be245555c493".into(), name: "Noctis Viola".into(), appearance: Appearance::Dark, diff --git a/crates/theme2/src/themes/palenight.rs b/crates/theme2/src/themes/palenight.rs index 8ad0a86eb86dd156d40fdeab8f114ee523d89917..bd8f9bb560a41738ab3cbf8a87e1435ac6fa24a2 100644 --- a/crates/theme2/src/themes/palenight.rs +++ b/crates/theme2/src/themes/palenight.rs @@ -2,7 +2,7 @@ use gpui::rgba; use crate::{ default_color_scales, Appearance, GitStatusColors, PlayerColor, PlayerColors, StatusColors, - SyntaxTheme, SystemColors, ThemeColors, ThemeFamily, ThemeStyles, ThemeVariant, + SyntaxTheme, SystemColors, Theme, ThemeColors, ThemeFamily, ThemeStyles, }; pub fn palenight() -> ThemeFamily { @@ -11,7 +11,7 @@ pub fn palenight() -> ThemeFamily { name: "Palenight".into(), author: "Olaolu Olawuyi (whizkydee)".into(), themes: vec![ - ThemeVariant { + Theme { id: "39fdf216-2c76-4b3d-b368-7c31f479d524".into(), name: "Palenight".into(), appearance: Appearance::Dark, @@ -178,7 +178,7 @@ pub fn palenight() -> ThemeFamily { }, }, }, - ThemeVariant { + Theme { id: "5ff8120f-37e9-4ad3-8bd0-c3e449ff1aa1".into(), name: "Palenight Operator".into(), appearance: Appearance::Dark, @@ -345,7 +345,7 @@ pub fn palenight() -> ThemeFamily { }, }, }, - ThemeVariant { + Theme { id: "cff26efb-72f8-4496-b33b-991080a47f1c".into(), name: "Palenight (Mild Contrast)".into(), appearance: Appearance::Dark, diff --git a/crates/theme2/src/themes/rose_pine.rs b/crates/theme2/src/themes/rose_pine.rs index d022d645cf3798259877d648021446bc3cdb9d9c..4c551e4ad7765c6b301da5066e4e07d290856821 100644 --- a/crates/theme2/src/themes/rose_pine.rs +++ b/crates/theme2/src/themes/rose_pine.rs @@ -2,7 +2,7 @@ use gpui::rgba; use crate::{ default_color_scales, Appearance, GitStatusColors, PlayerColor, PlayerColors, StatusColors, - SyntaxTheme, SystemColors, ThemeColors, ThemeFamily, ThemeStyles, ThemeVariant, + SyntaxTheme, SystemColors, Theme, ThemeColors, ThemeFamily, ThemeStyles, }; pub fn rose_pine() -> ThemeFamily { @@ -11,7 +11,7 @@ pub fn rose_pine() -> ThemeFamily { name: "Rose Pine".into(), author: "Rosé Pine".into(), themes: vec![ - ThemeVariant { + Theme { id: "80a8f5dd-2ab5-4ee7-9b25-a60c8513234e".into(), name: "Rose Pine".into(), appearance: Appearance::Dark, @@ -178,7 +178,7 @@ pub fn rose_pine() -> ThemeFamily { }, }, }, - ThemeVariant { + Theme { id: "fe9e3c9e-954e-4f8e-849e-451ba5f6ceca".into(), name: "Rose Moon".into(), appearance: Appearance::Dark, @@ -345,7 +345,7 @@ pub fn rose_pine() -> ThemeFamily { }, }, }, - ThemeVariant { + Theme { id: "00cc7f69-9658-443e-b643-1c8dbffa047d".into(), name: "Rose Pine Dawn".into(), appearance: Appearance::Light, diff --git a/crates/theme2/src/themes/solarized.rs b/crates/theme2/src/themes/solarized.rs index cca669479a406c02ceefeedd187e0416e7290fae..4198553337753179c7f42fec6e248b14fb4f18c6 100644 --- a/crates/theme2/src/themes/solarized.rs +++ b/crates/theme2/src/themes/solarized.rs @@ -2,7 +2,7 @@ use gpui::rgba; use crate::{ default_color_scales, Appearance, GitStatusColors, PlayerColor, PlayerColors, StatusColors, - SyntaxTheme, SystemColors, ThemeColors, ThemeFamily, ThemeStyles, ThemeVariant, + SyntaxTheme, SystemColors, Theme, ThemeColors, ThemeFamily, ThemeStyles, }; pub fn solarized() -> ThemeFamily { @@ -11,7 +11,7 @@ pub fn solarized() -> ThemeFamily { name: "Solarized".into(), author: "Ethan Schoonover (altercation)".into(), themes: vec![ - ThemeVariant { + Theme { id: "265f93c5-c8e7-4962-b083-8550f4b5c2ff".into(), name: "Solarized Dark".into(), appearance: Appearance::Dark, @@ -178,7 +178,7 @@ pub fn solarized() -> ThemeFamily { }, }, }, - ThemeVariant { + Theme { id: "40e2070d-5846-4182-9dc9-bf56badf019f".into(), name: "Solarized Light".into(), appearance: Appearance::Light, diff --git a/crates/theme2/src/themes/synthwave_84.rs b/crates/theme2/src/themes/synthwave_84.rs index 8920037253c510a526c12b278b0f54de5b35fe6f..78e71133658bc7e35821856b6385badaf478130a 100644 --- a/crates/theme2/src/themes/synthwave_84.rs +++ b/crates/theme2/src/themes/synthwave_84.rs @@ -2,7 +2,7 @@ use gpui::rgba; use crate::{ default_color_scales, Appearance, GitStatusColors, PlayerColor, PlayerColors, StatusColors, - SyntaxTheme, SystemColors, ThemeColors, ThemeFamily, ThemeStyles, ThemeVariant, + SyntaxTheme, SystemColors, Theme, ThemeColors, ThemeFamily, ThemeStyles, }; pub fn synthwave_84() -> ThemeFamily { @@ -10,7 +10,7 @@ pub fn synthwave_84() -> ThemeFamily { id: "161a14a0-533c-4df1-b909-2bac37ac807d".into(), name: "Synthwave 84".into(), author: "Robb Owen (robb0wen)".into(), - themes: vec![ThemeVariant { + themes: vec![Theme { id: "7a7102b7-8778-4c24-ba79-7407857b4f8c".into(), name: "Synthwave 84".into(), appearance: Appearance::Dark, diff --git a/crates/theme_importer/src/theme_printer.rs b/crates/theme_importer/src/theme_printer.rs index f638694be8dea07a76ee797a672244d62fd427f0..017893f400698cc5e3b6f2f05a9dbd5a1e112dac 100644 --- a/crates/theme_importer/src/theme_printer.rs +++ b/crates/theme_importer/src/theme_printer.rs @@ -3,7 +3,7 @@ use std::fmt::{self, Debug}; use gpui::{Hsla, Rgba}; use theme::{ Appearance, GitStatusColors, PlayerColor, PlayerColors, StatusColors, SyntaxTheme, - SystemColors, ThemeColors, ThemeFamily, ThemeStyles, ThemeVariant, + SystemColors, Theme, ThemeColors, ThemeFamily, ThemeStyles, }; struct RawSyntaxPrinter<'a>(&'a str); @@ -68,7 +68,7 @@ impl Debug for ThemeFamilyPrinter { } } -pub struct ThemeVariantPrinter<'a>(&'a ThemeVariant); +pub struct ThemeVariantPrinter<'a>(&'a Theme); impl<'a> Debug for ThemeVariantPrinter<'a> { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { diff --git a/crates/theme_importer/src/vscode.rs b/crates/theme_importer/src/vscode.rs index f63766b6a50c8e8db957e0e4b0a833c5f7e9c1e6..436c73b3d4053158c678883bfa3a4dc914016e16 100644 --- a/crates/theme_importer/src/vscode.rs +++ b/crates/theme_importer/src/vscode.rs @@ -2,8 +2,8 @@ use anyhow::Result; use gpui::{Hsla, Refineable, Rgba}; use serde::Deserialize; use theme::{ - Appearance, GitStatusColors, PlayerColors, StatusColors, SyntaxTheme, SystemColors, - ThemeColors, ThemeColorsRefinement, ThemeStyles, ThemeVariant, + Appearance, GitStatusColors, PlayerColors, StatusColors, SyntaxTheme, SystemColors, Theme, + ThemeColors, ThemeColorsRefinement, ThemeStyles, }; use crate::util::Traverse; @@ -433,7 +433,7 @@ impl VsCodeThemeConverter { } } - pub fn convert(self) -> Result { + pub fn convert(self) -> Result { let appearance = self.theme_metadata.appearance.into(); let mut theme_colors = match appearance { @@ -569,7 +569,7 @@ impl VsCodeThemeConverter { theme_colors.refine(&theme_colors_refinements); - Ok(ThemeVariant { + Ok(Theme { id: uuid::Uuid::new_v4().to_string(), name: self.theme_metadata.name.into(), appearance, diff --git a/crates/workspace2/src/item.rs b/crates/workspace2/src/item.rs index e933f373d4a06987ac788c47c0d5120f80b88629..1a7f30646d7ca3bc49520c65e284eaafbe6a92ef 100644 --- a/crates/workspace2/src/item.rs +++ b/crates/workspace2/src/item.rs @@ -32,7 +32,7 @@ use std::{ }, time::Duration, }; -use theme2::ThemeVariant; +use theme2::Theme; #[derive(Deserialize)] pub struct ItemSettings { @@ -184,7 +184,7 @@ pub trait Item: Render + EventEmitter { ToolbarItemLocation::Hidden } - fn breadcrumbs(&self, _theme: &ThemeVariant, _cx: &AppContext) -> Option> { + fn breadcrumbs(&self, _theme: &Theme, _cx: &AppContext) -> Option> { None } @@ -270,7 +270,7 @@ pub trait ItemHandle: 'static + Send { ) -> gpui::Subscription; fn to_searchable_item_handle(&self, cx: &AppContext) -> Option>; fn breadcrumb_location(&self, cx: &AppContext) -> ToolbarItemLocation; - fn breadcrumbs(&self, theme: &ThemeVariant, cx: &AppContext) -> Option>; + fn breadcrumbs(&self, theme: &Theme, cx: &AppContext) -> Option>; fn serialized_item_kind(&self) -> Option<&'static str>; fn show_toolbar(&self, cx: &AppContext) -> bool; fn pixel_position_of_cursor(&self, cx: &AppContext) -> Option>; @@ -603,7 +603,7 @@ impl ItemHandle for View { self.read(cx).breadcrumb_location() } - fn breadcrumbs(&self, theme: &ThemeVariant, cx: &AppContext) -> Option> { + fn breadcrumbs(&self, theme: &Theme, cx: &AppContext) -> Option> { self.read(cx).breadcrumbs(theme, cx) }