History

theme2: Add Rosé Pine themes

Marshall Bowers committed 3 years ago

Commit c8a86c21 parent cee81754 files · +304 −4Browse files

Unified · Split

4 files
  1. crates/theme2/src/registry.rs +8 −2
  2. crates/theme2/src/themes/mod.rs +2 −0
  3. crates/theme2/src/themes/rose_pine.rs +279 −0
  4. crates/theme_converter/src/main.rs +15 −2
crates/theme2/src/registry.rs+8−2
@@ -1,5 +1,5 @@
11 use crate::{
2− themes::{one_dark, sandcastle},
2+ themes::{one_dark, rose_pine, rose_pine_dawn, rose_pine_moon, sandcastle},
33 Theme, ThemeMetadata,
44 };
55 use anyhow::{anyhow, Result};
@@ -40,7 +40,13 @@ impl Default for ThemeRegistry { · 34 unmodified lines
4040 themes: HashMap::default(),
4141 };
4242
43− this.insert_themes([one_dark(), sandcastle()]);
43+ this.insert_themes([
44+ one_dark(),
45+ rose_pine(),
46+ rose_pine_dawn(),
47+ rose_pine_moon(),
48+ sandcastle(),
49+ ]);
4450
4551 this
4652 }
crates/theme2/src/themes/mod.rs+2−0
@@ -1,5 +1,7 @@
11 mod one_dark;
2+mod rose_pine;
23 mod sandcastle;
34
45 pub use one_dark::*;
6+pub use rose_pine::*;
57 pub use sandcastle::*;
crates/theme2/src/themes/rose_pine.rs+279−0
@@ -0,0 +1,279 @@
1+use gpui2::rgba;
2+
3+use crate::{PlayerTheme, SyntaxTheme, Theme, ThemeMetadata};
4+
5+pub fn rose_pine() -> Theme {
6+ Theme {
7+ metadata: ThemeMetadata {
8+ name: "Rosé Pine".into(),
9+ is_light: false,
10+ },
11+ transparent: rgba(0x00000000).into(),
12+ mac_os_traffic_light_red: rgba(0xec695eff).into(),
13+ mac_os_traffic_light_yellow: rgba(0xf4bf4eff).into(),
14+ mac_os_traffic_light_green: rgba(0x61c553ff).into(),
15+ border: rgba(0x423f55ff).into(),
16+ border_variant: rgba(0x423f55ff).into(),
17+ border_focused: rgba(0x435255ff).into(),
18+ border_transparent: rgba(0x00000000).into(),
19+ elevated_surface: rgba(0x292738ff).into(),
20+ surface: rgba(0x1c1b2aff).into(),
21+ background: rgba(0x292738ff).into(),
22+ filled_element: rgba(0x292738ff).into(),
23+ filled_element_hover: rgba(0xffffff1e).into(),
24+ filled_element_active: rgba(0xffffff28).into(),
25+ filled_element_selected: rgba(0x2f3639ff).into(),
26+ filled_element_disabled: rgba(0x00000000).into(),
27+ ghost_element: rgba(0x00000000).into(),
28+ ghost_element_hover: rgba(0xffffff14).into(),
29+ ghost_element_active: rgba(0xffffff1e).into(),
30+ ghost_element_selected: rgba(0x2f3639ff).into(),
31+ ghost_element_disabled: rgba(0x00000000).into(),
32+ text: rgba(0xe0def4ff).into(),
33+ text_muted: rgba(0x74708dff).into(),
34+ text_placeholder: rgba(0xea6e92ff).into(),
35+ text_disabled: rgba(0x2f2b43ff).into(),
36+ text_accent: rgba(0x9bced6ff).into(),
37+ icon_muted: rgba(0x74708dff).into(),
38+ syntax: SyntaxTheme {
39+ comment: rgba(0x6e6a86ff).into(),
40+ string: rgba(0xf5c177ff).into(),
41+ function: rgba(0xebbcbaff).into(),
42+ keyword: rgba(0x30738fff).into(),
43+ highlights: Vec::new(),
44+ },
45+ status_bar: rgba(0x292738ff).into(),
46+ title_bar: rgba(0x292738ff).into(),
47+ toolbar: rgba(0x191724ff).into(),
48+ tab_bar: rgba(0x1c1b2aff).into(),
49+ editor: rgba(0x191724ff).into(),
50+ editor_subheader: rgba(0x1c1b2aff).into(),
51+ editor_active_line: rgba(0x1c1b2aff).into(),
52+ terminal: rgba(0x191724ff).into(),
53+ image_fallback_background: rgba(0x292738ff).into(),
54+ git_created: rgba(0x5cc1a3ff).into(),
55+ git_modified: rgba(0x9bced6ff).into(),
56+ git_deleted: rgba(0xea6e92ff).into(),
57+ git_conflict: rgba(0xf5c177ff).into(),
58+ git_ignored: rgba(0x2f2b43ff).into(),
59+ git_renamed: rgba(0xf5c177ff).into(),
60+ players: [
61+ PlayerTheme {
62+ cursor: rgba(0x9bced6ff).into(),
63+ selection: rgba(0x9bced63d).into(),
64+ },
65+ PlayerTheme {
66+ cursor: rgba(0x5cc1a3ff).into(),
67+ selection: rgba(0x5cc1a33d).into(),
68+ },
69+ PlayerTheme {
70+ cursor: rgba(0x9d7591ff).into(),
71+ selection: rgba(0x9d75913d).into(),
72+ },
73+ PlayerTheme {
74+ cursor: rgba(0xc4a7e6ff).into(),
75+ selection: rgba(0xc4a7e63d).into(),
76+ },
77+ PlayerTheme {
78+ cursor: rgba(0xc4a7e6ff).into(),
79+ selection: rgba(0xc4a7e63d).into(),
80+ },
81+ PlayerTheme {
82+ cursor: rgba(0x31738fff).into(),
83+ selection: rgba(0x31738f3d).into(),
84+ },
85+ PlayerTheme {
86+ cursor: rgba(0xea6e92ff).into(),
87+ selection: rgba(0xea6e923d).into(),
88+ },
89+ PlayerTheme {
90+ cursor: rgba(0xf5c177ff).into(),
91+ selection: rgba(0xf5c1773d).into(),
92+ },
93+ ],
94+ }
95+}
96+
97+pub fn rose_pine_dawn() -> Theme {
98+ Theme {
99+ metadata: ThemeMetadata {
100+ name: "Rosé Pine Dawn".into(),
101+ is_light: true,
102+ },
103+ transparent: rgba(0x00000000).into(),
104+ mac_os_traffic_light_red: rgba(0xec695eff).into(),
105+ mac_os_traffic_light_yellow: rgba(0xf4bf4eff).into(),
106+ mac_os_traffic_light_green: rgba(0x61c553ff).into(),
107+ border: rgba(0xdcd6d5ff).into(),
108+ border_variant: rgba(0xdcd6d5ff).into(),
109+ border_focused: rgba(0xc3d7dbff).into(),
110+ border_transparent: rgba(0x00000000).into(),
111+ elevated_surface: rgba(0xdcd8d8ff).into(),
112+ surface: rgba(0xfef9f2ff).into(),
113+ background: rgba(0xdcd8d8ff).into(),
114+ filled_element: rgba(0xdcd8d8ff).into(),
115+ filled_element_hover: rgba(0xffffff1e).into(),
116+ filled_element_active: rgba(0xffffff28).into(),
117+ filled_element_selected: rgba(0xdde9ebff).into(),
118+ filled_element_disabled: rgba(0x00000000).into(),
119+ ghost_element: rgba(0x00000000).into(),
120+ ghost_element_hover: rgba(0xffffff14).into(),
121+ ghost_element_active: rgba(0xffffff1e).into(),
122+ ghost_element_selected: rgba(0xdde9ebff).into(),
123+ ghost_element_disabled: rgba(0x00000000).into(),
124+ text: rgba(0x575279ff).into(),
125+ text_muted: rgba(0x706c8cff).into(),
126+ text_placeholder: rgba(0xb4647aff).into(),
127+ text_disabled: rgba(0x938fa3ff).into(),
128+ text_accent: rgba(0x57949fff).into(),
129+ icon_muted: rgba(0x706c8cff).into(),
130+ syntax: SyntaxTheme {
131+ comment: rgba(0x9893a5ff).into(),
132+ string: rgba(0xea9d34ff).into(),
133+ function: rgba(0xd7827dff).into(),
134+ keyword: rgba(0x276983ff).into(),
135+ highlights: Vec::new(),
136+ },
137+ status_bar: rgba(0xdcd8d8ff).into(),
138+ title_bar: rgba(0xdcd8d8ff).into(),
139+ toolbar: rgba(0xfaf4edff).into(),
140+ tab_bar: rgba(0xfef9f2ff).into(),
141+ editor: rgba(0xfaf4edff).into(),
142+ editor_subheader: rgba(0xfef9f2ff).into(),
143+ editor_active_line: rgba(0xfef9f2ff).into(),
144+ terminal: rgba(0xfaf4edff).into(),
145+ image_fallback_background: rgba(0xdcd8d8ff).into(),
146+ git_created: rgba(0x3daa8eff).into(),
147+ git_modified: rgba(0x57949fff).into(),
148+ git_deleted: rgba(0xb4647aff).into(),
149+ git_conflict: rgba(0xe99d35ff).into(),
150+ git_ignored: rgba(0x938fa3ff).into(),
151+ git_renamed: rgba(0xe99d35ff).into(),
152+ players: [
153+ PlayerTheme {
154+ cursor: rgba(0x57949fff).into(),
155+ selection: rgba(0x57949f3d).into(),
156+ },
157+ PlayerTheme {
158+ cursor: rgba(0x3daa8eff).into(),
159+ selection: rgba(0x3daa8e3d).into(),
160+ },
161+ PlayerTheme {
162+ cursor: rgba(0x7c697fff).into(),
163+ selection: rgba(0x7c697f3d).into(),
164+ },
165+ PlayerTheme {
166+ cursor: rgba(0x9079a9ff).into(),
167+ selection: rgba(0x9079a93d).into(),
168+ },
169+ PlayerTheme {
170+ cursor: rgba(0x9079a9ff).into(),
171+ selection: rgba(0x9079a93d).into(),
172+ },
173+ PlayerTheme {
174+ cursor: rgba(0x296983ff).into(),
175+ selection: rgba(0x2969833d).into(),
176+ },
177+ PlayerTheme {
178+ cursor: rgba(0xb4647aff).into(),
179+ selection: rgba(0xb4647a3d).into(),
180+ },
181+ PlayerTheme {
182+ cursor: rgba(0xe99d35ff).into(),
183+ selection: rgba(0xe99d353d).into(),
184+ },
185+ ],
186+ }
187+}
188+
189+pub fn rose_pine_moon() -> Theme {
190+ Theme {
191+ metadata: ThemeMetadata {
192+ name: "Rosé Pine Moon".into(),
193+ is_light: false,
194+ },
195+ transparent: rgba(0x00000000).into(),
196+ mac_os_traffic_light_red: rgba(0xec695eff).into(),
197+ mac_os_traffic_light_yellow: rgba(0xf4bf4eff).into(),
198+ mac_os_traffic_light_green: rgba(0x61c553ff).into(),
199+ border: rgba(0x504c68ff).into(),
200+ border_variant: rgba(0x504c68ff).into(),
201+ border_focused: rgba(0x435255ff).into(),
202+ border_transparent: rgba(0x00000000).into(),
203+ elevated_surface: rgba(0x38354eff).into(),
204+ surface: rgba(0x28253cff).into(),
205+ background: rgba(0x38354eff).into(),
206+ filled_element: rgba(0x38354eff).into(),
207+ filled_element_hover: rgba(0xffffff1e).into(),
208+ filled_element_active: rgba(0xffffff28).into(),
209+ filled_element_selected: rgba(0x2f3639ff).into(),
210+ filled_element_disabled: rgba(0x00000000).into(),
211+ ghost_element: rgba(0x00000000).into(),
212+ ghost_element_hover: rgba(0xffffff14).into(),
213+ ghost_element_active: rgba(0xffffff1e).into(),
214+ ghost_element_selected: rgba(0x2f3639ff).into(),
215+ ghost_element_disabled: rgba(0x00000000).into(),
216+ text: rgba(0xe0def4ff).into(),
217+ text_muted: rgba(0x85819eff).into(),
218+ text_placeholder: rgba(0xea6e92ff).into(),
219+ text_disabled: rgba(0x605d7aff).into(),
220+ text_accent: rgba(0x9bced6ff).into(),
221+ icon_muted: rgba(0x85819eff).into(),
222+ syntax: SyntaxTheme {
223+ comment: rgba(0x6e6a86ff).into(),
224+ string: rgba(0xf5c177ff).into(),
225+ function: rgba(0xea9a97ff).into(),
226+ keyword: rgba(0x3d8fb0ff).into(),
227+ highlights: Vec::new(),
228+ },
229+ status_bar: rgba(0x38354eff).into(),
230+ title_bar: rgba(0x38354eff).into(),
231+ toolbar: rgba(0x232136ff).into(),
232+ tab_bar: rgba(0x28253cff).into(),
233+ editor: rgba(0x232136ff).into(),
234+ editor_subheader: rgba(0x28253cff).into(),
235+ editor_active_line: rgba(0x28253cff).into(),
236+ terminal: rgba(0x232136ff).into(),
237+ image_fallback_background: rgba(0x38354eff).into(),
238+ git_created: rgba(0x5cc1a3ff).into(),
239+ git_modified: rgba(0x9bced6ff).into(),
240+ git_deleted: rgba(0xea6e92ff).into(),
241+ git_conflict: rgba(0xf5c177ff).into(),
242+ git_ignored: rgba(0x605d7aff).into(),
243+ git_renamed: rgba(0xf5c177ff).into(),
244+ players: [
245+ PlayerTheme {
246+ cursor: rgba(0x9bced6ff).into(),
247+ selection: rgba(0x9bced63d).into(),
248+ },
249+ PlayerTheme {
250+ cursor: rgba(0x5cc1a3ff).into(),
251+ selection: rgba(0x5cc1a33d).into(),
252+ },
253+ PlayerTheme {
254+ cursor: rgba(0xa683a0ff).into(),
255+ selection: rgba(0xa683a03d).into(),
256+ },
257+ PlayerTheme {
258+ cursor: rgba(0xc4a7e6ff).into(),
259+ selection: rgba(0xc4a7e63d).into(),
260+ },
261+ PlayerTheme {
262+ cursor: rgba(0xc4a7e6ff).into(),
263+ selection: rgba(0xc4a7e63d).into(),
264+ },
265+ PlayerTheme {
266+ cursor: rgba(0x3e8fb0ff).into(),
267+ selection: rgba(0x3e8fb03d).into(),
268+ },
269+ PlayerTheme {
270+ cursor: rgba(0xea6e92ff).into(),
271+ selection: rgba(0xea6e923d).into(),
272+ },
273+ PlayerTheme {
274+ cursor: rgba(0xf5c177ff).into(),
275+ selection: rgba(0xf5c1773d).into(),
276+ },
277+ ],
278+ }
279+}
crates/theme_converter/src/main.rs+15−2
@@ -10,7 +10,7 @@ use rust_embed::RustEmbed; · 9 unmodified lines
1010 use serde::de::Visitor;
1111 use serde::{Deserialize, Deserializer};
1212 use simplelog::SimpleLogger;
13−use theme2::{PlayerTheme, SyntaxTheme};
13+use theme2::{PlayerTheme, SyntaxTheme, ThemeMetadata};
1414
1515 #[derive(Parser)]
1616 #[command(author, version, about, long_about = None)]
@@ -368,6 +368,7 @@ pub struct ThemePrinter(theme2::Theme); · 351 unmodified lines
368368 impl std::fmt::Debug for ThemePrinter {
369369 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
370370 f.debug_struct("Theme")
371+ .field("metadata", &ThemeMetadataPrinter(self.0.metadata.clone()))
371372 .field("transparent", &self.0.transparent.to_rgb().to_hex())
372373 .field(
373374 "mac_os_traffic_light_red",
@@ -462,7 +463,18 @@ impl std::fmt::Debug for ThemePrinter { · 88 unmodified lines
462463 .field("git_conflict", &self.0.git_conflict.to_rgb().to_hex())
463464 .field("git_ignored", &self.0.git_ignored.to_rgb().to_hex())
464465 .field("git_renamed", &self.0.git_renamed.to_rgb().to_hex())
465− .field("player", &self.0.players.map(PlayerThemePrinter))
466+ .field("players", &self.0.players.map(PlayerThemePrinter))
467+ .finish()
468+ }
469+}
470+
471+pub struct ThemeMetadataPrinter(ThemeMetadata);
472+
473+impl std::fmt::Debug for ThemeMetadataPrinter {
474+ fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
475+ f.debug_struct("ThemeMetadata")
476+ .field("name", &self.0.name)
477+ .field("is_light", &self.0.is_light)
466478 .finish()
467479 }
468480 }
@@ -476,6 +488,7 @@ impl std::fmt::Debug for SyntaxThemePrinter { · 7 unmodified lines
476488 .field("string", &self.0.string.to_rgb().to_hex())
477489 .field("function", &self.0.function.to_rgb().to_hex())
478490 .field("keyword", &self.0.keyword.to_rgb().to_hex())
491+ .field("highlights", &self.0.highlights)
479492 .finish()
480493 }
481494 }

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t