user_theme.rs

 1use gpui::Hsla;
 2use refineable::Refineable;
 3use serde::Deserialize;
 4
 5use crate::{Appearance, StatusColors, StatusColorsRefinement, ThemeColors, ThemeColorsRefinement};
 6
 7#[derive(Deserialize)]
 8pub struct UserThemeFamily {
 9    pub name: String,
10    pub author: String,
11    pub themes: Vec<UserTheme>,
12}
13
14#[derive(Deserialize)]
15pub struct UserTheme {
16    pub name: String,
17    pub appearance: Appearance,
18    pub styles: UserThemeStylesRefinement,
19}
20
21#[derive(Refineable, Clone)]
22#[refineable(deserialize)]
23pub struct UserThemeStyles {
24    #[refineable]
25    pub colors: ThemeColors,
26    #[refineable]
27    pub status: StatusColors,
28    pub syntax: UserSyntaxTheme,
29}
30
31#[derive(Clone, Default, Deserialize)]
32pub struct UserSyntaxTheme {
33    pub highlights: Vec<(String, UserHighlightStyle)>,
34}
35
36#[derive(Clone, Default, Deserialize)]
37pub struct UserHighlightStyle {
38    pub color: Option<Hsla>,
39}
40
41impl UserHighlightStyle {
42    pub fn is_empty(&self) -> bool {
43        self.color.is_none()
44    }
45}