theme2: Add Rosé Pine themes

Marshall Bowers created

Change summary

crates/theme2/src/registry.rs         |  10 
crates/theme2/src/themes/mod.rs       |   2 
crates/theme2/src/themes/rose_pine.rs | 279 ++++++++++++++++++++++++++++
crates/theme_converter/src/main.rs    |  17 +
4 files changed, 304 insertions(+), 4 deletions(-)

Detailed changes

crates/theme2/src/registry.rs 🔗

@@ -1,5 +1,5 @@
 use crate::{
-    themes::{one_dark, sandcastle},
+    themes::{one_dark, rose_pine, rose_pine_dawn, rose_pine_moon, sandcastle},
     Theme, ThemeMetadata,
 };
 use anyhow::{anyhow, Result};
@@ -40,7 +40,13 @@ impl Default for ThemeRegistry {
             themes: HashMap::default(),
         };
 
-        this.insert_themes([one_dark(), sandcastle()]);
+        this.insert_themes([
+            one_dark(),
+            rose_pine(),
+            rose_pine_dawn(),
+            rose_pine_moon(),
+            sandcastle(),
+        ]);
 
         this
     }

crates/theme2/src/themes/rose_pine.rs 🔗

@@ -0,0 +1,279 @@
+use gpui2::rgba;
+
+use crate::{PlayerTheme, SyntaxTheme, Theme, ThemeMetadata};
+
+pub fn rose_pine() -> Theme {
+    Theme {
+        metadata: ThemeMetadata {
+            name: "Rosé Pine".into(),
+            is_light: false,
+        },
+        transparent: rgba(0x00000000).into(),
+        mac_os_traffic_light_red: rgba(0xec695eff).into(),
+        mac_os_traffic_light_yellow: rgba(0xf4bf4eff).into(),
+        mac_os_traffic_light_green: rgba(0x61c553ff).into(),
+        border: rgba(0x423f55ff).into(),
+        border_variant: rgba(0x423f55ff).into(),
+        border_focused: rgba(0x435255ff).into(),
+        border_transparent: rgba(0x00000000).into(),
+        elevated_surface: rgba(0x292738ff).into(),
+        surface: rgba(0x1c1b2aff).into(),
+        background: rgba(0x292738ff).into(),
+        filled_element: rgba(0x292738ff).into(),
+        filled_element_hover: rgba(0xffffff1e).into(),
+        filled_element_active: rgba(0xffffff28).into(),
+        filled_element_selected: rgba(0x2f3639ff).into(),
+        filled_element_disabled: rgba(0x00000000).into(),
+        ghost_element: rgba(0x00000000).into(),
+        ghost_element_hover: rgba(0xffffff14).into(),
+        ghost_element_active: rgba(0xffffff1e).into(),
+        ghost_element_selected: rgba(0x2f3639ff).into(),
+        ghost_element_disabled: rgba(0x00000000).into(),
+        text: rgba(0xe0def4ff).into(),
+        text_muted: rgba(0x74708dff).into(),
+        text_placeholder: rgba(0xea6e92ff).into(),
+        text_disabled: rgba(0x2f2b43ff).into(),
+        text_accent: rgba(0x9bced6ff).into(),
+        icon_muted: rgba(0x74708dff).into(),
+        syntax: SyntaxTheme {
+            comment: rgba(0x6e6a86ff).into(),
+            string: rgba(0xf5c177ff).into(),
+            function: rgba(0xebbcbaff).into(),
+            keyword: rgba(0x30738fff).into(),
+            highlights: Vec::new(),
+        },
+        status_bar: rgba(0x292738ff).into(),
+        title_bar: rgba(0x292738ff).into(),
+        toolbar: rgba(0x191724ff).into(),
+        tab_bar: rgba(0x1c1b2aff).into(),
+        editor: rgba(0x191724ff).into(),
+        editor_subheader: rgba(0x1c1b2aff).into(),
+        editor_active_line: rgba(0x1c1b2aff).into(),
+        terminal: rgba(0x191724ff).into(),
+        image_fallback_background: rgba(0x292738ff).into(),
+        git_created: rgba(0x5cc1a3ff).into(),
+        git_modified: rgba(0x9bced6ff).into(),
+        git_deleted: rgba(0xea6e92ff).into(),
+        git_conflict: rgba(0xf5c177ff).into(),
+        git_ignored: rgba(0x2f2b43ff).into(),
+        git_renamed: rgba(0xf5c177ff).into(),
+        players: [
+            PlayerTheme {
+                cursor: rgba(0x9bced6ff).into(),
+                selection: rgba(0x9bced63d).into(),
+            },
+            PlayerTheme {
+                cursor: rgba(0x5cc1a3ff).into(),
+                selection: rgba(0x5cc1a33d).into(),
+            },
+            PlayerTheme {
+                cursor: rgba(0x9d7591ff).into(),
+                selection: rgba(0x9d75913d).into(),
+            },
+            PlayerTheme {
+                cursor: rgba(0xc4a7e6ff).into(),
+                selection: rgba(0xc4a7e63d).into(),
+            },
+            PlayerTheme {
+                cursor: rgba(0xc4a7e6ff).into(),
+                selection: rgba(0xc4a7e63d).into(),
+            },
+            PlayerTheme {
+                cursor: rgba(0x31738fff).into(),
+                selection: rgba(0x31738f3d).into(),
+            },
+            PlayerTheme {
+                cursor: rgba(0xea6e92ff).into(),
+                selection: rgba(0xea6e923d).into(),
+            },
+            PlayerTheme {
+                cursor: rgba(0xf5c177ff).into(),
+                selection: rgba(0xf5c1773d).into(),
+            },
+        ],
+    }
+}
+
+pub fn rose_pine_dawn() -> Theme {
+    Theme {
+        metadata: ThemeMetadata {
+            name: "Rosé Pine Dawn".into(),
+            is_light: true,
+        },
+        transparent: rgba(0x00000000).into(),
+        mac_os_traffic_light_red: rgba(0xec695eff).into(),
+        mac_os_traffic_light_yellow: rgba(0xf4bf4eff).into(),
+        mac_os_traffic_light_green: rgba(0x61c553ff).into(),
+        border: rgba(0xdcd6d5ff).into(),
+        border_variant: rgba(0xdcd6d5ff).into(),
+        border_focused: rgba(0xc3d7dbff).into(),
+        border_transparent: rgba(0x00000000).into(),
+        elevated_surface: rgba(0xdcd8d8ff).into(),
+        surface: rgba(0xfef9f2ff).into(),
+        background: rgba(0xdcd8d8ff).into(),
+        filled_element: rgba(0xdcd8d8ff).into(),
+        filled_element_hover: rgba(0xffffff1e).into(),
+        filled_element_active: rgba(0xffffff28).into(),
+        filled_element_selected: rgba(0xdde9ebff).into(),
+        filled_element_disabled: rgba(0x00000000).into(),
+        ghost_element: rgba(0x00000000).into(),
+        ghost_element_hover: rgba(0xffffff14).into(),
+        ghost_element_active: rgba(0xffffff1e).into(),
+        ghost_element_selected: rgba(0xdde9ebff).into(),
+        ghost_element_disabled: rgba(0x00000000).into(),
+        text: rgba(0x575279ff).into(),
+        text_muted: rgba(0x706c8cff).into(),
+        text_placeholder: rgba(0xb4647aff).into(),
+        text_disabled: rgba(0x938fa3ff).into(),
+        text_accent: rgba(0x57949fff).into(),
+        icon_muted: rgba(0x706c8cff).into(),
+        syntax: SyntaxTheme {
+            comment: rgba(0x9893a5ff).into(),
+            string: rgba(0xea9d34ff).into(),
+            function: rgba(0xd7827dff).into(),
+            keyword: rgba(0x276983ff).into(),
+            highlights: Vec::new(),
+        },
+        status_bar: rgba(0xdcd8d8ff).into(),
+        title_bar: rgba(0xdcd8d8ff).into(),
+        toolbar: rgba(0xfaf4edff).into(),
+        tab_bar: rgba(0xfef9f2ff).into(),
+        editor: rgba(0xfaf4edff).into(),
+        editor_subheader: rgba(0xfef9f2ff).into(),
+        editor_active_line: rgba(0xfef9f2ff).into(),
+        terminal: rgba(0xfaf4edff).into(),
+        image_fallback_background: rgba(0xdcd8d8ff).into(),
+        git_created: rgba(0x3daa8eff).into(),
+        git_modified: rgba(0x57949fff).into(),
+        git_deleted: rgba(0xb4647aff).into(),
+        git_conflict: rgba(0xe99d35ff).into(),
+        git_ignored: rgba(0x938fa3ff).into(),
+        git_renamed: rgba(0xe99d35ff).into(),
+        players: [
+            PlayerTheme {
+                cursor: rgba(0x57949fff).into(),
+                selection: rgba(0x57949f3d).into(),
+            },
+            PlayerTheme {
+                cursor: rgba(0x3daa8eff).into(),
+                selection: rgba(0x3daa8e3d).into(),
+            },
+            PlayerTheme {
+                cursor: rgba(0x7c697fff).into(),
+                selection: rgba(0x7c697f3d).into(),
+            },
+            PlayerTheme {
+                cursor: rgba(0x9079a9ff).into(),
+                selection: rgba(0x9079a93d).into(),
+            },
+            PlayerTheme {
+                cursor: rgba(0x9079a9ff).into(),
+                selection: rgba(0x9079a93d).into(),
+            },
+            PlayerTheme {
+                cursor: rgba(0x296983ff).into(),
+                selection: rgba(0x2969833d).into(),
+            },
+            PlayerTheme {
+                cursor: rgba(0xb4647aff).into(),
+                selection: rgba(0xb4647a3d).into(),
+            },
+            PlayerTheme {
+                cursor: rgba(0xe99d35ff).into(),
+                selection: rgba(0xe99d353d).into(),
+            },
+        ],
+    }
+}
+
+pub fn rose_pine_moon() -> Theme {
+    Theme {
+        metadata: ThemeMetadata {
+            name: "Rosé Pine Moon".into(),
+            is_light: false,
+        },
+        transparent: rgba(0x00000000).into(),
+        mac_os_traffic_light_red: rgba(0xec695eff).into(),
+        mac_os_traffic_light_yellow: rgba(0xf4bf4eff).into(),
+        mac_os_traffic_light_green: rgba(0x61c553ff).into(),
+        border: rgba(0x504c68ff).into(),
+        border_variant: rgba(0x504c68ff).into(),
+        border_focused: rgba(0x435255ff).into(),
+        border_transparent: rgba(0x00000000).into(),
+        elevated_surface: rgba(0x38354eff).into(),
+        surface: rgba(0x28253cff).into(),
+        background: rgba(0x38354eff).into(),
+        filled_element: rgba(0x38354eff).into(),
+        filled_element_hover: rgba(0xffffff1e).into(),
+        filled_element_active: rgba(0xffffff28).into(),
+        filled_element_selected: rgba(0x2f3639ff).into(),
+        filled_element_disabled: rgba(0x00000000).into(),
+        ghost_element: rgba(0x00000000).into(),
+        ghost_element_hover: rgba(0xffffff14).into(),
+        ghost_element_active: rgba(0xffffff1e).into(),
+        ghost_element_selected: rgba(0x2f3639ff).into(),
+        ghost_element_disabled: rgba(0x00000000).into(),
+        text: rgba(0xe0def4ff).into(),
+        text_muted: rgba(0x85819eff).into(),
+        text_placeholder: rgba(0xea6e92ff).into(),
+        text_disabled: rgba(0x605d7aff).into(),
+        text_accent: rgba(0x9bced6ff).into(),
+        icon_muted: rgba(0x85819eff).into(),
+        syntax: SyntaxTheme {
+            comment: rgba(0x6e6a86ff).into(),
+            string: rgba(0xf5c177ff).into(),
+            function: rgba(0xea9a97ff).into(),
+            keyword: rgba(0x3d8fb0ff).into(),
+            highlights: Vec::new(),
+        },
+        status_bar: rgba(0x38354eff).into(),
+        title_bar: rgba(0x38354eff).into(),
+        toolbar: rgba(0x232136ff).into(),
+        tab_bar: rgba(0x28253cff).into(),
+        editor: rgba(0x232136ff).into(),
+        editor_subheader: rgba(0x28253cff).into(),
+        editor_active_line: rgba(0x28253cff).into(),
+        terminal: rgba(0x232136ff).into(),
+        image_fallback_background: rgba(0x38354eff).into(),
+        git_created: rgba(0x5cc1a3ff).into(),
+        git_modified: rgba(0x9bced6ff).into(),
+        git_deleted: rgba(0xea6e92ff).into(),
+        git_conflict: rgba(0xf5c177ff).into(),
+        git_ignored: rgba(0x605d7aff).into(),
+        git_renamed: rgba(0xf5c177ff).into(),
+        players: [
+            PlayerTheme {
+                cursor: rgba(0x9bced6ff).into(),
+                selection: rgba(0x9bced63d).into(),
+            },
+            PlayerTheme {
+                cursor: rgba(0x5cc1a3ff).into(),
+                selection: rgba(0x5cc1a33d).into(),
+            },
+            PlayerTheme {
+                cursor: rgba(0xa683a0ff).into(),
+                selection: rgba(0xa683a03d).into(),
+            },
+            PlayerTheme {
+                cursor: rgba(0xc4a7e6ff).into(),
+                selection: rgba(0xc4a7e63d).into(),
+            },
+            PlayerTheme {
+                cursor: rgba(0xc4a7e6ff).into(),
+                selection: rgba(0xc4a7e63d).into(),
+            },
+            PlayerTheme {
+                cursor: rgba(0x3e8fb0ff).into(),
+                selection: rgba(0x3e8fb03d).into(),
+            },
+            PlayerTheme {
+                cursor: rgba(0xea6e92ff).into(),
+                selection: rgba(0xea6e923d).into(),
+            },
+            PlayerTheme {
+                cursor: rgba(0xf5c177ff).into(),
+                selection: rgba(0xf5c1773d).into(),
+            },
+        ],
+    }
+}

