This commit is contained in:
Marshall Bowers 2023-10-24 16:59:24 +02:00
parent 9f8aaa4cdb
commit 09866ec3e9
11 changed files with 842 additions and 11 deletions

View file

@ -1,21 +1,114 @@
use gpui2::HighlightStyle;
mod registry;
mod settings;
mod themes;
pub use registry::*;
pub use settings::*;
use gpui2::{Hsla, SharedString};
use std::sync::Arc;
pub struct Theme {
pub editor: Editor,
pub metadata: ThemeMetadata,
pub transparent: Hsla,
pub mac_os_traffic_light_red: Hsla,
pub mac_os_traffic_light_yellow: Hsla,
pub mac_os_traffic_light_green: Hsla,
pub border: Hsla,
pub border_variant: Hsla,
pub border_focused: Hsla,
pub border_transparent: Hsla,
/// The background color of an elevated surface, like a modal, tooltip or toast.
pub elevated_surface: Hsla,
pub surface: Hsla,
/// Window background color of the base app
pub background: Hsla,
/// Default background for elements like filled buttons,
/// text fields, checkboxes, radio buttons, etc.
/// - TODO: Map to step 3.
pub filled_element: Hsla,
/// The background color of a hovered element, like a button being hovered
/// with a mouse, or hovered on a touch screen.
/// - TODO: Map to step 4.
pub filled_element_hover: Hsla,
/// The background color of an active element, like a button being pressed,
/// or tapped on a touch screen.
/// - TODO: Map to step 5.
pub filled_element_active: Hsla,
/// The background color of a selected element, like a selected tab,
/// a button toggled on, or a checkbox that is checked.
pub filled_element_selected: Hsla,
pub filled_element_disabled: Hsla,
pub ghost_element: Hsla,
/// The background color of a hovered element with no default background,
/// like a ghost-style button or an interactable list item.
/// - TODO: Map to step 3.
pub ghost_element_hover: Hsla,
/// - TODO: Map to step 4.
pub ghost_element_active: Hsla,
pub ghost_element_selected: Hsla,
pub ghost_element_disabled: Hsla,
pub text: Hsla,
pub text_muted: Hsla,
pub text_placeholder: Hsla,
pub text_disabled: Hsla,
pub text_accent: Hsla,
pub icon_muted: Hsla,
pub syntax: SyntaxTheme,
pub status_bar: Hsla,
pub title_bar: Hsla,
pub toolbar: Hsla,
pub tab_bar: Hsla,
/// The background of the editor
pub editor: Hsla,
pub editor_subheader: Hsla,
pub editor_active_line: Hsla,
pub terminal: Hsla,
pub image_fallback_background: Hsla,
pub git_created: Hsla,
pub git_modified: Hsla,
pub git_deleted: Hsla,
pub git_conflict: Hsla,
pub git_ignored: Hsla,
pub git_renamed: Hsla,
pub player: [PlayerTheme; 8],
}
#[derive(Clone, Copy)]
pub struct SyntaxTheme {
pub comment: Hsla,
pub string: Hsla,
pub function: Hsla,
pub keyword: Hsla,
}
#[derive(Clone, Copy)]
pub struct PlayerTheme {
pub cursor: Hsla,
pub selection: Hsla,
}
pub struct ThemeMetadata {
pub id: usize,
pub name: SharedString,
pub is_light: bool,
}
pub struct Editor {
pub syntax: Arc<SyntaxTheme>,
}
#[derive(Default)]
pub struct SyntaxTheme {
pub highlights: Vec<(String, HighlightStyle)>,
}
// #[derive(Default)]
// pub struct SyntaxTheme {
// pub highlights: Vec<(String, HighlightStyle)>,
// }
impl SyntaxTheme {
pub fn new(highlights: Vec<(String, HighlightStyle)>) -> Self {
Self { highlights }
}
}
// impl SyntaxTheme {
// pub fn new(highlights: Vec<(String, HighlightStyle)>) -> Self {
// Self { highlights }
// }
// }