crates/theme_converter/src/main.rs 🔗

@@ -10,7 +10,7 @@ use rust_embed::RustEmbed;
 use serde::de::Visitor;
 use serde::{Deserialize, Deserializer};
 use simplelog::SimpleLogger;
-use theme2::{PlayerTheme, SyntaxTheme};
+use theme2::{PlayerTheme, SyntaxTheme, ThemeMetadata};
 
 #[derive(Parser)]
 #[command(author, version, about, long_about = None)]
@@ -368,6 +368,7 @@ pub struct ThemePrinter(theme2::Theme);
 impl std::fmt::Debug for ThemePrinter {
     fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
         f.debug_struct("Theme")
+            .field("metadata", &ThemeMetadataPrinter(self.0.metadata.clone()))
             .field("transparent", &self.0.transparent.to_rgb().to_hex())
             .field(
                 "mac_os_traffic_light_red",
@@ -462,7 +463,18 @@ impl std::fmt::Debug for ThemePrinter {
             .field("git_conflict", &self.0.git_conflict.to_rgb().to_hex())
             .field("git_ignored", &self.0.git_ignored.to_rgb().to_hex())
             .field("git_renamed", &self.0.git_renamed.to_rgb().to_hex())
-            .field("player", &self.0.players.map(PlayerThemePrinter))
+            .field("players", &self.0.players.map(PlayerThemePrinter))
+            .finish()
+    }
+}
+
+pub struct ThemeMetadataPrinter(ThemeMetadata);
+
+impl std::fmt::Debug for ThemeMetadataPrinter {
+    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
+        f.debug_struct("ThemeMetadata")
+            .field("name", &self.0.name)
+            .field("is_light", &self.0.is_light)
             .finish()
     }
 }
@@ -476,6 +488,7 @@ impl std::fmt::Debug for SyntaxThemePrinter {
             .field("string", &self.0.string.to_rgb().to_hex())
             .field("function", &self.0.function.to_rgb().to_hex())
             .field("keyword", &self.0.keyword.to_rgb().to_hex())
+            .field("highlights", &self.0.highlights)
             .finish()
     }
 }