Remove 2 suffix for theme
Co-authored-by: Mikayla <mikayla@zed.dev>
This commit is contained in:
parent
4305c5fdbe
commit
dfcb17fe74
79 changed files with 319 additions and 2648 deletions
|
@ -5,6 +5,9 @@ edition = "2021"
|
|||
publish = false
|
||||
|
||||
[features]
|
||||
default = []
|
||||
importing-themes = []
|
||||
stories = ["dep:itertools", "dep:story"]
|
||||
test-support = [
|
||||
"gpui/test-support",
|
||||
"fs/test-support",
|
||||
|
@ -16,21 +19,24 @@ path = "src/theme.rs"
|
|||
doctest = false
|
||||
|
||||
[dependencies]
|
||||
gpui = { path = "../gpui" }
|
||||
fs = { path = "../fs" }
|
||||
settings = { path = "../settings" }
|
||||
util = { path = "../util" }
|
||||
|
||||
anyhow.workspace = true
|
||||
fs = { path = "../fs" }
|
||||
gpui = { package = "gpui2", path = "../gpui2" }
|
||||
indexmap = "1.6.2"
|
||||
parking_lot.workspace = true
|
||||
refineable.workspace = true
|
||||
schemars.workspace = true
|
||||
serde.workspace = true
|
||||
serde_derive.workspace = true
|
||||
serde_json.workspace = true
|
||||
settings = { path = "../settings" }
|
||||
story = { path = "../story", optional = true }
|
||||
toml.workspace = true
|
||||
uuid.workspace = true
|
||||
util = { path = "../util" }
|
||||
itertools = { version = "0.11.0", optional = true }
|
||||
|
||||
[dev-dependencies]
|
||||
gpui = { path = "../gpui", features = ["test-support"] }
|
||||
gpui = { package = "gpui2", path = "../gpui2", features = ["test-support"] }
|
||||
fs = { path = "../fs", features = ["test-support"] }
|
||||
settings = { path = "../settings", features = ["test-support"] }
|
||||
|
|
|
@ -1,480 +0,0 @@
|
|||
use gpui::{elements::SafeStylable, Action};
|
||||
|
||||
use crate::{Interactive, Toggleable};
|
||||
|
||||
use self::{action_button::ButtonStyle, disclosure::Disclosable, svg::SvgStyle, toggle::Toggle};
|
||||
|
||||
pub type IconButtonStyle = Interactive<ButtonStyle<SvgStyle>>;
|
||||
pub type ToggleIconButtonStyle = Toggleable<IconButtonStyle>;
|
||||
|
||||
pub trait ComponentExt<C: SafeStylable> {
|
||||
fn toggleable(self, active: bool) -> Toggle<C, ()>;
|
||||
fn disclosable(self, disclosed: Option<bool>, action: Box<dyn Action>) -> Disclosable<C, ()>;
|
||||
}
|
||||
|
||||
impl<C: SafeStylable> ComponentExt<C> for C {
|
||||
fn toggleable(self, active: bool) -> Toggle<C, ()> {
|
||||
Toggle::new(self, active)
|
||||
}
|
||||
|
||||
/// Some(True) => disclosed => content is visible
|
||||
/// Some(false) => closed => content is hidden
|
||||
/// None => No disclosure button, but reserve disclosure spacing
|
||||
fn disclosable(self, disclosed: Option<bool>, action: Box<dyn Action>) -> Disclosable<C, ()> {
|
||||
Disclosable::new(disclosed, self, action)
|
||||
}
|
||||
}
|
||||
|
||||
pub mod disclosure {
|
||||
use gpui::{
|
||||
elements::{Component, ContainerStyle, Empty, Flex, ParentElement, SafeStylable},
|
||||
Action, Element,
|
||||
};
|
||||
use schemars::JsonSchema;
|
||||
use serde_derive::Deserialize;
|
||||
|
||||
use super::{action_button::Button, svg::Svg, IconButtonStyle};
|
||||
|
||||
#[derive(Clone, Default, Deserialize, JsonSchema)]
|
||||
pub struct DisclosureStyle<S> {
|
||||
pub button: IconButtonStyle,
|
||||
#[serde(flatten)]
|
||||
pub container: ContainerStyle,
|
||||
pub spacing: f32,
|
||||
#[serde(flatten)]
|
||||
content: S,
|
||||
}
|
||||
|
||||
impl<S> DisclosureStyle<S> {
|
||||
pub fn button_space(&self) -> f32 {
|
||||
self.spacing + self.button.button_width.unwrap()
|
||||
}
|
||||
}
|
||||
|
||||
pub struct Disclosable<C, S> {
|
||||
disclosed: Option<bool>,
|
||||
action: Box<dyn Action>,
|
||||
id: usize,
|
||||
content: C,
|
||||
style: S,
|
||||
}
|
||||
|
||||
impl Disclosable<(), ()> {
|
||||
pub fn new<C>(
|
||||
disclosed: Option<bool>,
|
||||
content: C,
|
||||
action: Box<dyn Action>,
|
||||
) -> Disclosable<C, ()> {
|
||||
Disclosable {
|
||||
disclosed,
|
||||
content,
|
||||
action,
|
||||
id: 0,
|
||||
style: (),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<C> Disclosable<C, ()> {
|
||||
pub fn with_id(mut self, id: usize) -> Disclosable<C, ()> {
|
||||
self.id = id;
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
impl<C: SafeStylable> SafeStylable for Disclosable<C, ()> {
|
||||
type Style = DisclosureStyle<C::Style>;
|
||||
|
||||
type Output = Disclosable<C, Self::Style>;
|
||||
|
||||
fn with_style(self, style: Self::Style) -> Self::Output {
|
||||
Disclosable {
|
||||
disclosed: self.disclosed,
|
||||
action: self.action,
|
||||
content: self.content,
|
||||
id: self.id,
|
||||
style,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<C: SafeStylable> Component for Disclosable<C, DisclosureStyle<C::Style>> {
|
||||
fn render<V: 'static>(self, cx: &mut gpui::ViewContext<V>) -> gpui::AnyElement<V> {
|
||||
Flex::row()
|
||||
.with_spacing(self.style.spacing)
|
||||
.with_child(if let Some(disclosed) = self.disclosed {
|
||||
Button::dynamic_action(self.action)
|
||||
.with_id(self.id)
|
||||
.with_contents(Svg::new(if disclosed {
|
||||
"icons/file_icons/chevron_down.svg"
|
||||
} else {
|
||||
"icons/file_icons/chevron_right.svg"
|
||||
}))
|
||||
.with_style(self.style.button)
|
||||
.element()
|
||||
.into_any()
|
||||
} else {
|
||||
Empty::new()
|
||||
.into_any()
|
||||
.constrained()
|
||||
// TODO: Why is this optional at all?
|
||||
.with_width(self.style.button.button_width.unwrap())
|
||||
.into_any()
|
||||
})
|
||||
.with_child(
|
||||
self.content
|
||||
.with_style(self.style.content)
|
||||
.render(cx)
|
||||
.flex(1., true),
|
||||
)
|
||||
.align_children_center()
|
||||
.contained()
|
||||
.with_style(self.style.container)
|
||||
.into_any()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub mod toggle {
|
||||
use gpui::elements::{Component, SafeStylable};
|
||||
|
||||
use crate::Toggleable;
|
||||
|
||||
pub struct Toggle<C, S> {
|
||||
style: S,
|
||||
active: bool,
|
||||
component: C,
|
||||
}
|
||||
|
||||
impl<C: SafeStylable> Toggle<C, ()> {
|
||||
pub fn new(component: C, active: bool) -> Self {
|
||||
Toggle {
|
||||
active,
|
||||
component,
|
||||
style: (),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<C: SafeStylable> SafeStylable for Toggle<C, ()> {
|
||||
type Style = Toggleable<C::Style>;
|
||||
|
||||
type Output = Toggle<C, Self::Style>;
|
||||
|
||||
fn with_style(self, style: Self::Style) -> Self::Output {
|
||||
Toggle {
|
||||
active: self.active,
|
||||
component: self.component,
|
||||
style,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<C: SafeStylable> Component for Toggle<C, Toggleable<C::Style>> {
|
||||
fn render<V: 'static>(self, cx: &mut gpui::ViewContext<V>) -> gpui::AnyElement<V> {
|
||||
self.component
|
||||
.with_style(self.style.in_state(self.active).clone())
|
||||
.render(cx)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub mod action_button {
|
||||
use std::borrow::Cow;
|
||||
|
||||
use gpui::{
|
||||
elements::{Component, ContainerStyle, MouseEventHandler, SafeStylable, TooltipStyle},
|
||||
platform::{CursorStyle, MouseButton},
|
||||
Action, Element, TypeTag,
|
||||
};
|
||||
use schemars::JsonSchema;
|
||||
use serde_derive::Deserialize;
|
||||
|
||||
use crate::Interactive;
|
||||
|
||||
#[derive(Clone, Deserialize, Default, JsonSchema)]
|
||||
pub struct ButtonStyle<C> {
|
||||
#[serde(flatten)]
|
||||
pub container: ContainerStyle,
|
||||
// TODO: These are incorrect for the intended usage of the buttons.
|
||||
// The size should be constant, but putting them here duplicates them
|
||||
// across the states the buttons can be in
|
||||
pub button_width: Option<f32>,
|
||||
pub button_height: Option<f32>,
|
||||
#[serde(flatten)]
|
||||
contents: C,
|
||||
}
|
||||
|
||||
pub struct Button<C, S> {
|
||||
action: Box<dyn Action>,
|
||||
tooltip: Option<(Cow<'static, str>, TooltipStyle)>,
|
||||
tag: TypeTag,
|
||||
id: usize,
|
||||
contents: C,
|
||||
style: Interactive<S>,
|
||||
}
|
||||
|
||||
impl Button<(), ()> {
|
||||
pub fn dynamic_action(action: Box<dyn Action>) -> Button<(), ()> {
|
||||
Self {
|
||||
contents: (),
|
||||
tag: action.type_tag(),
|
||||
action,
|
||||
style: Interactive::new_blank(),
|
||||
tooltip: None,
|
||||
id: 0,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn action<A: Action + Clone>(action: A) -> Self {
|
||||
Self::dynamic_action(Box::new(action))
|
||||
}
|
||||
|
||||
pub fn with_tooltip(
|
||||
mut self,
|
||||
tooltip: impl Into<Cow<'static, str>>,
|
||||
tooltip_style: TooltipStyle,
|
||||
) -> Self {
|
||||
self.tooltip = Some((tooltip.into(), tooltip_style));
|
||||
self
|
||||
}
|
||||
|
||||
pub fn with_id(mut self, id: usize) -> Self {
|
||||
self.id = id;
|
||||
self
|
||||
}
|
||||
|
||||
pub fn with_contents<C: SafeStylable>(self, contents: C) -> Button<C, ()> {
|
||||
Button {
|
||||
action: self.action,
|
||||
tag: self.tag,
|
||||
style: self.style,
|
||||
tooltip: self.tooltip,
|
||||
id: self.id,
|
||||
contents,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<C: SafeStylable> SafeStylable for Button<C, ()> {
|
||||
type Style = Interactive<ButtonStyle<C::Style>>;
|
||||
type Output = Button<C, ButtonStyle<C::Style>>;
|
||||
|
||||
fn with_style(self, style: Self::Style) -> Self::Output {
|
||||
Button {
|
||||
action: self.action,
|
||||
tag: self.tag,
|
||||
contents: self.contents,
|
||||
tooltip: self.tooltip,
|
||||
id: self.id,
|
||||
style,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<C: SafeStylable> Component for Button<C, ButtonStyle<C::Style>> {
|
||||
fn render<V: 'static>(self, cx: &mut gpui::ViewContext<V>) -> gpui::AnyElement<V> {
|
||||
let mut button = MouseEventHandler::new_dynamic(self.tag, self.id, cx, |state, cx| {
|
||||
let style = self.style.style_for(state);
|
||||
let mut contents = self
|
||||
.contents
|
||||
.with_style(style.contents.to_owned())
|
||||
.render(cx)
|
||||
.contained()
|
||||
.with_style(style.container)
|
||||
.constrained();
|
||||
|
||||
if let Some(height) = style.button_height {
|
||||
contents = contents.with_height(height);
|
||||
}
|
||||
|
||||
if let Some(width) = style.button_width {
|
||||
contents = contents.with_width(width);
|
||||
}
|
||||
|
||||
contents.into_any()
|
||||
})
|
||||
.on_click(MouseButton::Left, {
|
||||
let action = self.action.boxed_clone();
|
||||
move |_, _, cx| {
|
||||
let window = cx.window();
|
||||
let view = cx.view_id();
|
||||
let action = action.boxed_clone();
|
||||
cx.spawn(|_, mut cx| async move {
|
||||
window.dispatch_action(view, action.as_ref(), &mut cx)
|
||||
})
|
||||
.detach();
|
||||
}
|
||||
})
|
||||
.with_cursor_style(CursorStyle::PointingHand)
|
||||
.into_any();
|
||||
|
||||
if let Some((tooltip, style)) = self.tooltip {
|
||||
button = button
|
||||
.with_dynamic_tooltip(self.tag, 0, tooltip, Some(self.action), style, cx)
|
||||
.into_any()
|
||||
}
|
||||
|
||||
button
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub mod svg {
|
||||
use std::borrow::Cow;
|
||||
|
||||
use gpui::{
|
||||
elements::{Component, Empty, SafeStylable},
|
||||
Element,
|
||||
};
|
||||
use schemars::JsonSchema;
|
||||
use serde::Deserialize;
|
||||
|
||||
#[derive(Clone, Default, JsonSchema)]
|
||||
pub struct SvgStyle {
|
||||
icon_width: f32,
|
||||
icon_height: f32,
|
||||
color: gpui::color::Color,
|
||||
}
|
||||
|
||||
impl<'de> Deserialize<'de> for SvgStyle {
|
||||
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
|
||||
where
|
||||
D: serde::Deserializer<'de>,
|
||||
{
|
||||
#[derive(Deserialize)]
|
||||
#[serde(untagged)]
|
||||
pub enum IconSize {
|
||||
IconSize { icon_size: f32 },
|
||||
Dimensions { width: f32, height: f32 },
|
||||
IconDimensions { icon_width: f32, icon_height: f32 },
|
||||
}
|
||||
|
||||
#[derive(Deserialize)]
|
||||
struct SvgStyleHelper {
|
||||
#[serde(flatten)]
|
||||
size: IconSize,
|
||||
color: gpui::color::Color,
|
||||
}
|
||||
|
||||
let json = SvgStyleHelper::deserialize(deserializer)?;
|
||||
let color = json.color;
|
||||
|
||||
let result = match json.size {
|
||||
IconSize::IconSize { icon_size } => SvgStyle {
|
||||
icon_width: icon_size,
|
||||
icon_height: icon_size,
|
||||
color,
|
||||
},
|
||||
IconSize::Dimensions { width, height } => SvgStyle {
|
||||
icon_width: width,
|
||||
icon_height: height,
|
||||
color,
|
||||
},
|
||||
IconSize::IconDimensions {
|
||||
icon_width,
|
||||
icon_height,
|
||||
} => SvgStyle {
|
||||
icon_width,
|
||||
icon_height,
|
||||
color,
|
||||
},
|
||||
};
|
||||
|
||||
Ok(result)
|
||||
}
|
||||
}
|
||||
|
||||
pub struct Svg<S> {
|
||||
path: Option<Cow<'static, str>>,
|
||||
style: S,
|
||||
}
|
||||
|
||||
impl Svg<()> {
|
||||
pub fn new(path: impl Into<Cow<'static, str>>) -> Self {
|
||||
Self {
|
||||
path: Some(path.into()),
|
||||
style: (),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn optional(path: Option<impl Into<Cow<'static, str>>>) -> Self {
|
||||
Self {
|
||||
path: path.map(Into::into),
|
||||
style: (),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl SafeStylable for Svg<()> {
|
||||
type Style = SvgStyle;
|
||||
|
||||
type Output = Svg<SvgStyle>;
|
||||
|
||||
fn with_style(self, style: Self::Style) -> Self::Output {
|
||||
Svg {
|
||||
path: self.path,
|
||||
style,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Component for Svg<SvgStyle> {
|
||||
fn render<V: 'static>(self, _: &mut gpui::ViewContext<V>) -> gpui::AnyElement<V> {
|
||||
if let Some(path) = self.path {
|
||||
gpui::elements::Svg::new(path)
|
||||
.with_color(self.style.color)
|
||||
.constrained()
|
||||
} else {
|
||||
Empty::new().constrained()
|
||||
}
|
||||
.constrained()
|
||||
.with_width(self.style.icon_width)
|
||||
.with_height(self.style.icon_height)
|
||||
.into_any()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub mod label {
|
||||
use std::borrow::Cow;
|
||||
|
||||
use gpui::{
|
||||
elements::{Component, LabelStyle, SafeStylable},
|
||||
fonts::TextStyle,
|
||||
Element,
|
||||
};
|
||||
|
||||
pub struct Label<S> {
|
||||
text: Cow<'static, str>,
|
||||
style: S,
|
||||
}
|
||||
|
||||
impl Label<()> {
|
||||
pub fn new(text: impl Into<Cow<'static, str>>) -> Self {
|
||||
Self {
|
||||
text: text.into(),
|
||||
style: (),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl SafeStylable for Label<()> {
|
||||
type Style = TextStyle;
|
||||
|
||||
type Output = Label<LabelStyle>;
|
||||
|
||||
fn with_style(self, style: Self::Style) -> Self::Output {
|
||||
Label {
|
||||
text: self.text,
|
||||
style: style.into(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Component for Label<LabelStyle> {
|
||||
fn render<V: 'static>(self, _: &mut gpui::ViewContext<V>) -> gpui::AnyElement<V> {
|
||||
gpui::elements::Label::new(self.text, self.style).into_any()
|
||||
}
|
||||
}
|
||||
}
|
2359
crates/theme/src/default_colors.rs
Normal file
2359
crates/theme/src/default_colors.rs
Normal file
File diff suppressed because it is too large
Load diff
92
crates/theme/src/default_theme.rs
Normal file
92
crates/theme/src/default_theme.rs
Normal file
|
@ -0,0 +1,92 @@
|
|||
use std::sync::Arc;
|
||||
|
||||
use crate::prelude::*;
|
||||
|
||||
use crate::{
|
||||
default_color_scales,
|
||||
one_themes::{one_dark, one_family},
|
||||
Appearance, PlayerColors, StatusColors, SyntaxTheme, SystemColors, Theme, ThemeColors,
|
||||
ThemeFamily, ThemeStyles,
|
||||
};
|
||||
|
||||
fn zed_pro_daylight() -> Theme {
|
||||
Theme {
|
||||
id: "zed_pro_daylight".to_string(),
|
||||
name: "Zed Pro Daylight".into(),
|
||||
appearance: Appearance::Light,
|
||||
styles: ThemeStyles {
|
||||
system: SystemColors::default(),
|
||||
colors: ThemeColors::light(),
|
||||
status: StatusColors::light(),
|
||||
player: PlayerColors::light(),
|
||||
syntax: Arc::new(SyntaxTheme::light()),
|
||||
accents: vec![
|
||||
blue().light().step_9(),
|
||||
orange().light().step_9(),
|
||||
pink().light().step_9(),
|
||||
lime().light().step_9(),
|
||||
purple().light().step_9(),
|
||||
amber().light().step_9(),
|
||||
jade().light().step_9(),
|
||||
tomato().light().step_9(),
|
||||
cyan().light().step_9(),
|
||||
gold().light().step_9(),
|
||||
grass().light().step_9(),
|
||||
indigo().light().step_9(),
|
||||
iris().light().step_9(),
|
||||
],
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn zed_pro_moonlight() -> Theme {
|
||||
Theme {
|
||||
id: "zed_pro_moonlight".to_string(),
|
||||
name: "Zed Pro Moonlight".into(),
|
||||
appearance: Appearance::Dark,
|
||||
styles: ThemeStyles {
|
||||
system: SystemColors::default(),
|
||||
colors: ThemeColors::dark(),
|
||||
status: StatusColors::dark(),
|
||||
player: PlayerColors::dark(),
|
||||
syntax: Arc::new(SyntaxTheme::dark()),
|
||||
accents: vec![
|
||||
blue().dark().step_9(),
|
||||
orange().dark().step_9(),
|
||||
pink().dark().step_9(),
|
||||
lime().dark().step_9(),
|
||||
purple().dark().step_9(),
|
||||
amber().dark().step_9(),
|
||||
jade().dark().step_9(),
|
||||
tomato().dark().step_9(),
|
||||
cyan().dark().step_9(),
|
||||
gold().dark().step_9(),
|
||||
grass().dark().step_9(),
|
||||
indigo().dark().step_9(),
|
||||
iris().dark().step_9(),
|
||||
],
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
pub fn zed_pro_family() -> ThemeFamily {
|
||||
ThemeFamily {
|
||||
id: "zed_pro".to_string(),
|
||||
name: "Zed Pro".into(),
|
||||
author: "Zed Team".into(),
|
||||
themes: vec![zed_pro_daylight(), zed_pro_moonlight()],
|
||||
scales: default_color_scales(),
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for ThemeFamily {
|
||||
fn default() -> Self {
|
||||
one_family()
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for Theme {
|
||||
fn default() -> Self {
|
||||
one_dark()
|
||||
}
|
||||
}
|
239
crates/theme/src/one_themes.rs
Normal file
239
crates/theme/src/one_themes.rs
Normal file
|
@ -0,0 +1,239 @@
|
|||
use std::sync::Arc;
|
||||
|
||||
use gpui::{hsla, FontStyle, FontWeight, HighlightStyle};
|
||||
|
||||
use crate::{
|
||||
default_color_scales, Appearance, PlayerColors, StatusColors, SyntaxTheme, SystemColors, Theme,
|
||||
ThemeColors, ThemeFamily, ThemeStyles,
|
||||
};
|
||||
|
||||
pub fn one_family() -> ThemeFamily {
|
||||
ThemeFamily {
|
||||
id: "one".to_string(),
|
||||
name: "One".into(),
|
||||
author: "".into(),
|
||||
themes: vec![one_dark()],
|
||||
scales: default_color_scales(),
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn one_dark() -> Theme {
|
||||
let bg = hsla(215. / 360., 12. / 100., 15. / 100., 1.);
|
||||
let editor = hsla(220. / 360., 12. / 100., 18. / 100., 1.);
|
||||
let elevated_surface = hsla(225. / 360., 12. / 100., 17. / 100., 1.);
|
||||
|
||||
let blue = hsla(207.8 / 360., 81. / 100., 66. / 100., 1.0);
|
||||
let gray = hsla(218.8 / 360., 10. / 100., 40. / 100., 1.0);
|
||||
let green = hsla(95. / 360., 38. / 100., 62. / 100., 1.0);
|
||||
let orange = hsla(29. / 360., 54. / 100., 61. / 100., 1.0);
|
||||
let purple = hsla(286. / 360., 51. / 100., 64. / 100., 1.0);
|
||||
let red = hsla(355. / 360., 65. / 100., 65. / 100., 1.0);
|
||||
let teal = hsla(187. / 360., 47. / 100., 55. / 100., 1.0);
|
||||
let yellow = hsla(39. / 360., 67. / 100., 69. / 100., 1.0);
|
||||
|
||||
Theme {
|
||||
id: "one_dark".to_string(),
|
||||
name: "One Dark".into(),
|
||||
appearance: Appearance::Dark,
|
||||
|
||||
styles: ThemeStyles {
|
||||
system: SystemColors::default(),
|
||||
colors: ThemeColors {
|
||||
border: hsla(225. / 360., 13. / 100., 12. / 100., 1.),
|
||||
border_variant: hsla(228. / 360., 8. / 100., 25. / 100., 1.),
|
||||
border_focused: hsla(223. / 360., 78. / 100., 65. / 100., 1.),
|
||||
border_selected: hsla(222.6 / 360., 77.5 / 100., 65.1 / 100., 1.0),
|
||||
border_transparent: SystemColors::default().transparent,
|
||||
border_disabled: hsla(222.0 / 360., 11.6 / 100., 33.7 / 100., 1.0),
|
||||
elevated_surface_background: elevated_surface,
|
||||
surface_background: bg,
|
||||
background: bg,
|
||||
element_background: hsla(223.0 / 360., 13. / 100., 21. / 100., 1.0),
|
||||
element_hover: hsla(225.0 / 360., 11.8 / 100., 26.7 / 100., 1.0),
|
||||
element_active: hsla(220.0 / 360., 11.8 / 100., 20.0 / 100., 1.0),
|
||||
element_selected: hsla(224.0 / 360., 11.3 / 100., 26.1 / 100., 1.0),
|
||||
element_disabled: SystemColors::default().transparent,
|
||||
drop_target_background: hsla(220.0 / 360., 8.3 / 100., 21.4 / 100., 1.0),
|
||||
ghost_element_background: SystemColors::default().transparent,
|
||||
ghost_element_hover: hsla(225.0 / 360., 11.8 / 100., 26.7 / 100., 1.0),
|
||||
ghost_element_active: hsla(220.0 / 360., 11.8 / 100., 20.0 / 100., 1.0),
|
||||
ghost_element_selected: hsla(224.0 / 360., 11.3 / 100., 26.1 / 100., 1.0),
|
||||
ghost_element_disabled: SystemColors::default().transparent,
|
||||
text: hsla(221. / 360., 11. / 100., 86. / 100., 1.0),
|
||||
text_muted: hsla(218.0 / 360., 7. / 100., 46. / 100., 1.0),
|
||||
text_placeholder: hsla(220.0 / 360., 6.6 / 100., 44.5 / 100., 1.0),
|
||||
text_disabled: hsla(220.0 / 360., 6.6 / 100., 44.5 / 100., 1.0),
|
||||
text_accent: hsla(222.6 / 360., 77.5 / 100., 65.1 / 100., 1.0),
|
||||
icon: hsla(222.9 / 360., 9.9 / 100., 86.1 / 100., 1.0),
|
||||
icon_muted: hsla(220.0 / 360., 12.1 / 100., 66.1 / 100., 1.0),
|
||||
icon_disabled: hsla(220.0 / 360., 6.4 / 100., 45.7 / 100., 1.0),
|
||||
icon_placeholder: hsla(220.0 / 360., 6.4 / 100., 45.7 / 100., 1.0),
|
||||
icon_accent: blue.into(),
|
||||
status_bar_background: bg,
|
||||
title_bar_background: bg,
|
||||
toolbar_background: editor,
|
||||
tab_bar_background: bg,
|
||||
tab_inactive_background: bg,
|
||||
tab_active_background: editor,
|
||||
search_match_background: bg, // todo!(this was inserted by Mikayla)
|
||||
|
||||
editor_background: editor,
|
||||
editor_gutter_background: editor,
|
||||
editor_subheader_background: bg,
|
||||
editor_active_line_background: hsla(222.9 / 360., 13.5 / 100., 20.4 / 100., 1.0),
|
||||
editor_highlighted_line_background: hsla(207.8 / 360., 81. / 100., 66. / 100., 0.1),
|
||||
editor_line_number: hsla(222.0 / 360., 11.5 / 100., 34.1 / 100., 1.0),
|
||||
editor_active_line_number: hsla(216.0 / 360., 5.9 / 100., 49.6 / 100., 1.0),
|
||||
editor_invisible: hsla(222.0 / 360., 11.5 / 100., 34.1 / 100., 1.0),
|
||||
editor_wrap_guide: hsla(228. / 360., 8. / 100., 25. / 100., 1.),
|
||||
editor_active_wrap_guide: hsla(228. / 360., 8. / 100., 25. / 100., 1.),
|
||||
editor_document_highlight_read_background: hsla(
|
||||
207.8 / 360.,
|
||||
81. / 100.,
|
||||
66. / 100.,
|
||||
0.2,
|
||||
),
|
||||
editor_document_highlight_write_background: gpui::red(),
|
||||
|
||||
terminal_background: bg,
|
||||
// todo!("Use one colors for terminal")
|
||||
terminal_ansi_black: crate::black().dark().step_12(),
|
||||
terminal_ansi_red: crate::red().dark().step_11(),
|
||||
terminal_ansi_green: crate::green().dark().step_11(),
|
||||
terminal_ansi_yellow: crate::yellow().dark().step_11(),
|
||||
terminal_ansi_blue: crate::blue().dark().step_11(),
|
||||
terminal_ansi_magenta: crate::violet().dark().step_11(),
|
||||
terminal_ansi_cyan: crate::cyan().dark().step_11(),
|
||||
terminal_ansi_white: crate::neutral().dark().step_12(),
|
||||
terminal_ansi_bright_black: crate::black().dark().step_11(),
|
||||
terminal_ansi_bright_red: crate::red().dark().step_10(),
|
||||
terminal_ansi_bright_green: crate::green().dark().step_10(),
|
||||
terminal_ansi_bright_yellow: crate::yellow().dark().step_10(),
|
||||
terminal_ansi_bright_blue: crate::blue().dark().step_10(),
|
||||
terminal_ansi_bright_magenta: crate::violet().dark().step_10(),
|
||||
terminal_ansi_bright_cyan: crate::cyan().dark().step_10(),
|
||||
terminal_ansi_bright_white: crate::neutral().dark().step_11(),
|
||||
panel_background: bg,
|
||||
panel_focused_border: blue,
|
||||
pane_focused_border: blue,
|
||||
scrollbar_thumb_background: gpui::transparent_black(),
|
||||
scrollbar_thumb_hover_background: hsla(225.0 / 360., 11.8 / 100., 26.7 / 100., 1.0),
|
||||
scrollbar_thumb_border: hsla(228. / 360., 8. / 100., 25. / 100., 1.),
|
||||
scrollbar_track_background: gpui::transparent_black(),
|
||||
scrollbar_track_border: hsla(228. / 360., 8. / 100., 25. / 100., 1.),
|
||||
editor_foreground: hsla(218. / 360., 14. / 100., 71. / 100., 1.),
|
||||
link_text_hover: blue,
|
||||
},
|
||||
status: StatusColors {
|
||||
conflict: yellow,
|
||||
conflict_background: yellow,
|
||||
conflict_border: yellow,
|
||||
created: green,
|
||||
created_background: green,
|
||||
created_border: green,
|
||||
deleted: red,
|
||||
deleted_background: red,
|
||||
deleted_border: red,
|
||||
error: red,
|
||||
error_background: red,
|
||||
error_border: red,
|
||||
hidden: gray,
|
||||
hidden_background: gray,
|
||||
hidden_border: gray,
|
||||
hint: blue,
|
||||
hint_background: blue,
|
||||
hint_border: blue,
|
||||
ignored: gray,
|
||||
ignored_background: gray,
|
||||
ignored_border: gray,
|
||||
info: blue,
|
||||
info_background: blue,
|
||||
info_border: blue,
|
||||
modified: yellow,
|
||||
modified_background: yellow,
|
||||
modified_border: yellow,
|
||||
predictive: gray,
|
||||
predictive_background: gray,
|
||||
predictive_border: gray,
|
||||
renamed: blue,
|
||||
renamed_background: blue,
|
||||
renamed_border: blue,
|
||||
success: green,
|
||||
success_background: green,
|
||||
success_border: green,
|
||||
unreachable: gray,
|
||||
unreachable_background: gray,
|
||||
unreachable_border: gray,
|
||||
warning: yellow,
|
||||
warning_background: yellow,
|
||||
warning_border: yellow,
|
||||
},
|
||||
player: PlayerColors::dark(),
|
||||
syntax: Arc::new(SyntaxTheme {
|
||||
highlights: vec![
|
||||
("attribute".into(), purple.into()),
|
||||
("boolean".into(), orange.into()),
|
||||
("comment".into(), gray.into()),
|
||||
("comment.doc".into(), gray.into()),
|
||||
("constant".into(), yellow.into()),
|
||||
("constructor".into(), blue.into()),
|
||||
("embedded".into(), HighlightStyle::default()),
|
||||
(
|
||||
"emphasis".into(),
|
||||
HighlightStyle {
|
||||
font_style: Some(FontStyle::Italic),
|
||||
..HighlightStyle::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"emphasis.strong".into(),
|
||||
HighlightStyle {
|
||||
font_weight: Some(FontWeight::BOLD),
|
||||
..HighlightStyle::default()
|
||||
},
|
||||
),
|
||||
("enum".into(), HighlightStyle::default()),
|
||||
("function".into(), blue.into()),
|
||||
("function.method".into(), blue.into()),
|
||||
("function.definition".into(), blue.into()),
|
||||
("hint".into(), blue.into()),
|
||||
("keyword".into(), purple.into()),
|
||||
("label".into(), HighlightStyle::default()),
|
||||
("link_text".into(), blue.into()),
|
||||
(
|
||||
"link_uri".into(),
|
||||
HighlightStyle {
|
||||
color: Some(teal.into()),
|
||||
font_style: Some(FontStyle::Italic),
|
||||
..HighlightStyle::default()
|
||||
},
|
||||
),
|
||||
("number".into(), orange.into()),
|
||||
("operator".into(), HighlightStyle::default()),
|
||||
("predictive".into(), HighlightStyle::default()),
|
||||
("preproc".into(), HighlightStyle::default()),
|
||||
("primary".into(), HighlightStyle::default()),
|
||||
("property".into(), red.into()),
|
||||
("punctuation".into(), HighlightStyle::default()),
|
||||
("punctuation.bracket".into(), HighlightStyle::default()),
|
||||
("punctuation.delimiter".into(), HighlightStyle::default()),
|
||||
("punctuation.list_marker".into(), HighlightStyle::default()),
|
||||
("punctuation.special".into(), HighlightStyle::default()),
|
||||
("string".into(), green.into()),
|
||||
("string.escape".into(), HighlightStyle::default()),
|
||||
("string.regex".into(), red.into()),
|
||||
("string.special".into(), HighlightStyle::default()),
|
||||
("string.special.symbol".into(), HighlightStyle::default()),
|
||||
("tag".into(), HighlightStyle::default()),
|
||||
("text.literal".into(), HighlightStyle::default()),
|
||||
("title".into(), HighlightStyle::default()),
|
||||
("type".into(), teal.into()),
|
||||
("variable".into(), HighlightStyle::default()),
|
||||
("variable.special".into(), red.into()),
|
||||
("variant".into(), HighlightStyle::default()),
|
||||
],
|
||||
}),
|
||||
accents: vec![blue, orange, purple, teal],
|
||||
},
|
||||
}
|
||||
}
|
6
crates/theme/src/prelude.rs
Normal file
6
crates/theme/src/prelude.rs
Normal file
|
@ -0,0 +1,6 @@
|
|||
#[allow(unused)]
|
||||
pub(crate) use crate::default_colors::{
|
||||
amber, black, blue, bronze, brown, crimson, cyan, gold, grass, gray, green, indigo, iris, jade,
|
||||
lime, mauve, mint, olive, orange, pink, plum, purple, red, ruby, sage, sand, sky, slate, teal,
|
||||
tomato, violet, white, yellow,
|
||||
};
|
147
crates/theme/src/registry.rs
Normal file
147
crates/theme/src/registry.rs
Normal file
|
@ -0,0 +1,147 @@
|
|||
use std::collections::HashMap;
|
||||
use std::sync::Arc;
|
||||
|
||||
use anyhow::{anyhow, Result};
|
||||
use gpui::{HighlightStyle, SharedString};
|
||||
use refineable::Refineable;
|
||||
|
||||
use crate::{
|
||||
Appearance, PlayerColors, StatusColors, SyntaxTheme, SystemColors, Theme, ThemeColors,
|
||||
ThemeFamily, ThemeStyles, UserTheme, UserThemeFamily,
|
||||
};
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct ThemeMeta {
|
||||
pub name: SharedString,
|
||||
pub appearance: Appearance,
|
||||
}
|
||||
|
||||
pub struct ThemeRegistry {
|
||||
themes: HashMap<SharedString, Arc<Theme>>,
|
||||
}
|
||||
|
||||
impl ThemeRegistry {
|
||||
fn insert_theme_families(&mut self, families: impl IntoIterator<Item = ThemeFamily>) {
|
||||
for family in families.into_iter() {
|
||||
self.insert_themes(family.themes);
|
||||
}
|
||||
}
|
||||
|
||||
fn insert_themes(&mut self, themes: impl IntoIterator<Item = Theme>) {
|
||||
for theme in themes.into_iter() {
|
||||
self.themes.insert(theme.name.clone(), Arc::new(theme));
|
||||
}
|
||||
}
|
||||
|
||||
#[allow(unused)]
|
||||
fn insert_user_theme_families(&mut self, families: impl IntoIterator<Item = UserThemeFamily>) {
|
||||
for family in families.into_iter() {
|
||||
self.insert_user_themes(family.themes);
|
||||
}
|
||||
}
|
||||
|
||||
#[allow(unused)]
|
||||
fn insert_user_themes(&mut self, themes: impl IntoIterator<Item = UserTheme>) {
|
||||
self.insert_themes(themes.into_iter().map(|user_theme| {
|
||||
let mut theme_colors = match user_theme.appearance {
|
||||
Appearance::Light => ThemeColors::light(),
|
||||
Appearance::Dark => ThemeColors::dark(),
|
||||
};
|
||||
theme_colors.refine(&user_theme.styles.colors);
|
||||
|
||||
let mut status_colors = match user_theme.appearance {
|
||||
Appearance::Light => StatusColors::light(),
|
||||
Appearance::Dark => StatusColors::dark(),
|
||||
};
|
||||
status_colors.refine(&user_theme.styles.status);
|
||||
|
||||
let mut player_colors = match user_theme.appearance {
|
||||
Appearance::Light => PlayerColors::light(),
|
||||
Appearance::Dark => PlayerColors::dark(),
|
||||
};
|
||||
if let Some(player_colors_from_theme) = user_theme.styles.player {
|
||||
player_colors = player_colors_from_theme;
|
||||
}
|
||||
|
||||
let mut syntax_colors = match user_theme.appearance {
|
||||
Appearance::Light => SyntaxTheme::light(),
|
||||
Appearance::Dark => SyntaxTheme::dark(),
|
||||
};
|
||||
if let Some(user_syntax) = user_theme.styles.syntax {
|
||||
syntax_colors.highlights = user_syntax
|
||||
.highlights
|
||||
.iter()
|
||||
.map(|(syntax_token, highlight)| {
|
||||
(
|
||||
syntax_token.clone(),
|
||||
HighlightStyle {
|
||||
color: highlight.color,
|
||||
font_style: highlight.font_style.map(Into::into),
|
||||
font_weight: highlight.font_weight.map(Into::into),
|
||||
..Default::default()
|
||||
},
|
||||
)
|
||||
})
|
||||
.collect::<Vec<_>>();
|
||||
}
|
||||
|
||||
Theme {
|
||||
id: uuid::Uuid::new_v4().to_string(),
|
||||
name: user_theme.name.into(),
|
||||
appearance: user_theme.appearance,
|
||||
styles: ThemeStyles {
|
||||
system: SystemColors::default(),
|
||||
colors: theme_colors,
|
||||
status: status_colors,
|
||||
player: player_colors,
|
||||
syntax: Arc::new(syntax_colors),
|
||||
accents: Vec::new(),
|
||||
},
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
||||
pub fn clear(&mut self) {
|
||||
self.themes.clear();
|
||||
}
|
||||
|
||||
pub fn list_names(&self, _staff: bool) -> impl Iterator<Item = SharedString> + '_ {
|
||||
self.themes.keys().cloned()
|
||||
}
|
||||
|
||||
pub fn list(&self, _staff: bool) -> impl Iterator<Item = ThemeMeta> + '_ {
|
||||
self.themes.values().map(|theme| ThemeMeta {
|
||||
name: theme.name.clone(),
|
||||
appearance: theme.appearance(),
|
||||
})
|
||||
}
|
||||
|
||||
pub fn get(&self, name: &str) -> Result<Arc<Theme>> {
|
||||
self.themes
|
||||
.get(name)
|
||||
.ok_or_else(|| anyhow!("theme not found: {}", name))
|
||||
.cloned()
|
||||
}
|
||||
|
||||
pub fn load_user_themes(&mut self) {
|
||||
#[cfg(not(feature = "importing-themes"))]
|
||||
self.insert_user_theme_families(crate::all_user_themes());
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for ThemeRegistry {
|
||||
fn default() -> Self {
|
||||
let mut registry = Self {
|
||||
themes: HashMap::default(),
|
||||
};
|
||||
|
||||
// We're loading our new versions of the One themes by default, as
|
||||
// we need them to be loaded for tests.
|
||||
//
|
||||
// These themes will get overwritten when `load_user_themes` is called
|
||||
// when Zed starts, so the One variants used will be the ones ported from Zed1.
|
||||
registry.insert_theme_families([crate::one_themes::one_family()]);
|
||||
|
||||
registry
|
||||
}
|
||||
}
|
290
crates/theme/src/scale.rs
Normal file
290
crates/theme/src/scale.rs
Normal file
|
@ -0,0 +1,290 @@
|
|||
use gpui::{AppContext, Hsla, SharedString};
|
||||
|
||||
use crate::{ActiveTheme, Appearance};
|
||||
|
||||
/// A one-based step in a [`ColorScale`].
|
||||
#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Clone, Copy)]
|
||||
pub struct ColorScaleStep(usize);
|
||||
|
||||
impl ColorScaleStep {
|
||||
pub const ONE: Self = Self(1);
|
||||
pub const TWO: Self = Self(2);
|
||||
pub const THREE: Self = Self(3);
|
||||
pub const FOUR: Self = Self(4);
|
||||
pub const FIVE: Self = Self(5);
|
||||
pub const SIX: Self = Self(6);
|
||||
pub const SEVEN: Self = Self(7);
|
||||
pub const EIGHT: Self = Self(8);
|
||||
pub const NINE: Self = Self(9);
|
||||
pub const TEN: Self = Self(10);
|
||||
pub const ELEVEN: Self = Self(11);
|
||||
pub const TWELVE: Self = Self(12);
|
||||
|
||||
/// All of the steps in a [`ColorScale`].
|
||||
pub const ALL: [ColorScaleStep; 12] = [
|
||||
Self::ONE,
|
||||
Self::TWO,
|
||||
Self::THREE,
|
||||
Self::FOUR,
|
||||
Self::FIVE,
|
||||
Self::SIX,
|
||||
Self::SEVEN,
|
||||
Self::EIGHT,
|
||||
Self::NINE,
|
||||
Self::TEN,
|
||||
Self::ELEVEN,
|
||||
Self::TWELVE,
|
||||
];
|
||||
}
|
||||
|
||||
pub struct ColorScale(Vec<Hsla>);
|
||||
|
||||
impl FromIterator<Hsla> for ColorScale {
|
||||
fn from_iter<T: IntoIterator<Item = Hsla>>(iter: T) -> Self {
|
||||
Self(Vec::from_iter(iter))
|
||||
}
|
||||
}
|
||||
|
||||
impl ColorScale {
|
||||
/// Returns the specified step in the [`ColorScale`].
|
||||
#[inline]
|
||||
pub fn step(&self, step: ColorScaleStep) -> Hsla {
|
||||
// Steps are one-based, so we need convert to the zero-based vec index.
|
||||
self.0[step.0 - 1]
|
||||
}
|
||||
|
||||
/// `Step 1` - Used for main application backgrounds.
|
||||
///
|
||||
/// This step provides a neutral base for any overlaying components, ideal for applications' main backdrop or empty spaces such as canvas areas.
|
||||
///
|
||||
#[inline]
|
||||
pub fn step_1(&self) -> Hsla {
|
||||
self.step(ColorScaleStep::ONE)
|
||||
}
|
||||
|
||||
/// `Step 2` - Used for both main application backgrounds and subtle component backgrounds.
|
||||
///
|
||||
/// Like `Step 1`, this step allows variations in background styles, from striped tables, sidebar backgrounds, to card backgrounds.
|
||||
#[inline]
|
||||
pub fn step_2(&self) -> Hsla {
|
||||
self.step(ColorScaleStep::TWO)
|
||||
}
|
||||
|
||||
/// `Step 3` - Used for UI component backgrounds in their normal states.
|
||||
///
|
||||
/// This step maintains accessibility by guaranteeing a contrast ratio of 4.5:1 with steps 11 and 12 for text. It could also suit hover states for transparent components.
|
||||
#[inline]
|
||||
pub fn step_3(&self) -> Hsla {
|
||||
self.step(ColorScaleStep::THREE)
|
||||
}
|
||||
|
||||
/// `Step 4` - Used for UI component backgrounds in their hover states.
|
||||
///
|
||||
/// Also suited for pressed or selected states of components with a transparent background.
|
||||
#[inline]
|
||||
pub fn step_4(&self) -> Hsla {
|
||||
self.step(ColorScaleStep::FOUR)
|
||||
}
|
||||
|
||||
/// `Step 5` - Used for UI component backgrounds in their pressed or selected states.
|
||||
#[inline]
|
||||
pub fn step_5(&self) -> Hsla {
|
||||
self.step(ColorScaleStep::FIVE)
|
||||
}
|
||||
|
||||
/// `Step 6` - Used for subtle borders on non-interactive components.
|
||||
///
|
||||
/// Its usage spans from sidebars' borders, headers' dividers, cards' outlines, to alerts' edges and separators.
|
||||
#[inline]
|
||||
pub fn step_6(&self) -> Hsla {
|
||||
self.step(ColorScaleStep::SIX)
|
||||
}
|
||||
|
||||
/// `Step 7` - Used for subtle borders on interactive components.
|
||||
///
|
||||
/// This step subtly delineates the boundary of elements users interact with.
|
||||
#[inline]
|
||||
pub fn step_7(&self) -> Hsla {
|
||||
self.step(ColorScaleStep::SEVEN)
|
||||
}
|
||||
|
||||
/// `Step 8` - Used for stronger borders on interactive components and focus rings.
|
||||
///
|
||||
/// It strengthens the visibility and accessibility of active elements and their focus states.
|
||||
#[inline]
|
||||
pub fn step_8(&self) -> Hsla {
|
||||
self.step(ColorScaleStep::EIGHT)
|
||||
}
|
||||
|
||||
/// `Step 9` - Used for solid backgrounds.
|
||||
///
|
||||
/// `Step 9` is the most saturated step, having the least mix of white or black.
|
||||
///
|
||||
/// Due to its high chroma, `Step 9` is versatile and particularly useful for semantic colors such as
|
||||
/// error, warning, and success indicators.
|
||||
#[inline]
|
||||
pub fn step_9(&self) -> Hsla {
|
||||
self.step(ColorScaleStep::NINE)
|
||||
}
|
||||
|
||||
/// `Step 10` - Used for hovered or active solid backgrounds, particularly when `Step 9` is their normal state.
|
||||
///
|
||||
/// May also be used for extremely low contrast text. This should be used sparingly, as it may be difficult to read.
|
||||
#[inline]
|
||||
pub fn step_10(&self) -> Hsla {
|
||||
self.step(ColorScaleStep::TEN)
|
||||
}
|
||||
|
||||
/// `Step 11` - Used for text and icons requiring low contrast or less emphasis.
|
||||
#[inline]
|
||||
pub fn step_11(&self) -> Hsla {
|
||||
self.step(ColorScaleStep::ELEVEN)
|
||||
}
|
||||
|
||||
/// `Step 12` - Used for text and icons requiring high contrast or prominence.
|
||||
#[inline]
|
||||
pub fn step_12(&self) -> Hsla {
|
||||
self.step(ColorScaleStep::TWELVE)
|
||||
}
|
||||
}
|
||||
|
||||
pub struct ColorScales {
|
||||
pub gray: ColorScaleSet,
|
||||
pub mauve: ColorScaleSet,
|
||||
pub slate: ColorScaleSet,
|
||||
pub sage: ColorScaleSet,
|
||||
pub olive: ColorScaleSet,
|
||||
pub sand: ColorScaleSet,
|
||||
pub gold: ColorScaleSet,
|
||||
pub bronze: ColorScaleSet,
|
||||
pub brown: ColorScaleSet,
|
||||
pub yellow: ColorScaleSet,
|
||||
pub amber: ColorScaleSet,
|
||||
pub orange: ColorScaleSet,
|
||||
pub tomato: ColorScaleSet,
|
||||
pub red: ColorScaleSet,
|
||||
pub ruby: ColorScaleSet,
|
||||
pub crimson: ColorScaleSet,
|
||||
pub pink: ColorScaleSet,
|
||||
pub plum: ColorScaleSet,
|
||||
pub purple: ColorScaleSet,
|
||||
pub violet: ColorScaleSet,
|
||||
pub iris: ColorScaleSet,
|
||||
pub indigo: ColorScaleSet,
|
||||
pub blue: ColorScaleSet,
|
||||
pub cyan: ColorScaleSet,
|
||||
pub teal: ColorScaleSet,
|
||||
pub jade: ColorScaleSet,
|
||||
pub green: ColorScaleSet,
|
||||
pub grass: ColorScaleSet,
|
||||
pub lime: ColorScaleSet,
|
||||
pub mint: ColorScaleSet,
|
||||
pub sky: ColorScaleSet,
|
||||
pub black: ColorScaleSet,
|
||||
pub white: ColorScaleSet,
|
||||
}
|
||||
|
||||
impl IntoIterator for ColorScales {
|
||||
type Item = ColorScaleSet;
|
||||
|
||||
type IntoIter = std::vec::IntoIter<Self::Item>;
|
||||
|
||||
fn into_iter(self) -> Self::IntoIter {
|
||||
vec![
|
||||
self.gray,
|
||||
self.mauve,
|
||||
self.slate,
|
||||
self.sage,
|
||||
self.olive,
|
||||
self.sand,
|
||||
self.gold,
|
||||
self.bronze,
|
||||
self.brown,
|
||||
self.yellow,
|
||||
self.amber,
|
||||
self.orange,
|
||||
self.tomato,
|
||||
self.red,
|
||||
self.ruby,
|
||||
self.crimson,
|
||||
self.pink,
|
||||
self.plum,
|
||||
self.purple,
|
||||
self.violet,
|
||||
self.iris,
|
||||
self.indigo,
|
||||
self.blue,
|
||||
self.cyan,
|
||||
self.teal,
|
||||
self.jade,
|
||||
self.green,
|
||||
self.grass,
|
||||
self.lime,
|
||||
self.mint,
|
||||
self.sky,
|
||||
self.black,
|
||||
self.white,
|
||||
]
|
||||
.into_iter()
|
||||
}
|
||||
}
|
||||
|
||||
pub struct ColorScaleSet {
|
||||
name: SharedString,
|
||||
light: ColorScale,
|
||||
dark: ColorScale,
|
||||
light_alpha: ColorScale,
|
||||
dark_alpha: ColorScale,
|
||||
}
|
||||
|
||||
impl ColorScaleSet {
|
||||
pub fn new(
|
||||
name: impl Into<SharedString>,
|
||||
light: ColorScale,
|
||||
light_alpha: ColorScale,
|
||||
dark: ColorScale,
|
||||
dark_alpha: ColorScale,
|
||||
) -> Self {
|
||||
Self {
|
||||
name: name.into(),
|
||||
light,
|
||||
light_alpha,
|
||||
dark,
|
||||
dark_alpha,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn name(&self) -> &SharedString {
|
||||
&self.name
|
||||
}
|
||||
|
||||
pub fn light(&self) -> &ColorScale {
|
||||
&self.light
|
||||
}
|
||||
|
||||
pub fn light_alpha(&self) -> &ColorScale {
|
||||
&self.light_alpha
|
||||
}
|
||||
|
||||
pub fn dark(&self) -> &ColorScale {
|
||||
&self.dark
|
||||
}
|
||||
|
||||
pub fn dark_alpha(&self) -> &ColorScale {
|
||||
&self.dark_alpha
|
||||
}
|
||||
|
||||
pub fn step(&self, cx: &AppContext, step: ColorScaleStep) -> Hsla {
|
||||
match cx.theme().appearance {
|
||||
Appearance::Light => self.light().step(step),
|
||||
Appearance::Dark => self.dark().step(step),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn step_alpha(&self, cx: &AppContext, step: ColorScaleStep) -> Hsla {
|
||||
match cx.theme().appearance {
|
||||
Appearance::Light => self.light_alpha.step(step),
|
||||
Appearance::Dark => self.dark_alpha.step(step),
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,6 +1,7 @@
|
|||
use crate::one_themes::one_dark;
|
||||
use crate::{Theme, ThemeRegistry};
|
||||
use anyhow::Result;
|
||||
use gpui::{font_cache::FamilyId, fonts, AppContext};
|
||||
use gpui::{px, AppContext, Font, FontFeatures, FontStyle, FontWeight, Pixels};
|
||||
use schemars::{
|
||||
gen::SchemaGenerator,
|
||||
schema::{InstanceType, Schema, SchemaObject},
|
||||
|
@ -8,28 +9,34 @@ use schemars::{
|
|||
};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serde_json::Value;
|
||||
use settings::SettingsJsonSchemaParams;
|
||||
use settings::{Settings, SettingsJsonSchemaParams};
|
||||
use std::sync::Arc;
|
||||
use util::ResultExt as _;
|
||||
|
||||
const MIN_FONT_SIZE: f32 = 6.0;
|
||||
const MIN_FONT_SIZE: Pixels = px(6.0);
|
||||
const MIN_LINE_HEIGHT: f32 = 1.0;
|
||||
|
||||
#[derive(Clone, JsonSchema)]
|
||||
#[derive(Clone)]
|
||||
pub struct ThemeSettings {
|
||||
pub buffer_font_family_name: String,
|
||||
pub buffer_font_features: fonts::Features,
|
||||
pub buffer_font_family: FamilyId,
|
||||
pub(crate) buffer_font_size: f32,
|
||||
pub(crate) buffer_line_height: BufferLineHeight,
|
||||
#[serde(skip)]
|
||||
pub theme: Arc<Theme>,
|
||||
pub ui_font_size: Pixels,
|
||||
pub ui_font: Font,
|
||||
pub buffer_font: Font,
|
||||
pub buffer_font_size: Pixels,
|
||||
pub buffer_line_height: BufferLineHeight,
|
||||
pub active_theme: Arc<Theme>,
|
||||
}
|
||||
|
||||
pub struct AdjustedBufferFontSize(pub f32);
|
||||
#[derive(Default)]
|
||||
pub struct AdjustedBufferFontSize(Pixels);
|
||||
|
||||
#[derive(Clone, Debug, Default, Serialize, Deserialize, JsonSchema)]
|
||||
pub struct ThemeSettingsContent {
|
||||
#[serde(default)]
|
||||
pub ui_font_size: Option<f32>,
|
||||
#[serde(default)]
|
||||
pub ui_font_family: Option<String>,
|
||||
#[serde(default)]
|
||||
pub ui_font_features: Option<FontFeatures>,
|
||||
#[serde(default)]
|
||||
pub buffer_font_family: Option<String>,
|
||||
#[serde(default)]
|
||||
|
@ -37,7 +44,7 @@ pub struct ThemeSettingsContent {
|
|||
#[serde(default)]
|
||||
pub buffer_line_height: Option<BufferLineHeight>,
|
||||
#[serde(default)]
|
||||
pub buffer_font_features: Option<fonts::Features>,
|
||||
pub buffer_font_features: Option<FontFeatures>,
|
||||
#[serde(default)]
|
||||
pub theme: Option<String>,
|
||||
}
|
||||
|
@ -62,13 +69,10 @@ impl BufferLineHeight {
|
|||
}
|
||||
|
||||
impl ThemeSettings {
|
||||
pub fn buffer_font_size(&self, cx: &AppContext) -> f32 {
|
||||
if cx.has_global::<AdjustedBufferFontSize>() {
|
||||
cx.global::<AdjustedBufferFontSize>().0
|
||||
} else {
|
||||
self.buffer_font_size
|
||||
}
|
||||
.max(MIN_FONT_SIZE)
|
||||
pub fn buffer_font_size(&self, cx: &AppContext) -> Pixels {
|
||||
cx.try_global::<AdjustedBufferFontSize>()
|
||||
.map_or(self.buffer_font_size, |size| size.0)
|
||||
.max(MIN_FONT_SIZE)
|
||||
}
|
||||
|
||||
pub fn line_height(&self) -> f32 {
|
||||
|
@ -76,10 +80,10 @@ impl ThemeSettings {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn adjusted_font_size(size: f32, cx: &AppContext) -> f32 {
|
||||
if cx.has_global::<AdjustedBufferFontSize>() {
|
||||
let buffer_font_size = settings::get::<ThemeSettings>(cx).buffer_font_size;
|
||||
let delta = cx.global::<AdjustedBufferFontSize>().0 - buffer_font_size;
|
||||
pub fn adjusted_font_size(size: Pixels, cx: &mut AppContext) -> Pixels {
|
||||
if let Some(AdjustedBufferFontSize(adjusted_size)) = cx.try_global::<AdjustedBufferFontSize>() {
|
||||
let buffer_font_size = ThemeSettings::get_global(cx).buffer_font_size;
|
||||
let delta = *adjusted_size - buffer_font_size;
|
||||
size + delta
|
||||
} else {
|
||||
size
|
||||
|
@ -87,29 +91,26 @@ pub fn adjusted_font_size(size: f32, cx: &AppContext) -> f32 {
|
|||
.max(MIN_FONT_SIZE)
|
||||
}
|
||||
|
||||
pub fn adjust_font_size(cx: &mut AppContext, f: fn(&mut f32)) {
|
||||
if !cx.has_global::<AdjustedBufferFontSize>() {
|
||||
let buffer_font_size = settings::get::<ThemeSettings>(cx).buffer_font_size;
|
||||
cx.set_global(AdjustedBufferFontSize(buffer_font_size));
|
||||
}
|
||||
pub fn adjust_font_size(cx: &mut AppContext, f: fn(&mut Pixels)) {
|
||||
let buffer_font_size = ThemeSettings::get_global(cx).buffer_font_size;
|
||||
let mut adjusted_size = cx
|
||||
.try_global::<AdjustedBufferFontSize>()
|
||||
.map_or(buffer_font_size, |adjusted_size| adjusted_size.0);
|
||||
|
||||
cx.update_global::<AdjustedBufferFontSize, _, _>(|delta, cx| {
|
||||
f(&mut delta.0);
|
||||
delta.0 = delta
|
||||
.0
|
||||
.max(MIN_FONT_SIZE - settings::get::<ThemeSettings>(cx).buffer_font_size);
|
||||
});
|
||||
cx.refresh_windows();
|
||||
f(&mut adjusted_size);
|
||||
adjusted_size = adjusted_size.max(MIN_FONT_SIZE);
|
||||
cx.set_global(AdjustedBufferFontSize(adjusted_size));
|
||||
cx.refresh();
|
||||
}
|
||||
|
||||
pub fn reset_font_size(cx: &mut AppContext) {
|
||||
if cx.has_global::<AdjustedBufferFontSize>() {
|
||||
cx.remove_global::<AdjustedBufferFontSize>();
|
||||
cx.refresh_windows();
|
||||
cx.refresh();
|
||||
}
|
||||
}
|
||||
|
||||
impl settings::Setting for ThemeSettings {
|
||||
impl settings::Settings for ThemeSettings {
|
||||
const KEY: Option<&'static str> = None;
|
||||
|
||||
type FileContent = ThemeSettingsContent;
|
||||
|
@ -117,53 +118,58 @@ impl settings::Setting for ThemeSettings {
|
|||
fn load(
|
||||
defaults: &Self::FileContent,
|
||||
user_values: &[&Self::FileContent],
|
||||
cx: &AppContext,
|
||||
cx: &mut AppContext,
|
||||
) -> Result<Self> {
|
||||
let buffer_font_features = defaults.buffer_font_features.clone().unwrap();
|
||||
let themes = cx.global::<Arc<ThemeRegistry>>();
|
||||
let themes = cx.default_global::<ThemeRegistry>();
|
||||
|
||||
let mut this = Self {
|
||||
buffer_font_family: cx
|
||||
.font_cache()
|
||||
.load_family(
|
||||
&[defaults.buffer_font_family.as_ref().unwrap()],
|
||||
&buffer_font_features,
|
||||
)
|
||||
.unwrap(),
|
||||
buffer_font_family_name: defaults.buffer_font_family.clone().unwrap(),
|
||||
buffer_font_features,
|
||||
buffer_font_size: defaults.buffer_font_size.unwrap(),
|
||||
ui_font_size: defaults.ui_font_size.unwrap().into(),
|
||||
ui_font: Font {
|
||||
family: defaults.ui_font_family.clone().unwrap().into(),
|
||||
features: defaults.ui_font_features.clone().unwrap(),
|
||||
weight: Default::default(),
|
||||
style: Default::default(),
|
||||
},
|
||||
buffer_font: Font {
|
||||
family: defaults.buffer_font_family.clone().unwrap().into(),
|
||||
features: defaults.buffer_font_features.clone().unwrap(),
|
||||
weight: FontWeight::default(),
|
||||
style: FontStyle::default(),
|
||||
},
|
||||
buffer_font_size: defaults.buffer_font_size.unwrap().into(),
|
||||
buffer_line_height: defaults.buffer_line_height.unwrap(),
|
||||
theme: themes.get(defaults.theme.as_ref().unwrap()).unwrap(),
|
||||
active_theme: themes
|
||||
.get(defaults.theme.as_ref().unwrap())
|
||||
.or(themes.get(&one_dark().name))
|
||||
.unwrap(),
|
||||
};
|
||||
|
||||
for value in user_values.into_iter().copied().cloned() {
|
||||
let font_cache = cx.font_cache();
|
||||
let mut family_changed = false;
|
||||
if let Some(value) = value.buffer_font_family {
|
||||
this.buffer_font_family_name = value;
|
||||
family_changed = true;
|
||||
this.buffer_font.family = value.into();
|
||||
}
|
||||
if let Some(value) = value.buffer_font_features {
|
||||
this.buffer_font_features = value;
|
||||
family_changed = true;
|
||||
this.buffer_font.features = value;
|
||||
}
|
||||
if family_changed {
|
||||
if let Some(id) = font_cache
|
||||
.load_family(&[&this.buffer_font_family_name], &this.buffer_font_features)
|
||||
.log_err()
|
||||
{
|
||||
this.buffer_font_family = id;
|
||||
}
|
||||
|
||||
if let Some(value) = value.ui_font_family {
|
||||
this.ui_font.family = value.into();
|
||||
}
|
||||
if let Some(value) = value.ui_font_features {
|
||||
this.ui_font.features = value;
|
||||
}
|
||||
|
||||
if let Some(value) = &value.theme {
|
||||
if let Some(theme) = themes.get(value).log_err() {
|
||||
this.theme = theme;
|
||||
this.active_theme = theme;
|
||||
}
|
||||
}
|
||||
|
||||
merge(&mut this.buffer_font_size, value.buffer_font_size);
|
||||
merge(&mut this.ui_font_size, value.ui_font_size.map(Into::into));
|
||||
merge(
|
||||
&mut this.buffer_font_size,
|
||||
value.buffer_font_size.map(Into::into),
|
||||
);
|
||||
merge(&mut this.buffer_line_height, value.buffer_line_height);
|
||||
}
|
||||
|
||||
|
@ -177,7 +183,7 @@ impl settings::Setting for ThemeSettings {
|
|||
) -> schemars::schema::RootSchema {
|
||||
let mut root_schema = generator.root_schema_for::<ThemeSettingsContent>();
|
||||
let theme_names = cx
|
||||
.global::<Arc<ThemeRegistry>>()
|
||||
.global::<ThemeRegistry>()
|
||||
.list_names(params.staff_mode)
|
||||
.map(|theme_name| Value::String(theme_name.to_string()))
|
||||
.collect();
|
17
crates/theme/src/styles.rs
Normal file
17
crates/theme/src/styles.rs
Normal file
|
@ -0,0 +1,17 @@
|
|||
mod colors;
|
||||
mod players;
|
||||
mod status;
|
||||
mod syntax;
|
||||
mod system;
|
||||
|
||||
#[cfg(feature = "stories")]
|
||||
mod stories;
|
||||
|
||||
pub use colors::*;
|
||||
pub use players::*;
|
||||
pub use status::*;
|
||||
pub use syntax::*;
|
||||
pub use system::*;
|
||||
|
||||
#[cfg(feature = "stories")]
|
||||
pub use stories::*;
|
284
crates/theme/src/styles/colors.rs
Normal file
284
crates/theme/src/styles/colors.rs
Normal file
|
@ -0,0 +1,284 @@
|
|||
use gpui::Hsla;
|
||||
use refineable::Refineable;
|
||||
use std::sync::Arc;
|
||||
|
||||
use crate::{PlayerColors, StatusColors, SyntaxTheme, SystemColors};
|
||||
|
||||
#[derive(Refineable, Clone, Debug)]
|
||||
#[refineable(Debug, serde::Deserialize)]
|
||||
pub struct ThemeColors {
|
||||
pub border: Hsla,
|
||||
/// Border color. Used for deemphasized borders, like a visual divider between two sections
|
||||
pub border_variant: Hsla,
|
||||
/// Border color. Used for focused elements, like keyboard focused list item.
|
||||
pub border_focused: Hsla,
|
||||
/// Border color. Used for selected elements, like an active search filter or selected checkbox.
|
||||
pub border_selected: Hsla,
|
||||
/// Border color. Used for transparent borders. Used for placeholder borders when an element gains a border on state change.
|
||||
pub border_transparent: Hsla,
|
||||
/// Border color. Used for disabled elements, like a disabled input or button.
|
||||
pub border_disabled: Hsla,
|
||||
/// Border color. Used for elevated surfaces, like a context menu, popup, or dialog.
|
||||
pub elevated_surface_background: Hsla,
|
||||
/// Background Color. Used for grounded surfaces like a panel or tab.
|
||||
pub surface_background: Hsla,
|
||||
/// Background Color. Used for the app background and blank panels or windows.
|
||||
pub background: Hsla,
|
||||
/// Background Color. Used for the background of an element that should have a different background than the surface it's on.
|
||||
///
|
||||
/// Elements might include: Buttons, Inputs, Checkboxes, Radio Buttons...
|
||||
///
|
||||
/// For an element that should have the same background as the surface it's on, use `ghost_element_background`.
|
||||
pub element_background: Hsla,
|
||||
/// Background Color. Used for the hover state of an element that should have a different background than the surface it's on.
|
||||
///
|
||||
/// Hover states are triggered by the mouse entering an element, or a finger touching an element on a touch screen.
|
||||
pub element_hover: Hsla,
|
||||
/// Background Color. Used for the active state of an element that should have a different background than the surface it's on.
|
||||
///
|
||||
/// Active states are triggered by the mouse button being pressed down on an element, or the Return button or other activator being pressd.
|
||||
pub element_active: Hsla,
|
||||
/// Background Color. Used for the selected state of an element that should have a different background than the surface it's on.
|
||||
///
|
||||
/// Selected states are triggered by the element being selected (or "activated") by the user.
|
||||
///
|
||||
/// This could include a selected checkbox, a toggleable button that is toggled on, etc.
|
||||
pub element_selected: Hsla,
|
||||
/// Background Color. Used for the disabled state of an element that should have a different background than the surface it's on.
|
||||
///
|
||||
/// Disabled states are shown when a user cannot interact with an element, like a disabled button or input.
|
||||
pub element_disabled: Hsla,
|
||||
/// Background Color. Used for the area that shows where a dragged element will be dropped.
|
||||
pub drop_target_background: Hsla,
|
||||
/// Border Color. Used to show the area that shows where a dragged element will be dropped.
|
||||
// pub drop_target_border: Hsla,
|
||||
/// Used for the background of a ghost element that should have the same background as the surface it's on.
|
||||
///
|
||||
/// Elements might include: Buttons, Inputs, Checkboxes, Radio Buttons...
|
||||
///
|
||||
/// For an element that should have a different background than the surface it's on, use `element_background`.
|
||||
pub ghost_element_background: Hsla,
|
||||
/// Background Color. Used for the hover state of a ghost element that should have the same background as the surface it's on.
|
||||
///
|
||||
/// Hover states are triggered by the mouse entering an element, or a finger touching an element on a touch screen.
|
||||
pub ghost_element_hover: Hsla,
|
||||
/// Background Color. Used for the active state of a ghost element that should have the same background as the surface it's on.
|
||||
///
|
||||
/// Active states are triggered by the mouse button being pressed down on an element, or the Return button or other activator being pressd.
|
||||
pub ghost_element_active: Hsla,
|
||||
/// Background Color. Used for the selected state of a ghost element that should have the same background as the surface it's on.
|
||||
///
|
||||
/// Selected states are triggered by the element being selected (or "activated") by the user.
|
||||
///
|
||||
/// This could include a selected checkbox, a toggleable button that is toggled on, etc.
|
||||
pub ghost_element_selected: Hsla,
|
||||
/// Background Color. Used for the disabled state of a ghost element that should have the same background as the surface it's on.
|
||||
///
|
||||
/// Disabled states are shown when a user cannot interact with an element, like a disabled button or input.
|
||||
pub ghost_element_disabled: Hsla,
|
||||
/// Text Color. Default text color used for most text.
|
||||
pub text: Hsla,
|
||||
/// Text Color. Color of muted or deemphasized text. It is a subdued version of the standard text color.
|
||||
pub text_muted: Hsla,
|
||||
/// Text Color. Color of the placeholder text typically shown in input fields to guide the user to enter valid data.
|
||||
pub text_placeholder: Hsla,
|
||||
/// Text Color. Color used for text denoting disabled elements. Typically, the color is faded or grayed out to emphasize the disabled state.
|
||||
pub text_disabled: Hsla,
|
||||
/// Text Color. Color used for emphasis or highlighting certain text, like an active filter or a matched character in a search.
|
||||
pub text_accent: Hsla,
|
||||
/// Fill Color. Used for the default fill color of an icon.
|
||||
pub icon: Hsla,
|
||||
/// Fill Color. Used for the muted or deemphasized fill color of an icon.
|
||||
///
|
||||
/// This might be used to show an icon in an inactive pane, or to demphasize a series of icons to give them less visual weight.
|
||||
pub icon_muted: Hsla,
|
||||
/// Fill Color. Used for the disabled fill color of an icon.
|
||||
///
|
||||
/// Disabled states are shown when a user cannot interact with an element, like a icon button.
|
||||
pub icon_disabled: Hsla,
|
||||
/// Fill Color. Used for the placeholder fill color of an icon.
|
||||
///
|
||||
/// This might be used to show an icon in an input that disappears when the user enters text.
|
||||
pub icon_placeholder: Hsla,
|
||||
/// Fill Color. Used for the accent fill color of an icon.
|
||||
///
|
||||
/// This might be used to show when a toggleable icon button is selected.
|
||||
pub icon_accent: Hsla,
|
||||
|
||||
// ===
|
||||
// UI Elements
|
||||
// ===
|
||||
pub status_bar_background: Hsla,
|
||||
pub title_bar_background: Hsla,
|
||||
pub toolbar_background: Hsla,
|
||||
pub tab_bar_background: Hsla,
|
||||
pub tab_inactive_background: Hsla,
|
||||
pub tab_active_background: Hsla,
|
||||
pub search_match_background: Hsla,
|
||||
pub panel_background: Hsla,
|
||||
pub panel_focused_border: Hsla,
|
||||
pub pane_focused_border: Hsla,
|
||||
/// The color of the scrollbar thumb.
|
||||
pub scrollbar_thumb_background: Hsla,
|
||||
/// The color of the scrollbar thumb when hovered over.
|
||||
pub scrollbar_thumb_hover_background: Hsla,
|
||||
/// The border color of the scrollbar thumb.
|
||||
pub scrollbar_thumb_border: Hsla,
|
||||
/// The background color of the scrollbar track.
|
||||
pub scrollbar_track_background: Hsla,
|
||||
/// The border color of the scrollbar track.
|
||||
pub scrollbar_track_border: Hsla,
|
||||
// /// The opacity of the scrollbar status marks, like diagnostic states and git status.
|
||||
// todo!()
|
||||
// pub scrollbar_status_opacity: Hsla,
|
||||
|
||||
// ===
|
||||
// Editor
|
||||
// ===
|
||||
pub editor_foreground: Hsla,
|
||||
pub editor_background: Hsla,
|
||||
// pub editor_inactive_background: Hsla,
|
||||
pub editor_gutter_background: Hsla,
|
||||
pub editor_subheader_background: Hsla,
|
||||
pub editor_active_line_background: Hsla,
|
||||
pub editor_highlighted_line_background: Hsla,
|
||||
/// Text Color. Used for the text of the line number in the editor gutter.
|
||||
pub editor_line_number: Hsla,
|
||||
/// Text Color. Used for the text of the line number in the editor gutter when the line is highlighted.
|
||||
pub editor_active_line_number: Hsla,
|
||||
/// Text Color. Used to mark invisible characters in the editor.
|
||||
///
|
||||
/// Example: spaces, tabs, carriage returns, etc.
|
||||
pub editor_invisible: Hsla,
|
||||
pub editor_wrap_guide: Hsla,
|
||||
pub editor_active_wrap_guide: Hsla,
|
||||
/// Read-access of a symbol, like reading a variable.
|
||||
///
|
||||
/// A document highlight is a range inside a text document which deserves
|
||||
/// special attention. Usually a document highlight is visualized by changing
|
||||
/// the background color of its range.
|
||||
pub editor_document_highlight_read_background: Hsla,
|
||||
/// Read-access of a symbol, like reading a variable.
|
||||
///
|
||||
/// A document highlight is a range inside a text document which deserves
|
||||
/// special attention. Usually a document highlight is visualized by changing
|
||||
/// the background color of its range.
|
||||
pub editor_document_highlight_write_background: Hsla,
|
||||
|
||||
// ===
|
||||
// Terminal
|
||||
// ===
|
||||
/// Terminal Background Color
|
||||
pub terminal_background: Hsla,
|
||||
/// Bright Black Color for ANSI Terminal
|
||||
pub terminal_ansi_bright_black: Hsla,
|
||||
/// Bright Red Color for ANSI Terminal
|
||||
pub terminal_ansi_bright_red: Hsla,
|
||||
/// Bright Green Color for ANSI Terminal
|
||||
pub terminal_ansi_bright_green: Hsla,
|
||||
/// Bright Yellow Color for ANSI Terminal
|
||||
pub terminal_ansi_bright_yellow: Hsla,
|
||||
/// Bright Blue Color for ANSI Terminal
|
||||
pub terminal_ansi_bright_blue: Hsla,
|
||||
/// Bright Magenta Color for ANSI Terminal
|
||||
pub terminal_ansi_bright_magenta: Hsla,
|
||||
/// Bright Cyan Color for ANSI Terminal
|
||||
pub terminal_ansi_bright_cyan: Hsla,
|
||||
/// Bright White Color for ANSI Terminal
|
||||
pub terminal_ansi_bright_white: Hsla,
|
||||
/// Black Color for ANSI Terminal
|
||||
pub terminal_ansi_black: Hsla,
|
||||
/// Red Color for ANSI Terminal
|
||||
pub terminal_ansi_red: Hsla,
|
||||
/// Green Color for ANSI Terminal
|
||||
pub terminal_ansi_green: Hsla,
|
||||
/// Yellow Color for ANSI Terminal
|
||||
pub terminal_ansi_yellow: Hsla,
|
||||
/// Blue Color for ANSI Terminal
|
||||
pub terminal_ansi_blue: Hsla,
|
||||
/// Magenta Color for ANSI Terminal
|
||||
pub terminal_ansi_magenta: Hsla,
|
||||
/// Cyan Color for ANSI Terminal
|
||||
pub terminal_ansi_cyan: Hsla,
|
||||
/// White Color for ANSI Terminal
|
||||
pub terminal_ansi_white: Hsla,
|
||||
|
||||
// ===
|
||||
// UI/Rich Text
|
||||
// ===
|
||||
pub link_text_hover: Hsla,
|
||||
}
|
||||
|
||||
#[derive(Refineable, Clone)]
|
||||
pub struct ThemeStyles {
|
||||
pub system: SystemColors,
|
||||
/// An array of colors used for theme elements that iterrate through a series of colors.
|
||||
///
|
||||
/// Example: Player colors, rainbow brackets and indent guides, etc.
|
||||
pub accents: Vec<Hsla>,
|
||||
|
||||
#[refineable]
|
||||
pub colors: ThemeColors,
|
||||
pub status: StatusColors,
|
||||
pub player: PlayerColors,
|
||||
pub syntax: Arc<SyntaxTheme>,
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use serde_json::json;
|
||||
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn override_a_single_theme_color() {
|
||||
let mut colors = ThemeColors::light();
|
||||
|
||||
let magenta: Hsla = gpui::rgb(0xff00ff);
|
||||
|
||||
assert_ne!(colors.text, magenta);
|
||||
|
||||
let overrides = ThemeColorsRefinement {
|
||||
text: Some(magenta),
|
||||
..Default::default()
|
||||
};
|
||||
|
||||
colors.refine(&overrides);
|
||||
|
||||
assert_eq!(colors.text, magenta);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn override_multiple_theme_colors() {
|
||||
let mut colors = ThemeColors::light();
|
||||
|
||||
let magenta: Hsla = gpui::rgb(0xff00ff);
|
||||
let green: Hsla = gpui::rgb(0x00ff00);
|
||||
|
||||
assert_ne!(colors.text, magenta);
|
||||
assert_ne!(colors.background, green);
|
||||
|
||||
let overrides = ThemeColorsRefinement {
|
||||
text: Some(magenta),
|
||||
background: Some(green),
|
||||
..Default::default()
|
||||
};
|
||||
|
||||
colors.refine(&overrides);
|
||||
|
||||
assert_eq!(colors.text, magenta);
|
||||
assert_eq!(colors.background, green);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn deserialize_theme_colors_refinement_from_json() {
|
||||
let colors: ThemeColorsRefinement = serde_json::from_value(json!({
|
||||
"background": "#ff00ff",
|
||||
"text": "#ff0000"
|
||||
}))
|
||||
.unwrap();
|
||||
|
||||
assert_eq!(colors.background, Some(gpui::rgb(0xff00ff)));
|
||||
assert_eq!(colors.text, Some(gpui::rgb(0xff0000)));
|
||||
}
|
||||
}
|
138
crates/theme/src/styles/players.rs
Normal file
138
crates/theme/src/styles/players.rs
Normal file
|
@ -0,0 +1,138 @@
|
|||
use gpui::Hsla;
|
||||
use serde_derive::Deserialize;
|
||||
|
||||
use crate::{amber, blue, jade, lime, orange, pink, purple, red};
|
||||
|
||||
#[derive(Debug, Clone, Copy, Deserialize, Default)]
|
||||
pub struct PlayerColor {
|
||||
pub cursor: Hsla,
|
||||
pub background: Hsla,
|
||||
pub selection: Hsla,
|
||||
}
|
||||
|
||||
/// A collection of colors that are used to color players in the editor.
|
||||
///
|
||||
/// The first color is always the local player's color, usually a blue.
|
||||
///
|
||||
/// The rest of the default colors crisscross back and forth on the
|
||||
/// color wheel so that the colors are as distinct as possible.
|
||||
#[derive(Clone, Deserialize)]
|
||||
pub struct PlayerColors(pub Vec<PlayerColor>);
|
||||
|
||||
impl Default for PlayerColors {
|
||||
/// Don't use this!
|
||||
/// We have to have a default to be `[refineable::Refinable]`.
|
||||
/// todo!("Find a way to not need this for Refinable")
|
||||
fn default() -> Self {
|
||||
Self::dark()
|
||||
}
|
||||
}
|
||||
|
||||
impl PlayerColors {
|
||||
pub fn dark() -> Self {
|
||||
Self(vec![
|
||||
PlayerColor {
|
||||
cursor: blue().dark().step_9(),
|
||||
background: blue().dark().step_5(),
|
||||
selection: blue().dark().step_3(),
|
||||
},
|
||||
PlayerColor {
|
||||
cursor: orange().dark().step_9(),
|
||||
background: orange().dark().step_5(),
|
||||
selection: orange().dark().step_3(),
|
||||
},
|
||||
PlayerColor {
|
||||
cursor: pink().dark().step_9(),
|
||||
background: pink().dark().step_5(),
|
||||
selection: pink().dark().step_3(),
|
||||
},
|
||||
PlayerColor {
|
||||
cursor: lime().dark().step_9(),
|
||||
background: lime().dark().step_5(),
|
||||
selection: lime().dark().step_3(),
|
||||
},
|
||||
PlayerColor {
|
||||
cursor: purple().dark().step_9(),
|
||||
background: purple().dark().step_5(),
|
||||
selection: purple().dark().step_3(),
|
||||
},
|
||||
PlayerColor {
|
||||
cursor: amber().dark().step_9(),
|
||||
background: amber().dark().step_5(),
|
||||
selection: amber().dark().step_3(),
|
||||
},
|
||||
PlayerColor {
|
||||
cursor: jade().dark().step_9(),
|
||||
background: jade().dark().step_5(),
|
||||
selection: jade().dark().step_3(),
|
||||
},
|
||||
PlayerColor {
|
||||
cursor: red().dark().step_9(),
|
||||
background: red().dark().step_5(),
|
||||
selection: red().dark().step_3(),
|
||||
},
|
||||
])
|
||||
}
|
||||
|
||||
pub fn light() -> Self {
|
||||
Self(vec![
|
||||
PlayerColor {
|
||||
cursor: blue().light().step_9(),
|
||||
background: blue().light().step_4(),
|
||||
selection: blue().light().step_3(),
|
||||
},
|
||||
PlayerColor {
|
||||
cursor: orange().light().step_9(),
|
||||
background: orange().light().step_4(),
|
||||
selection: orange().light().step_3(),
|
||||
},
|
||||
PlayerColor {
|
||||
cursor: pink().light().step_9(),
|
||||
background: pink().light().step_4(),
|
||||
selection: pink().light().step_3(),
|
||||
},
|
||||
PlayerColor {
|
||||
cursor: lime().light().step_9(),
|
||||
background: lime().light().step_4(),
|
||||
selection: lime().light().step_3(),
|
||||
},
|
||||
PlayerColor {
|
||||
cursor: purple().light().step_9(),
|
||||
background: purple().light().step_4(),
|
||||
selection: purple().light().step_3(),
|
||||
},
|
||||
PlayerColor {
|
||||
cursor: amber().light().step_9(),
|
||||
background: amber().light().step_4(),
|
||||
selection: amber().light().step_3(),
|
||||
},
|
||||
PlayerColor {
|
||||
cursor: jade().light().step_9(),
|
||||
background: jade().light().step_4(),
|
||||
selection: jade().light().step_3(),
|
||||
},
|
||||
PlayerColor {
|
||||
cursor: red().light().step_9(),
|
||||
background: red().light().step_4(),
|
||||
selection: red().light().step_3(),
|
||||
},
|
||||
])
|
||||
}
|
||||
}
|
||||
|
||||
impl PlayerColors {
|
||||
pub fn local(&self) -> PlayerColor {
|
||||
// todo!("use a valid color");
|
||||
*self.0.first().unwrap()
|
||||
}
|
||||
|
||||
pub fn absent(&self) -> PlayerColor {
|
||||
// todo!("use a valid color");
|
||||
*self.0.last().unwrap()
|
||||
}
|
||||
|
||||
pub fn color_for_participant(&self, participant_index: u32) -> PlayerColor {
|
||||
let len = self.0.len() - 1;
|
||||
self.0[(participant_index as usize % len) + 1]
|
||||
}
|
||||
}
|
218
crates/theme/src/styles/status.rs
Normal file
218
crates/theme/src/styles/status.rs
Normal file
|
@ -0,0 +1,218 @@
|
|||
use gpui::Hsla;
|
||||
use refineable::Refineable;
|
||||
|
||||
use crate::{blue, grass, neutral, red, yellow};
|
||||
|
||||
#[derive(Refineable, Clone, Debug)]
|
||||
#[refineable(Debug, serde::Deserialize)]
|
||||
pub struct StatusColors {
|
||||
/// Indicates some kind of conflict, like a file changed on disk while it was open, or
|
||||
/// merge conflicts in a Git repository.
|
||||
pub conflict: Hsla,
|
||||
pub conflict_background: Hsla,
|
||||
pub conflict_border: Hsla,
|
||||
|
||||
/// Indicates something new, like a new file added to a Git repository.
|
||||
pub created: Hsla,
|
||||
pub created_background: Hsla,
|
||||
pub created_border: Hsla,
|
||||
|
||||
/// Indicates that something no longer exists, like a deleted file.
|
||||
pub deleted: Hsla,
|
||||
pub deleted_background: Hsla,
|
||||
pub deleted_border: Hsla,
|
||||
|
||||
/// Indicates a system error, a failed operation or a diagnostic error.
|
||||
pub error: Hsla,
|
||||
pub error_background: Hsla,
|
||||
pub error_border: Hsla,
|
||||
|
||||
/// Represents a hidden status, such as a file being hidden in a file tree.
|
||||
pub hidden: Hsla,
|
||||
pub hidden_background: Hsla,
|
||||
pub hidden_border: Hsla,
|
||||
|
||||
/// Indicates a hint or some kind of additional information.
|
||||
pub hint: Hsla,
|
||||
pub hint_background: Hsla,
|
||||
pub hint_border: Hsla,
|
||||
|
||||
/// Indicates that something is deliberately ignored, such as a file or operation ignored by Git.
|
||||
pub ignored: Hsla,
|
||||
pub ignored_background: Hsla,
|
||||
pub ignored_border: Hsla,
|
||||
|
||||
/// Represents informational status updates or messages.
|
||||
pub info: Hsla,
|
||||
pub info_background: Hsla,
|
||||
pub info_border: Hsla,
|
||||
|
||||
/// Indicates a changed or altered status, like a file that has been edited.
|
||||
pub modified: Hsla,
|
||||
pub modified_background: Hsla,
|
||||
pub modified_border: Hsla,
|
||||
|
||||
/// Indicates something that is predicted, like automatic code completion, or generated code.
|
||||
pub predictive: Hsla,
|
||||
pub predictive_background: Hsla,
|
||||
pub predictive_border: Hsla,
|
||||
|
||||
/// Represents a renamed status, such as a file that has been renamed.
|
||||
pub renamed: Hsla,
|
||||
pub renamed_background: Hsla,
|
||||
pub renamed_border: Hsla,
|
||||
|
||||
/// Indicates a successful operation or task completion.
|
||||
pub success: Hsla,
|
||||
pub success_background: Hsla,
|
||||
pub success_border: Hsla,
|
||||
|
||||
/// Indicates some kind of unreachable status, like a block of code that can never be reached.
|
||||
pub unreachable: Hsla,
|
||||
pub unreachable_background: Hsla,
|
||||
pub unreachable_border: Hsla,
|
||||
|
||||
/// Represents a warning status, like an operation that is about to fail.
|
||||
pub warning: Hsla,
|
||||
pub warning_background: Hsla,
|
||||
pub warning_border: Hsla,
|
||||
}
|
||||
|
||||
impl Default for StatusColors {
|
||||
/// Don't use this!
|
||||
/// We have to have a default to be `[refineable::Refinable]`.
|
||||
/// todo!("Find a way to not need this for Refinable")
|
||||
fn default() -> Self {
|
||||
Self::dark()
|
||||
}
|
||||
}
|
||||
|
||||
pub struct DiagnosticColors {
|
||||
pub error: Hsla,
|
||||
pub warning: Hsla,
|
||||
pub info: Hsla,
|
||||
}
|
||||
|
||||
pub struct GitStatusColors {
|
||||
pub created: Hsla,
|
||||
pub deleted: Hsla,
|
||||
pub modified: Hsla,
|
||||
pub renamed: Hsla,
|
||||
pub conflict: Hsla,
|
||||
pub ignored: Hsla,
|
||||
}
|
||||
|
||||
impl StatusColors {
|
||||
pub fn dark() -> Self {
|
||||
Self {
|
||||
conflict: red().dark().step_9(),
|
||||
conflict_background: red().dark().step_9(),
|
||||
conflict_border: red().dark().step_9(),
|
||||
created: grass().dark().step_9(),
|
||||
created_background: grass().dark().step_9(),
|
||||
created_border: grass().dark().step_9(),
|
||||
deleted: red().dark().step_9(),
|
||||
deleted_background: red().dark().step_9(),
|
||||
deleted_border: red().dark().step_9(),
|
||||
error: red().dark().step_9(),
|
||||
error_background: red().dark().step_9(),
|
||||
error_border: red().dark().step_9(),
|
||||
hidden: neutral().dark().step_9(),
|
||||
hidden_background: neutral().dark().step_9(),
|
||||
hidden_border: neutral().dark().step_9(),
|
||||
hint: blue().dark().step_9(),
|
||||
hint_background: blue().dark().step_9(),
|
||||
hint_border: blue().dark().step_9(),
|
||||
ignored: neutral().dark().step_9(),
|
||||
ignored_background: neutral().dark().step_9(),
|
||||
ignored_border: neutral().dark().step_9(),
|
||||
info: blue().dark().step_9(),
|
||||
info_background: blue().dark().step_9(),
|
||||
info_border: blue().dark().step_9(),
|
||||
modified: yellow().dark().step_9(),
|
||||
modified_background: yellow().dark().step_9(),
|
||||
modified_border: yellow().dark().step_9(),
|
||||
predictive: neutral().dark_alpha().step_9(),
|
||||
predictive_background: neutral().dark_alpha().step_9(),
|
||||
predictive_border: neutral().dark_alpha().step_9(),
|
||||
renamed: blue().dark().step_9(),
|
||||
renamed_background: blue().dark().step_9(),
|
||||
renamed_border: blue().dark().step_9(),
|
||||
success: grass().dark().step_9(),
|
||||
success_background: grass().dark().step_9(),
|
||||
success_border: grass().dark().step_9(),
|
||||
unreachable: neutral().dark().step_10(),
|
||||
unreachable_background: neutral().dark().step_10(),
|
||||
unreachable_border: neutral().dark().step_10(),
|
||||
warning: yellow().dark().step_9(),
|
||||
warning_background: yellow().dark().step_9(),
|
||||
warning_border: yellow().dark().step_9(),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn light() -> Self {
|
||||
Self {
|
||||
conflict: red().light().step_9(),
|
||||
conflict_background: red().light().step_9(),
|
||||
conflict_border: red().light().step_9(),
|
||||
created: grass().light().step_9(),
|
||||
created_background: grass().light().step_9(),
|
||||
created_border: grass().light().step_9(),
|
||||
deleted: red().light().step_9(),
|
||||
deleted_background: red().light().step_9(),
|
||||
deleted_border: red().light().step_9(),
|
||||
error: red().light().step_9(),
|
||||
error_background: red().light().step_9(),
|
||||
error_border: red().light().step_9(),
|
||||
hidden: neutral().light().step_9(),
|
||||
hidden_background: neutral().light().step_9(),
|
||||
hidden_border: neutral().light().step_9(),
|
||||
hint: blue().light().step_9(),
|
||||
hint_background: blue().light().step_9(),
|
||||
hint_border: blue().light().step_9(),
|
||||
ignored: neutral().light().step_9(),
|
||||
ignored_background: neutral().light().step_9(),
|
||||
ignored_border: neutral().light().step_9(),
|
||||
info: blue().light().step_9(),
|
||||
info_background: blue().light().step_9(),
|
||||
info_border: blue().light().step_9(),
|
||||
modified: yellow().light().step_9(),
|
||||
modified_background: yellow().light().step_9(),
|
||||
modified_border: yellow().light().step_9(),
|
||||
predictive: neutral().light_alpha().step_9(),
|
||||
predictive_background: neutral().light_alpha().step_9(),
|
||||
predictive_border: neutral().light_alpha().step_9(),
|
||||
renamed: blue().light().step_9(),
|
||||
renamed_background: blue().light().step_9(),
|
||||
renamed_border: blue().light().step_9(),
|
||||
success: grass().light().step_9(),
|
||||
success_background: grass().light().step_9(),
|
||||
success_border: grass().light().step_9(),
|
||||
unreachable: neutral().light().step_10(),
|
||||
unreachable_background: neutral().light().step_10(),
|
||||
unreachable_border: neutral().light().step_10(),
|
||||
warning: yellow().light().step_9(),
|
||||
warning_background: yellow().light().step_9(),
|
||||
warning_border: yellow().light().step_9(),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn diagnostic(&self) -> DiagnosticColors {
|
||||
DiagnosticColors {
|
||||
error: self.error,
|
||||
warning: self.warning,
|
||||
info: self.info,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn git(&self) -> GitStatusColors {
|
||||
GitStatusColors {
|
||||
created: self.created,
|
||||
deleted: self.deleted,
|
||||
modified: self.modified,
|
||||
renamed: self.renamed,
|
||||
conflict: self.conflict,
|
||||
ignored: self.ignored,
|
||||
}
|
||||
}
|
||||
}
|
39
crates/theme/src/styles/stories/color.rs
Normal file
39
crates/theme/src/styles/stories/color.rs
Normal file
|
@ -0,0 +1,39 @@
|
|||
use gpui::prelude::*;
|
||||
use gpui::{div, px, ViewContext};
|
||||
use story::Story;
|
||||
|
||||
use crate::{default_color_scales, ColorScaleStep};
|
||||
|
||||
pub struct ColorsStory;
|
||||
|
||||
impl Render for ColorsStory {
|
||||
fn render(&mut self, cx: &mut ViewContext<Self>) -> impl IntoElement {
|
||||
let color_scales = default_color_scales();
|
||||
|
||||
Story::container().child(Story::title("Colors")).child(
|
||||
div()
|
||||
.id("colors")
|
||||
.flex()
|
||||
.flex_col()
|
||||
.gap_1()
|
||||
.overflow_y_scroll()
|
||||
.text_color(gpui::white())
|
||||
.children(color_scales.into_iter().map(|scale| {
|
||||
div()
|
||||
.flex()
|
||||
.child(
|
||||
div()
|
||||
.w(px(75.))
|
||||
.line_height(px(24.))
|
||||
.child(scale.name().clone()),
|
||||
)
|
||||
.child(
|
||||
div().flex().gap_1().children(
|
||||
ColorScaleStep::ALL
|
||||
.map(|step| div().flex().size_6().bg(scale.step(cx, step))),
|
||||
),
|
||||
)
|
||||
})),
|
||||
)
|
||||
}
|
||||
}
|
5
crates/theme/src/styles/stories/mod.rs
Normal file
5
crates/theme/src/styles/stories/mod.rs
Normal file
|
@ -0,0 +1,5 @@
|
|||
mod color;
|
||||
mod players;
|
||||
|
||||
pub use color::*;
|
||||
pub use players::*;
|
145
crates/theme/src/styles/stories/players.rs
Normal file
145
crates/theme/src/styles/stories/players.rs
Normal file
|
@ -0,0 +1,145 @@
|
|||
use gpui::{div, img, px, IntoElement, ParentElement, Render, Styled, ViewContext};
|
||||
use story::Story;
|
||||
|
||||
use crate::{ActiveTheme, PlayerColors};
|
||||
|
||||
pub struct PlayerStory;
|
||||
|
||||
impl Render for PlayerStory {
|
||||
fn render(&mut self, cx: &mut ViewContext<Self>) -> impl IntoElement {
|
||||
Story::container().child(
|
||||
div()
|
||||
.flex()
|
||||
.flex_col()
|
||||
.gap_4()
|
||||
.child(Story::title_for::<PlayerColors>())
|
||||
.child(Story::label("Player Colors"))
|
||||
.child(
|
||||
div()
|
||||
.flex()
|
||||
.flex_col()
|
||||
.gap_1()
|
||||
.child(
|
||||
div().flex().gap_1().children(
|
||||
cx.theme()
|
||||
.players()
|
||||
.0
|
||||
.clone()
|
||||
.iter_mut()
|
||||
.map(|player| div().w_8().h_8().rounded_md().bg(player.cursor)),
|
||||
),
|
||||
)
|
||||
.child(
|
||||
div().flex().gap_1().children(
|
||||
cx.theme().players().0.clone().iter_mut().map(|player| {
|
||||
div().w_8().h_8().rounded_md().bg(player.background)
|
||||
}),
|
||||
),
|
||||
)
|
||||
.child(
|
||||
div().flex().gap_1().children(
|
||||
cx.theme().players().0.clone().iter_mut().map(|player| {
|
||||
div().w_8().h_8().rounded_md().bg(player.selection)
|
||||
}),
|
||||
),
|
||||
),
|
||||
)
|
||||
.child(Story::label("Avatar Rings"))
|
||||
.child(div().flex().gap_1().children(
|
||||
cx.theme().players().0.clone().iter_mut().map(|player| {
|
||||
div()
|
||||
.my_1()
|
||||
.rounded_full()
|
||||
.border_2()
|
||||
.border_color(player.cursor)
|
||||
.child(
|
||||
img("https://avatars.githubusercontent.com/u/1714999?v=4")
|
||||
.rounded_full()
|
||||
.size_6()
|
||||
.bg(gpui::red()),
|
||||
)
|
||||
}),
|
||||
))
|
||||
.child(Story::label("Player Backgrounds"))
|
||||
.child(div().flex().gap_1().children(
|
||||
cx.theme().players().0.clone().iter_mut().map(|player| {
|
||||
div()
|
||||
.my_1()
|
||||
.rounded_xl()
|
||||
.flex()
|
||||
.items_center()
|
||||
.h_8()
|
||||
.py_0p5()
|
||||
.px_1p5()
|
||||
.bg(player.background)
|
||||
.child(
|
||||
div()
|
||||
.relative()
|
||||
.neg_mx_1()
|
||||
.rounded_full()
|
||||
.z_index(3)
|
||||
.border_2()
|
||||
.border_color(player.background)
|
||||
.size(px(28.))
|
||||
.child(
|
||||
img("https://avatars.githubusercontent.com/u/1714999?v=4")
|
||||
.rounded_full()
|
||||
.size(px(24.))
|
||||
.bg(gpui::red()),
|
||||
),
|
||||
)
|
||||
.child(
|
||||
div()
|
||||
.relative()
|
||||
.neg_mx_1()
|
||||
.rounded_full()
|
||||
.z_index(2)
|
||||
.border_2()
|
||||
.border_color(player.background)
|
||||
.size(px(28.))
|
||||
.child(
|
||||
img("https://avatars.githubusercontent.com/u/1714999?v=4")
|
||||
.rounded_full()
|
||||
.size(px(24.))
|
||||
.bg(gpui::red()),
|
||||
),
|
||||
)
|
||||
.child(
|
||||
div()
|
||||
.relative()
|
||||
.neg_mx_1()
|
||||
.rounded_full()
|
||||
.z_index(1)
|
||||
.border_2()
|
||||
.border_color(player.background)
|
||||
.size(px(28.))
|
||||
.child(
|
||||
img("https://avatars.githubusercontent.com/u/1714999?v=4")
|
||||
.rounded_full()
|
||||
.size(px(24.))
|
||||
.bg(gpui::red()),
|
||||
),
|
||||
)
|
||||
}),
|
||||
))
|
||||
.child(Story::label("Player Selections"))
|
||||
.child(div().flex().flex_col().gap_px().children(
|
||||
cx.theme().players().0.clone().iter_mut().map(|player| {
|
||||
div()
|
||||
.flex()
|
||||
.child(
|
||||
div()
|
||||
.flex()
|
||||
.flex_none()
|
||||
.rounded_sm()
|
||||
.px_0p5()
|
||||
.text_color(cx.theme().colors().text)
|
||||
.bg(player.selection)
|
||||
.child("The brown fox jumped over the lazy dog."),
|
||||
)
|
||||
.child(div().flex_1())
|
||||
}),
|
||||
)),
|
||||
)
|
||||
}
|
||||
}
|
158
crates/theme/src/styles/syntax.rs
Normal file
158
crates/theme/src/styles/syntax.rs
Normal file
|
@ -0,0 +1,158 @@
|
|||
use gpui::{HighlightStyle, Hsla};
|
||||
|
||||
use crate::{
|
||||
blue, cyan, gold, indigo, iris, jade, lime, mint, neutral, orange, plum, purple, red, sky,
|
||||
tomato, yellow,
|
||||
};
|
||||
|
||||
#[derive(Clone, Default)]
|
||||
pub struct SyntaxTheme {
|
||||
pub highlights: Vec<(String, HighlightStyle)>,
|
||||
}
|
||||
|
||||
impl SyntaxTheme {
|
||||
pub fn light() -> Self {
|
||||
Self {
|
||||
highlights: vec![
|
||||
("attribute".into(), cyan().light().step_11().into()),
|
||||
("boolean".into(), tomato().light().step_11().into()),
|
||||
("comment".into(), neutral().light().step_10().into()),
|
||||
("comment.doc".into(), iris().light().step_11().into()),
|
||||
("constant".into(), red().light().step_9().into()),
|
||||
("constructor".into(), red().light().step_9().into()),
|
||||
("embedded".into(), red().light().step_9().into()),
|
||||
("emphasis".into(), red().light().step_9().into()),
|
||||
("emphasis.strong".into(), red().light().step_9().into()),
|
||||
("enum".into(), red().light().step_9().into()),
|
||||
("function".into(), red().light().step_9().into()),
|
||||
("hint".into(), red().light().step_9().into()),
|
||||
("keyword".into(), orange().light().step_9().into()),
|
||||
("label".into(), red().light().step_9().into()),
|
||||
("link_text".into(), red().light().step_9().into()),
|
||||
("link_uri".into(), red().light().step_9().into()),
|
||||
("number".into(), purple().light().step_10().into()),
|
||||
("operator".into(), red().light().step_9().into()),
|
||||
("predictive".into(), red().light().step_9().into()),
|
||||
("preproc".into(), red().light().step_9().into()),
|
||||
("primary".into(), red().light().step_9().into()),
|
||||
("property".into(), red().light().step_9().into()),
|
||||
("punctuation".into(), neutral().light().step_11().into()),
|
||||
(
|
||||
"punctuation.bracket".into(),
|
||||
neutral().light().step_11().into(),
|
||||
),
|
||||
(
|
||||
"punctuation.delimiter".into(),
|
||||
neutral().light().step_10().into(),
|
||||
),
|
||||
(
|
||||
"punctuation.list_marker".into(),
|
||||
blue().light().step_11().into(),
|
||||
),
|
||||
("punctuation.special".into(), red().light().step_9().into()),
|
||||
("string".into(), jade().light().step_9().into()),
|
||||
("string.escape".into(), red().light().step_9().into()),
|
||||
("string.regex".into(), tomato().light().step_9().into()),
|
||||
("string.special".into(), red().light().step_9().into()),
|
||||
(
|
||||
"string.special.symbol".into(),
|
||||
red().light().step_9().into(),
|
||||
),
|
||||
("tag".into(), red().light().step_9().into()),
|
||||
("text.literal".into(), red().light().step_9().into()),
|
||||
("title".into(), red().light().step_9().into()),
|
||||
("type".into(), cyan().light().step_9().into()),
|
||||
("variable".into(), red().light().step_9().into()),
|
||||
("variable.special".into(), red().light().step_9().into()),
|
||||
("variant".into(), red().light().step_9().into()),
|
||||
],
|
||||
}
|
||||
}
|
||||
|
||||
pub fn dark() -> Self {
|
||||
Self {
|
||||
highlights: vec![
|
||||
("attribute".into(), tomato().dark().step_11().into()),
|
||||
("boolean".into(), tomato().dark().step_11().into()),
|
||||
("comment".into(), neutral().dark().step_11().into()),
|
||||
("comment.doc".into(), iris().dark().step_12().into()),
|
||||
("constant".into(), orange().dark().step_11().into()),
|
||||
("constructor".into(), gold().dark().step_11().into()),
|
||||
("embedded".into(), red().dark().step_11().into()),
|
||||
("emphasis".into(), red().dark().step_11().into()),
|
||||
("emphasis.strong".into(), red().dark().step_11().into()),
|
||||
("enum".into(), yellow().dark().step_11().into()),
|
||||
("function".into(), blue().dark().step_11().into()),
|
||||
("hint".into(), indigo().dark().step_11().into()),
|
||||
("keyword".into(), plum().dark().step_11().into()),
|
||||
("label".into(), red().dark().step_11().into()),
|
||||
("link_text".into(), red().dark().step_11().into()),
|
||||
("link_uri".into(), red().dark().step_11().into()),
|
||||
("number".into(), red().dark().step_11().into()),
|
||||
("operator".into(), red().dark().step_11().into()),
|
||||
("predictive".into(), red().dark().step_11().into()),
|
||||
("preproc".into(), red().dark().step_11().into()),
|
||||
("primary".into(), red().dark().step_11().into()),
|
||||
("property".into(), red().dark().step_11().into()),
|
||||
("punctuation".into(), neutral().dark().step_11().into()),
|
||||
(
|
||||
"punctuation.bracket".into(),
|
||||
neutral().dark().step_11().into(),
|
||||
),
|
||||
(
|
||||
"punctuation.delimiter".into(),
|
||||
neutral().dark().step_11().into(),
|
||||
),
|
||||
(
|
||||
"punctuation.list_marker".into(),
|
||||
blue().dark().step_11().into(),
|
||||
),
|
||||
("punctuation.special".into(), red().dark().step_11().into()),
|
||||
("string".into(), lime().dark().step_11().into()),
|
||||
("string.escape".into(), orange().dark().step_11().into()),
|
||||
("string.regex".into(), tomato().dark().step_11().into()),
|
||||
("string.special".into(), red().dark().step_11().into()),
|
||||
(
|
||||
"string.special.symbol".into(),
|
||||
red().dark().step_11().into(),
|
||||
),
|
||||
("tag".into(), red().dark().step_11().into()),
|
||||
("text.literal".into(), purple().dark().step_11().into()),
|
||||
("title".into(), sky().dark().step_11().into()),
|
||||
("type".into(), mint().dark().step_11().into()),
|
||||
("variable".into(), red().dark().step_11().into()),
|
||||
("variable.special".into(), red().dark().step_11().into()),
|
||||
("variant".into(), red().dark().step_11().into()),
|
||||
],
|
||||
}
|
||||
}
|
||||
|
||||
// TOOD: Get this working with `#[cfg(test)]`. Why isn't it?
|
||||
pub fn new_test(colors: impl IntoIterator<Item = (&'static str, Hsla)>) -> Self {
|
||||
SyntaxTheme {
|
||||
highlights: colors
|
||||
.into_iter()
|
||||
.map(|(key, color)| {
|
||||
(
|
||||
key.to_owned(),
|
||||
HighlightStyle {
|
||||
color: Some(color),
|
||||
..Default::default()
|
||||
},
|
||||
)
|
||||
})
|
||||
.collect(),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn get(&self, name: &str) -> HighlightStyle {
|
||||
self.highlights
|
||||
.iter()
|
||||
.find_map(|entry| if entry.0 == name { Some(entry.1) } else { None })
|
||||
.unwrap_or_default()
|
||||
}
|
||||
|
||||
pub fn color(&self, name: &str) -> Hsla {
|
||||
self.get(name).color.unwrap_or_default()
|
||||
}
|
||||
}
|
20
crates/theme/src/styles/system.rs
Normal file
20
crates/theme/src/styles/system.rs
Normal file
|
@ -0,0 +1,20 @@
|
|||
use gpui::{hsla, Hsla};
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct SystemColors {
|
||||
pub transparent: Hsla,
|
||||
pub mac_os_traffic_light_red: Hsla,
|
||||
pub mac_os_traffic_light_yellow: Hsla,
|
||||
pub mac_os_traffic_light_green: Hsla,
|
||||
}
|
||||
|
||||
impl Default for SystemColors {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
transparent: hsla(0.0, 0.0, 0.0, 0.0),
|
||||
mac_os_traffic_light_red: hsla(0.0139, 0.79, 0.65, 1.0),
|
||||
mac_os_traffic_light_yellow: hsla(0.114, 0.88, 0.63, 1.0),
|
||||
mac_os_traffic_light_green: hsla(0.313, 0.49, 0.55, 1.0),
|
||||
}
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load diff
|
@ -1,106 +0,0 @@
|
|||
use crate::{Theme, ThemeMeta};
|
||||
use anyhow::{Context, Result};
|
||||
use gpui::{fonts, AssetSource, FontCache};
|
||||
use parking_lot::Mutex;
|
||||
use serde::Deserialize;
|
||||
use serde_json::Value;
|
||||
use std::{
|
||||
borrow::Cow,
|
||||
collections::HashMap,
|
||||
sync::{
|
||||
atomic::{AtomicUsize, Ordering::SeqCst},
|
||||
Arc,
|
||||
},
|
||||
};
|
||||
|
||||
pub struct ThemeRegistry {
|
||||
assets: Box<dyn AssetSource>,
|
||||
themes: Mutex<HashMap<String, Arc<Theme>>>,
|
||||
theme_data: Mutex<HashMap<String, Arc<Value>>>,
|
||||
font_cache: Arc<FontCache>,
|
||||
next_theme_id: AtomicUsize,
|
||||
}
|
||||
|
||||
impl ThemeRegistry {
|
||||
pub fn new(source: impl AssetSource, font_cache: Arc<FontCache>) -> Arc<Self> {
|
||||
let this = Arc::new(Self {
|
||||
assets: Box::new(source),
|
||||
themes: Default::default(),
|
||||
theme_data: Default::default(),
|
||||
next_theme_id: Default::default(),
|
||||
font_cache,
|
||||
});
|
||||
|
||||
this.themes.lock().insert(
|
||||
settings::EMPTY_THEME_NAME.to_string(),
|
||||
gpui::fonts::with_font_cache(this.font_cache.clone(), || {
|
||||
let mut theme = Theme::default();
|
||||
theme.meta.id = this.next_theme_id.fetch_add(1, SeqCst);
|
||||
theme.meta.name = settings::EMPTY_THEME_NAME.into();
|
||||
Arc::new(theme)
|
||||
}),
|
||||
);
|
||||
|
||||
this
|
||||
}
|
||||
|
||||
pub fn list_names(&self, staff: bool) -> impl Iterator<Item = Cow<str>> + '_ {
|
||||
let mut dirs = self.assets.list("themes/");
|
||||
|
||||
if !staff {
|
||||
dirs = dirs
|
||||
.into_iter()
|
||||
.filter(|path| !path.starts_with("themes/staff"))
|
||||
.collect()
|
||||
}
|
||||
|
||||
fn get_name(path: &str) -> Option<&str> {
|
||||
path.strip_prefix("themes/")?.strip_suffix(".json")
|
||||
}
|
||||
|
||||
dirs.into_iter().filter_map(|path| match path {
|
||||
Cow::Borrowed(path) => Some(Cow::Borrowed(get_name(path)?)),
|
||||
Cow::Owned(path) => Some(Cow::Owned(get_name(&path)?.to_string())),
|
||||
})
|
||||
}
|
||||
|
||||
pub fn list(&self, staff: bool) -> impl Iterator<Item = ThemeMeta> + '_ {
|
||||
self.list_names(staff).filter_map(|theme_name| {
|
||||
self.get(theme_name.as_ref())
|
||||
.ok()
|
||||
.map(|theme| theme.meta.clone())
|
||||
})
|
||||
}
|
||||
|
||||
pub fn clear(&self) {
|
||||
self.theme_data.lock().clear();
|
||||
self.themes.lock().clear();
|
||||
}
|
||||
|
||||
pub fn get(&self, name: &str) -> Result<Arc<Theme>> {
|
||||
if let Some(theme) = self.themes.lock().get(name) {
|
||||
return Ok(theme.clone());
|
||||
}
|
||||
|
||||
let asset_path = format!("themes/{}.json", name);
|
||||
let theme_json = self
|
||||
.assets
|
||||
.load(&asset_path)
|
||||
.with_context(|| format!("failed to load theme file {}", asset_path))?;
|
||||
|
||||
// Allocate into the heap directly, the Theme struct is too large to fit in the stack.
|
||||
let mut theme = fonts::with_font_cache(self.font_cache.clone(), || {
|
||||
let mut theme = Box::new(Theme::default());
|
||||
let mut deserializer = serde_json::Deserializer::from_slice(&theme_json);
|
||||
let result = Theme::deserialize_in_place(&mut deserializer, &mut theme);
|
||||
result.map(|_| theme)
|
||||
})?;
|
||||
|
||||
// Reset name to be the file path, so that we can use it to access the stored themes
|
||||
theme.meta.name = name.into();
|
||||
theme.meta.id = self.next_theme_id.fetch_add(1, SeqCst);
|
||||
let theme: Arc<Theme> = theme.into();
|
||||
self.themes.lock().insert(name.to_string(), theme.clone());
|
||||
Ok(theme)
|
||||
}
|
||||
}
|
462
crates/theme/src/themes/andromeda.rs
Normal file
462
crates/theme/src/themes/andromeda.rs
Normal file
|
@ -0,0 +1,462 @@
|
|||
// This file was generated by the `theme_importer`.
|
||||
// Be careful when modifying it by hand.
|
||||
|
||||
use gpui::rgba;
|
||||
|
||||
#[allow(unused)]
|
||||
use crate::{
|
||||
Appearance, PlayerColor, PlayerColors, StatusColorsRefinement, ThemeColorsRefinement,
|
||||
UserFontStyle, UserFontWeight, UserHighlightStyle, UserSyntaxTheme, UserTheme, UserThemeFamily,
|
||||
UserThemeStylesRefinement,
|
||||
};
|
||||
|
||||
pub fn andromeda() -> UserThemeFamily {
|
||||
UserThemeFamily {
|
||||
name: "Andromeda".into(),
|
||||
author: "Zed Industries".into(),
|
||||
themes: vec![UserTheme {
|
||||
name: "Andromeda".into(),
|
||||
appearance: Appearance::Dark,
|
||||
styles: UserThemeStylesRefinement {
|
||||
colors: ThemeColorsRefinement {
|
||||
border: Some(rgba(0x2b2f39ff).into()),
|
||||
border_variant: Some(rgba(0x2b2f39ff).into()),
|
||||
border_focused: Some(rgba(0x183a34ff).into()),
|
||||
border_selected: Some(rgba(0x183a34ff).into()),
|
||||
border_transparent: Some(rgba(0x00000000).into()),
|
||||
border_disabled: Some(rgba(0x292d37ff).into()),
|
||||
elevated_surface_background: Some(rgba(0x21242bff).into()),
|
||||
surface_background: Some(rgba(0x21242bff).into()),
|
||||
background: Some(rgba(0x262a33ff).into()),
|
||||
panel_background: Some(rgba(0x21242bff).into()),
|
||||
element_background: Some(rgba(0x21242bff).into()),
|
||||
element_hover: Some(rgba(0x252931ff).into()),
|
||||
element_active: Some(rgba(0x2a2f39ff).into()),
|
||||
element_selected: Some(rgba(0x2a2f39ff).into()),
|
||||
element_disabled: Some(rgba(0x21242bff).into()),
|
||||
drop_target_background: Some(rgba(0xaca8ae80).into()),
|
||||
ghost_element_background: Some(rgba(0x00000000).into()),
|
||||
ghost_element_hover: Some(rgba(0x252931ff).into()),
|
||||
ghost_element_active: Some(rgba(0x2a2f39ff).into()),
|
||||
ghost_element_selected: Some(rgba(0x2a2f39ff).into()),
|
||||
ghost_element_disabled: Some(rgba(0x21242bff).into()),
|
||||
text: Some(rgba(0xf7f7f8ff).into()),
|
||||
text_muted: Some(rgba(0xaca8aeff).into()),
|
||||
text_placeholder: Some(rgba(0x6b6b73ff).into()),
|
||||
text_disabled: Some(rgba(0x6b6b73ff).into()),
|
||||
text_accent: Some(rgba(0x11a793ff).into()),
|
||||
icon: Some(rgba(0xf7f7f8ff).into()),
|
||||
icon_muted: Some(rgba(0xaca8aeff).into()),
|
||||
icon_disabled: Some(rgba(0x6b6b73ff).into()),
|
||||
icon_placeholder: Some(rgba(0xaca8aeff).into()),
|
||||
icon_accent: Some(rgba(0x11a793ff).into()),
|
||||
status_bar_background: Some(rgba(0x262a33ff).into()),
|
||||
title_bar_background: Some(rgba(0x262a33ff).into()),
|
||||
toolbar_background: Some(rgba(0x1e2025ff).into()),
|
||||
tab_bar_background: Some(rgba(0x21242bff).into()),
|
||||
tab_inactive_background: Some(rgba(0x21242bff).into()),
|
||||
tab_active_background: Some(rgba(0x1e2025ff).into()),
|
||||
scrollbar_thumb_background: Some(rgba(0xf7f7f84c).into()),
|
||||
scrollbar_thumb_hover_background: Some(rgba(0x252931ff).into()),
|
||||
scrollbar_thumb_border: Some(rgba(0x252931ff).into()),
|
||||
scrollbar_track_background: Some(rgba(0x1e2025ff).into()),
|
||||
scrollbar_track_border: Some(rgba(0x21232aff).into()),
|
||||
editor_foreground: Some(rgba(0xf7f7f8ff).into()),
|
||||
editor_background: Some(rgba(0x1e2025ff).into()),
|
||||
editor_gutter_background: Some(rgba(0x1e2025ff).into()),
|
||||
editor_subheader_background: Some(rgba(0x21242bff).into()),
|
||||
editor_active_line_background: Some(rgba(0x21242bbf).into()),
|
||||
editor_highlighted_line_background: Some(rgba(0x21242bff).into()),
|
||||
editor_line_number: Some(rgba(0xf7f7f859).into()),
|
||||
editor_active_line_number: Some(rgba(0xf7f7f8ff).into()),
|
||||
editor_invisible: Some(rgba(0xaca8aeff).into()),
|
||||
editor_wrap_guide: Some(rgba(0xf7f7f80d).into()),
|
||||
editor_active_wrap_guide: Some(rgba(0xf7f7f81a).into()),
|
||||
editor_document_highlight_read_background: Some(rgba(0x11a7931a).into()),
|
||||
editor_document_highlight_write_background: Some(rgba(0x64646d66).into()),
|
||||
terminal_background: Some(rgba(0x1e2025ff).into()),
|
||||
terminal_ansi_bright_black: Some(rgba(0x40434cff).into()),
|
||||
terminal_ansi_bright_red: Some(rgba(0x8e103aff).into()),
|
||||
terminal_ansi_bright_green: Some(rgba(0x457c38ff).into()),
|
||||
terminal_ansi_bright_yellow: Some(rgba(0x958435ff).into()),
|
||||
terminal_ansi_bright_blue: Some(rgba(0x1b5148ff).into()),
|
||||
terminal_ansi_bright_magenta: Some(rgba(0x682781ff).into()),
|
||||
terminal_ansi_bright_cyan: Some(rgba(0x018169ff).into()),
|
||||
terminal_ansi_bright_white: Some(rgba(0xf7f7f8ff).into()),
|
||||
terminal_ansi_black: Some(rgba(0x1e2025ff).into()),
|
||||
terminal_ansi_red: Some(rgba(0xf82872ff).into()),
|
||||
terminal_ansi_green: Some(rgba(0x96df72ff).into()),
|
||||
terminal_ansi_yellow: Some(rgba(0xfee56dff).into()),
|
||||
terminal_ansi_blue: Some(rgba(0x11a793ff).into()),
|
||||
terminal_ansi_magenta: Some(rgba(0xc74decff).into()),
|
||||
terminal_ansi_cyan: Some(rgba(0x09e7c6ff).into()),
|
||||
terminal_ansi_white: Some(rgba(0xf7f7f8ff).into()),
|
||||
link_text_hover: Some(rgba(0x11a793ff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
status: StatusColorsRefinement {
|
||||
conflict: Some(rgba(0xfee56dff).into()),
|
||||
conflict_background: Some(rgba(0x5c5015ff).into()),
|
||||
conflict_border: Some(rgba(0x796b26ff).into()),
|
||||
created: Some(rgba(0x96df72ff).into()),
|
||||
created_background: Some(rgba(0x194618ff).into()),
|
||||
created_border: Some(rgba(0x306129ff).into()),
|
||||
deleted: Some(rgba(0xf82872ff).into()),
|
||||
deleted_background: Some(rgba(0x55051bff).into()),
|
||||
deleted_border: Some(rgba(0x720a2bff).into()),
|
||||
error: Some(rgba(0xf82872ff).into()),
|
||||
error_background: Some(rgba(0x55051bff).into()),
|
||||
error_border: Some(rgba(0x720a2bff).into()),
|
||||
hidden: Some(rgba(0x6b6b73ff).into()),
|
||||
hidden_background: Some(rgba(0x262a33ff).into()),
|
||||
hidden_border: Some(rgba(0x292d37ff).into()),
|
||||
hint: Some(rgba(0x618399ff).into()),
|
||||
hint_background: Some(rgba(0x122420ff).into()),
|
||||
hint_border: Some(rgba(0x183a34ff).into()),
|
||||
ignored: Some(rgba(0xaca8aeff).into()),
|
||||
ignored_background: Some(rgba(0x262a33ff).into()),
|
||||
ignored_border: Some(rgba(0x2b2f39ff).into()),
|
||||
info: Some(rgba(0x11a793ff).into()),
|
||||
info_background: Some(rgba(0x122420ff).into()),
|
||||
info_border: Some(rgba(0x183a34ff).into()),
|
||||
modified: Some(rgba(0xfee56dff).into()),
|
||||
modified_background: Some(rgba(0x5c5015ff).into()),
|
||||
modified_border: Some(rgba(0x796b26ff).into()),
|
||||
predictive: Some(rgba(0x96df72ff).into()),
|
||||
predictive_background: Some(rgba(0x194618ff).into()),
|
||||
predictive_border: Some(rgba(0x306129ff).into()),
|
||||
renamed: Some(rgba(0x11a793ff).into()),
|
||||
renamed_background: Some(rgba(0x122420ff).into()),
|
||||
renamed_border: Some(rgba(0x183a34ff).into()),
|
||||
success: Some(rgba(0x96df72ff).into()),
|
||||
success_background: Some(rgba(0x194618ff).into()),
|
||||
success_border: Some(rgba(0x306129ff).into()),
|
||||
unreachable: Some(rgba(0xaca8aeff).into()),
|
||||
unreachable_background: Some(rgba(0x262a33ff).into()),
|
||||
unreachable_border: Some(rgba(0x2b2f39ff).into()),
|
||||
warning: Some(rgba(0xfee56dff).into()),
|
||||
warning_background: Some(rgba(0x5c5015ff).into()),
|
||||
warning_border: Some(rgba(0x796b26ff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
player: Some(PlayerColors(vec![
|
||||
PlayerColor {
|
||||
cursor: rgba(0x11a793ff).into(),
|
||||
background: rgba(0x11a793ff).into(),
|
||||
selection: rgba(0x11a7933d).into(),
|
||||
},
|
||||
PlayerColor {
|
||||
cursor: rgba(0xc74decff).into(),
|
||||
background: rgba(0xc74decff).into(),
|
||||
selection: rgba(0xc74dec3d).into(),
|
||||
},
|
||||
PlayerColor {
|
||||
cursor: rgba(0xf29c14ff).into(),
|
||||
background: rgba(0xf29c14ff).into(),
|
||||
selection: rgba(0xf29c143d).into(),
|
||||
},
|
||||
PlayerColor {
|
||||
cursor: rgba(0x8a3fa6ff).into(),
|
||||
background: rgba(0x8a3fa6ff).into(),
|
||||
selection: rgba(0x8a3fa63d).into(),
|
||||
},
|
||||
PlayerColor {
|
||||
cursor: rgba(0x09e7c6ff).into(),
|
||||
background: rgba(0x09e7c6ff).into(),
|
||||
selection: rgba(0x09e7c63d).into(),
|
||||
},
|
||||
PlayerColor {
|
||||
cursor: rgba(0xf82872ff).into(),
|
||||
background: rgba(0xf82872ff).into(),
|
||||
selection: rgba(0xf828723d).into(),
|
||||
},
|
||||
PlayerColor {
|
||||
cursor: rgba(0xfee56dff).into(),
|
||||
background: rgba(0xfee56dff).into(),
|
||||
selection: rgba(0xfee56d3d).into(),
|
||||
},
|
||||
PlayerColor {
|
||||
cursor: rgba(0x96df72ff).into(),
|
||||
background: rgba(0x96df72ff).into(),
|
||||
selection: rgba(0x96df723d).into(),
|
||||
},
|
||||
])),
|
||||
syntax: Some(UserSyntaxTheme {
|
||||
highlights: vec![
|
||||
(
|
||||
"attribute".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0x11a793ff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"boolean".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0x96df72ff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"comment".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0xafabb1ff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"comment.doc".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0xafabb1ff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"constant".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0x96df72ff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"constructor".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0x11a793ff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"embedded".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0xf7f7f8ff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"emphasis".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0x11a793ff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"emphasis.strong".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0x11a793ff).into()),
|
||||
font_weight: Some(UserFontWeight(700.0)),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"enum".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0xf29c14ff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"function".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0xfee56dff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"hint".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0x618399ff).into()),
|
||||
font_weight: Some(UserFontWeight(700.0)),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"keyword".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0x11a793ff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"label".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0x11a793ff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"link_text".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0xf29c14ff).into()),
|
||||
font_style: Some(UserFontStyle::Italic),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"link_uri".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0x96df72ff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"number".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0x96df72ff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"operator".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0xf29c14ff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"predictive".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0x315f70ff).into()),
|
||||
font_style: Some(UserFontStyle::Italic),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"preproc".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0xf7f7f8ff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"primary".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0xf7f7f8ff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"property".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0x11a793ff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"punctuation".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0xd8d5dbff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"punctuation.bracket".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0xd8d5dbff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"punctuation.delimiter".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0xd8d5dbff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"punctuation.list_marker".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0xd8d5dbff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"punctuation.special".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0xd8d5dbff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"string".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0xf29c14ff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"string.escape".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0xafabb1ff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"string.regex".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0xf29c14ff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"string.special".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0xf29c14ff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"string.special.symbol".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0xf29c14ff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"tag".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0x11a793ff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"text.literal".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0xf29c14ff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"title".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0xf7f7f8ff).into()),
|
||||
font_weight: Some(UserFontWeight(700.0)),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"type".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0x09e7c6ff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"variable".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0xf7f7f8ff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"variant".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0x11a793ff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
],
|
||||
}),
|
||||
},
|
||||
}],
|
||||
}
|
||||
}
|
9320
crates/theme/src/themes/atelier.rs
Normal file
9320
crates/theme/src/themes/atelier.rs
Normal file
File diff suppressed because it is too large
Load diff
1352
crates/theme/src/themes/ayu.rs
Normal file
1352
crates/theme/src/themes/ayu.rs
Normal file
File diff suppressed because it is too large
Load diff
2726
crates/theme/src/themes/gruvbox.rs
Normal file
2726
crates/theme/src/themes/gruvbox.rs
Normal file
File diff suppressed because it is too large
Load diff
38
crates/theme/src/themes/mod.rs
Normal file
38
crates/theme/src/themes/mod.rs
Normal file
|
@ -0,0 +1,38 @@
|
|||
// This file was generated by the `theme_importer`.
|
||||
// Be careful when modifying it by hand.
|
||||
|
||||
mod andromeda;
|
||||
mod atelier;
|
||||
mod ayu;
|
||||
mod gruvbox;
|
||||
mod one;
|
||||
mod rose_pine;
|
||||
mod sandcastle;
|
||||
mod solarized;
|
||||
mod summercamp;
|
||||
|
||||
pub use andromeda::*;
|
||||
pub use atelier::*;
|
||||
pub use ayu::*;
|
||||
pub use gruvbox::*;
|
||||
pub use one::*;
|
||||
pub use rose_pine::*;
|
||||
pub use sandcastle::*;
|
||||
pub use solarized::*;
|
||||
pub use summercamp::*;
|
||||
|
||||
use crate::UserThemeFamily;
|
||||
|
||||
pub(crate) fn all_user_themes() -> Vec<UserThemeFamily> {
|
||||
vec![
|
||||
andromeda(),
|
||||
atelier(),
|
||||
ayu(),
|
||||
gruvbox(),
|
||||
one(),
|
||||
rose_pine(),
|
||||
sandcastle(),
|
||||
solarized(),
|
||||
summercamp(),
|
||||
]
|
||||
}
|
922
crates/theme/src/themes/one.rs
Normal file
922
crates/theme/src/themes/one.rs
Normal file
|
@ -0,0 +1,922 @@
|
|||
// This file was generated by the `theme_importer`.
|
||||
// Be careful when modifying it by hand.
|
||||
|
||||
use gpui::rgba;
|
||||
|
||||
#[allow(unused)]
|
||||
use crate::{
|
||||
Appearance, PlayerColor, PlayerColors, StatusColorsRefinement, ThemeColorsRefinement,
|
||||
UserFontStyle, UserFontWeight, UserHighlightStyle, UserSyntaxTheme, UserTheme, UserThemeFamily,
|
||||
UserThemeStylesRefinement,
|
||||
};
|
||||
|
||||
pub fn one() -> UserThemeFamily {
|
||||
UserThemeFamily {
|
||||
name: "One".into(),
|
||||
author: "Zed Industries".into(),
|
||||
themes: vec![
|
||||
UserTheme {
|
||||
name: "One Light".into(),
|
||||
appearance: Appearance::Light,
|
||||
styles: UserThemeStylesRefinement {
|
||||
colors: ThemeColorsRefinement {
|
||||
border: Some(rgba(0xc9c9caff).into()),
|
||||
border_variant: Some(rgba(0xc9c9caff).into()),
|
||||
border_focused: Some(rgba(0xcbcdf6ff).into()),
|
||||
border_selected: Some(rgba(0xcbcdf6ff).into()),
|
||||
border_transparent: Some(rgba(0x00000000).into()),
|
||||
border_disabled: Some(rgba(0xd3d3d4ff).into()),
|
||||
elevated_surface_background: Some(rgba(0xebebecff).into()),
|
||||
surface_background: Some(rgba(0xebebecff).into()),
|
||||
background: Some(rgba(0xdcdcddff).into()),
|
||||
panel_background: Some(rgba(0xebebecff).into()),
|
||||
element_background: Some(rgba(0xebebecff).into()),
|
||||
element_hover: Some(rgba(0xdfdfe0ff).into()),
|
||||
element_active: Some(rgba(0xcacacaff).into()),
|
||||
element_selected: Some(rgba(0xcacacaff).into()),
|
||||
element_disabled: Some(rgba(0xebebecff).into()),
|
||||
drop_target_background: Some(rgba(0x7f818880).into()),
|
||||
ghost_element_background: Some(rgba(0x00000000).into()),
|
||||
ghost_element_hover: Some(rgba(0xdfdfe0ff).into()),
|
||||
ghost_element_active: Some(rgba(0xcacacaff).into()),
|
||||
ghost_element_selected: Some(rgba(0xcacacaff).into()),
|
||||
ghost_element_disabled: Some(rgba(0xebebecff).into()),
|
||||
text: Some(rgba(0x383a41ff).into()),
|
||||
text_muted: Some(rgba(0x7f8188ff).into()),
|
||||
text_placeholder: Some(rgba(0xa1a1a3ff).into()),
|
||||
text_disabled: Some(rgba(0xa1a1a3ff).into()),
|
||||
text_accent: Some(rgba(0x5c79e2ff).into()),
|
||||
icon: Some(rgba(0x383a41ff).into()),
|
||||
icon_muted: Some(rgba(0x7f8188ff).into()),
|
||||
icon_disabled: Some(rgba(0xa1a1a3ff).into()),
|
||||
icon_placeholder: Some(rgba(0x7f8188ff).into()),
|
||||
icon_accent: Some(rgba(0x5c79e2ff).into()),
|
||||
status_bar_background: Some(rgba(0xdcdcddff).into()),
|
||||
title_bar_background: Some(rgba(0xdcdcddff).into()),
|
||||
toolbar_background: Some(rgba(0xfafafaff).into()),
|
||||
tab_bar_background: Some(rgba(0xebebecff).into()),
|
||||
tab_inactive_background: Some(rgba(0xebebecff).into()),
|
||||
tab_active_background: Some(rgba(0xfafafaff).into()),
|
||||
scrollbar_thumb_background: Some(rgba(0x383a414c).into()),
|
||||
scrollbar_thumb_hover_background: Some(rgba(0xdfdfe0ff).into()),
|
||||
scrollbar_thumb_border: Some(rgba(0xdfdfe0ff).into()),
|
||||
scrollbar_track_background: Some(rgba(0xfafafaff).into()),
|
||||
scrollbar_track_border: Some(rgba(0xeeeeeeff).into()),
|
||||
editor_foreground: Some(rgba(0x383a41ff).into()),
|
||||
editor_background: Some(rgba(0xfafafaff).into()),
|
||||
editor_gutter_background: Some(rgba(0xfafafaff).into()),
|
||||
editor_subheader_background: Some(rgba(0xebebecff).into()),
|
||||
editor_active_line_background: Some(rgba(0xebebecbf).into()),
|
||||
editor_highlighted_line_background: Some(rgba(0xebebecff).into()),
|
||||
editor_line_number: Some(rgba(0x383a4159).into()),
|
||||
editor_active_line_number: Some(rgba(0x383a41ff).into()),
|
||||
editor_invisible: Some(rgba(0x7f8188ff).into()),
|
||||
editor_wrap_guide: Some(rgba(0x383a410d).into()),
|
||||
editor_active_wrap_guide: Some(rgba(0x383a411a).into()),
|
||||
editor_document_highlight_read_background: Some(rgba(0x5c79e21a).into()),
|
||||
editor_document_highlight_write_background: Some(rgba(0xa3a3a466).into()),
|
||||
terminal_background: Some(rgba(0xfafafaff).into()),
|
||||
terminal_ansi_bright_black: Some(rgba(0xaaaaaaff).into()),
|
||||
terminal_ansi_bright_red: Some(rgba(0xf0b0a4ff).into()),
|
||||
terminal_ansi_bright_green: Some(rgba(0xb2cfa9ff).into()),
|
||||
terminal_ansi_bright_yellow: Some(rgba(0xf1dfc1ff).into()),
|
||||
terminal_ansi_bright_blue: Some(rgba(0xb5baf2ff).into()),
|
||||
terminal_ansi_bright_magenta: Some(rgba(0xcea6d3ff).into()),
|
||||
terminal_ansi_bright_cyan: Some(rgba(0xa4bfdbff).into()),
|
||||
terminal_ansi_bright_white: Some(rgba(0x383a41ff).into()),
|
||||
terminal_ansi_black: Some(rgba(0xfafafaff).into()),
|
||||
terminal_ansi_red: Some(rgba(0xd36151ff).into()),
|
||||
terminal_ansi_green: Some(rgba(0x669f59ff).into()),
|
||||
terminal_ansi_yellow: Some(rgba(0xdec184ff).into()),
|
||||
terminal_ansi_blue: Some(rgba(0x5c79e2ff).into()),
|
||||
terminal_ansi_magenta: Some(rgba(0x994fa6ff).into()),
|
||||
terminal_ansi_cyan: Some(rgba(0x3b82b7ff).into()),
|
||||
terminal_ansi_white: Some(rgba(0x383a41ff).into()),
|
||||
link_text_hover: Some(rgba(0x5c79e2ff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
status: StatusColorsRefinement {
|
||||
conflict: Some(rgba(0xdec184ff).into()),
|
||||
conflict_background: Some(rgba(0xfaf2e6ff).into()),
|
||||
conflict_border: Some(rgba(0xf5e8d2ff).into()),
|
||||
created: Some(rgba(0x669f59ff).into()),
|
||||
created_background: Some(rgba(0xe0ebdcff).into()),
|
||||
created_border: Some(rgba(0xc8dcc1ff).into()),
|
||||
deleted: Some(rgba(0xd36151ff).into()),
|
||||
deleted_background: Some(rgba(0xfbdfd9ff).into()),
|
||||
deleted_border: Some(rgba(0xf6c6bdff).into()),
|
||||
error: Some(rgba(0xd36151ff).into()),
|
||||
error_background: Some(rgba(0xfbdfd9ff).into()),
|
||||
error_border: Some(rgba(0xf6c6bdff).into()),
|
||||
hidden: Some(rgba(0xa1a1a3ff).into()),
|
||||
hidden_background: Some(rgba(0xdcdcddff).into()),
|
||||
hidden_border: Some(rgba(0xd3d3d4ff).into()),
|
||||
hint: Some(rgba(0x9295beff).into()),
|
||||
hint_background: Some(rgba(0xe2e2faff).into()),
|
||||
hint_border: Some(rgba(0xcbcdf6ff).into()),
|
||||
ignored: Some(rgba(0x7f8188ff).into()),
|
||||
ignored_background: Some(rgba(0xdcdcddff).into()),
|
||||
ignored_border: Some(rgba(0xc9c9caff).into()),
|
||||
info: Some(rgba(0x5c79e2ff).into()),
|
||||
info_background: Some(rgba(0xe2e2faff).into()),
|
||||
info_border: Some(rgba(0xcbcdf6ff).into()),
|
||||
modified: Some(rgba(0xdec184ff).into()),
|
||||
modified_background: Some(rgba(0xfaf2e6ff).into()),
|
||||
modified_border: Some(rgba(0xf5e8d2ff).into()),
|
||||
predictive: Some(rgba(0x669f59ff).into()),
|
||||
predictive_background: Some(rgba(0xe0ebdcff).into()),
|
||||
predictive_border: Some(rgba(0xc8dcc1ff).into()),
|
||||
renamed: Some(rgba(0x5c79e2ff).into()),
|
||||
renamed_background: Some(rgba(0xe2e2faff).into()),
|
||||
renamed_border: Some(rgba(0xcbcdf6ff).into()),
|
||||
success: Some(rgba(0x669f59ff).into()),
|
||||
success_background: Some(rgba(0xe0ebdcff).into()),
|
||||
success_border: Some(rgba(0xc8dcc1ff).into()),
|
||||
unreachable: Some(rgba(0x7f8188ff).into()),
|
||||
unreachable_background: Some(rgba(0xdcdcddff).into()),
|
||||
unreachable_border: Some(rgba(0xc9c9caff).into()),
|
||||
warning: Some(rgba(0xdec184ff).into()),
|
||||
warning_background: Some(rgba(0xfaf2e6ff).into()),
|
||||
warning_border: Some(rgba(0xf5e8d2ff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
player: Some(PlayerColors(vec![
|
||||
PlayerColor {
|
||||
cursor: rgba(0x5c79e2ff).into(),
|
||||
background: rgba(0x5c79e2ff).into(),
|
||||
selection: rgba(0x5c79e23d).into(),
|
||||
},
|
||||
PlayerColor {
|
||||
cursor: rgba(0x994fa6ff).into(),
|
||||
background: rgba(0x994fa6ff).into(),
|
||||
selection: rgba(0x994fa63d).into(),
|
||||
},
|
||||
PlayerColor {
|
||||
cursor: rgba(0xad6f27ff).into(),
|
||||
background: rgba(0xad6f27ff).into(),
|
||||
selection: rgba(0xad6f273d).into(),
|
||||
},
|
||||
PlayerColor {
|
||||
cursor: rgba(0xa44aabff).into(),
|
||||
background: rgba(0xa44aabff).into(),
|
||||
selection: rgba(0xa44aab3d).into(),
|
||||
},
|
||||
PlayerColor {
|
||||
cursor: rgba(0x3b82b7ff).into(),
|
||||
background: rgba(0x3b82b7ff).into(),
|
||||
selection: rgba(0x3b82b73d).into(),
|
||||
},
|
||||
PlayerColor {
|
||||
cursor: rgba(0xd36151ff).into(),
|
||||
background: rgba(0xd36151ff).into(),
|
||||
selection: rgba(0xd361513d).into(),
|
||||
},
|
||||
PlayerColor {
|
||||
cursor: rgba(0xdec184ff).into(),
|
||||
background: rgba(0xdec184ff).into(),
|
||||
selection: rgba(0xdec1843d).into(),
|
||||
},
|
||||
PlayerColor {
|
||||
cursor: rgba(0x669f59ff).into(),
|
||||
background: rgba(0x669f59ff).into(),
|
||||
selection: rgba(0x669f593d).into(),
|
||||
},
|
||||
])),
|
||||
syntax: Some(UserSyntaxTheme {
|
||||
highlights: vec![
|
||||
(
|
||||
"attribute".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0x5c79e2ff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"boolean".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0xad6f26ff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"comment".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0xa2a3a7ff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"comment.doc".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0x7c7e86ff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"constant".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0x669f59ff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"constructor".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0x5c79e2ff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"embedded".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0x383a41ff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"emphasis".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0x5c79e2ff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"emphasis.strong".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0xad6f26ff).into()),
|
||||
font_weight: Some(UserFontWeight(700.0)),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"enum".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0xd36050ff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"function".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0x5b79e3ff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"hint".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0x9295beff).into()),
|
||||
font_weight: Some(UserFontWeight(700.0)),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"keyword".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0xa449abff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"label".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0x5c79e2ff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"link_text".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0x5b79e3ff).into()),
|
||||
font_style: Some(UserFontStyle::Italic),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"link_uri".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0x3982b7ff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"number".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0xad6f26ff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"operator".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0x3982b7ff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"predictive".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0x9c9fc7ff).into()),
|
||||
font_style: Some(UserFontStyle::Italic),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"preproc".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0x383a41ff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"primary".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0x383a41ff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"property".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0xd36050ff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"punctuation".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0x383a41ff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"punctuation.bracket".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0x4d4f52ff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"punctuation.delimiter".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0x4d4f52ff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"punctuation.list_marker".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0xd36050ff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"punctuation.special".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0xb92c46ff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"string".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0x659f58ff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"string.escape".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0x7c7e86ff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"string.regex".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0xad6f27ff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"string.special".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0xad6f27ff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"string.special.symbol".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0xad6f27ff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"tag".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0x5c79e2ff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"text.literal".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0x659f58ff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"title".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0xd36050ff).into()),
|
||||
font_weight: Some(UserFontWeight(400.0)),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"type".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0x3982b7ff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"variable".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0x383a41ff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"variable.special".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0xad6f26ff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"variant".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0x5b79e3ff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
],
|
||||
}),
|
||||
},
|
||||
},
|
||||
UserTheme {
|
||||
name: "One Dark".into(),
|
||||
appearance: Appearance::Dark,
|
||||
styles: UserThemeStylesRefinement {
|
||||
colors: ThemeColorsRefinement {
|
||||
border: Some(rgba(0x464b57ff).into()),
|
||||
border_variant: Some(rgba(0x464b57ff).into()),
|
||||
border_focused: Some(rgba(0x293c5bff).into()),
|
||||
border_selected: Some(rgba(0x293c5bff).into()),
|
||||
border_transparent: Some(rgba(0x00000000).into()),
|
||||
border_disabled: Some(rgba(0x414754ff).into()),
|
||||
elevated_surface_background: Some(rgba(0x2f343eff).into()),
|
||||
surface_background: Some(rgba(0x2f343eff).into()),
|
||||
background: Some(rgba(0x3b414dff).into()),
|
||||
panel_background: Some(rgba(0x2f343eff).into()),
|
||||
element_background: Some(rgba(0x2f343eff).into()),
|
||||
element_hover: Some(rgba(0x363c46ff).into()),
|
||||
element_active: Some(rgba(0x454a56ff).into()),
|
||||
element_selected: Some(rgba(0x454a56ff).into()),
|
||||
element_disabled: Some(rgba(0x2f343eff).into()),
|
||||
drop_target_background: Some(rgba(0x83899480).into()),
|
||||
ghost_element_background: Some(rgba(0x00000000).into()),
|
||||
ghost_element_hover: Some(rgba(0x363c46ff).into()),
|
||||
ghost_element_active: Some(rgba(0x454a56ff).into()),
|
||||
ghost_element_selected: Some(rgba(0x454a56ff).into()),
|
||||
ghost_element_disabled: Some(rgba(0x2f343eff).into()),
|
||||
text: Some(rgba(0xc8ccd4ff).into()),
|
||||
text_muted: Some(rgba(0x838994ff).into()),
|
||||
text_placeholder: Some(rgba(0x555a63ff).into()),
|
||||
text_disabled: Some(rgba(0x555a63ff).into()),
|
||||
text_accent: Some(rgba(0x74ade8ff).into()),
|
||||
icon: Some(rgba(0xc8ccd4ff).into()),
|
||||
icon_muted: Some(rgba(0x838994ff).into()),
|
||||
icon_disabled: Some(rgba(0x555a63ff).into()),
|
||||
icon_placeholder: Some(rgba(0x838994ff).into()),
|
||||
icon_accent: Some(rgba(0x74ade8ff).into()),
|
||||
status_bar_background: Some(rgba(0x3b414dff).into()),
|
||||
title_bar_background: Some(rgba(0x3b414dff).into()),
|
||||
toolbar_background: Some(rgba(0x282c34ff).into()),
|
||||
tab_bar_background: Some(rgba(0x2f343eff).into()),
|
||||
tab_inactive_background: Some(rgba(0x2f343eff).into()),
|
||||
tab_active_background: Some(rgba(0x282c34ff).into()),
|
||||
scrollbar_thumb_background: Some(rgba(0xc8ccd44c).into()),
|
||||
scrollbar_thumb_hover_background: Some(rgba(0x363c46ff).into()),
|
||||
scrollbar_thumb_border: Some(rgba(0x363c46ff).into()),
|
||||
scrollbar_track_background: Some(rgba(0x282c34ff).into()),
|
||||
scrollbar_track_border: Some(rgba(0x2e333cff).into()),
|
||||
editor_foreground: Some(rgba(0xacb2beff).into()),
|
||||
editor_background: Some(rgba(0x282c34ff).into()),
|
||||
editor_gutter_background: Some(rgba(0x282c34ff).into()),
|
||||
editor_subheader_background: Some(rgba(0x2f343eff).into()),
|
||||
editor_active_line_background: Some(rgba(0x2f343ebf).into()),
|
||||
editor_highlighted_line_background: Some(rgba(0x2f343eff).into()),
|
||||
editor_line_number: Some(rgba(0xc8ccd459).into()),
|
||||
editor_active_line_number: Some(rgba(0xc8ccd4ff).into()),
|
||||
editor_invisible: Some(rgba(0x838994ff).into()),
|
||||
editor_wrap_guide: Some(rgba(0xc8ccd40d).into()),
|
||||
editor_active_wrap_guide: Some(rgba(0xc8ccd41a).into()),
|
||||
editor_document_highlight_read_background: Some(rgba(0x74ade81a).into()),
|
||||
editor_document_highlight_write_background: Some(rgba(0x555a6366).into()),
|
||||
terminal_background: Some(rgba(0x282c34ff).into()),
|
||||
terminal_ansi_bright_black: Some(rgba(0x525661ff).into()),
|
||||
terminal_ansi_bright_red: Some(rgba(0x673a3cff).into()),
|
||||
terminal_ansi_bright_green: Some(rgba(0x4d6140ff).into()),
|
||||
terminal_ansi_bright_yellow: Some(rgba(0x786441ff).into()),
|
||||
terminal_ansi_bright_blue: Some(rgba(0x385378ff).into()),
|
||||
terminal_ansi_bright_magenta: Some(rgba(0x5e2b26ff).into()),
|
||||
terminal_ansi_bright_cyan: Some(rgba(0x3a565bff).into()),
|
||||
terminal_ansi_bright_white: Some(rgba(0xc8ccd4ff).into()),
|
||||
terminal_ansi_black: Some(rgba(0x282c34ff).into()),
|
||||
terminal_ansi_red: Some(rgba(0xd07277ff).into()),
|
||||
terminal_ansi_green: Some(rgba(0xa1c181ff).into()),
|
||||
terminal_ansi_yellow: Some(rgba(0xdec184ff).into()),
|
||||
terminal_ansi_blue: Some(rgba(0x74ade8ff).into()),
|
||||
terminal_ansi_magenta: Some(rgba(0xbe5046ff).into()),
|
||||
terminal_ansi_cyan: Some(rgba(0x6fb4c0ff).into()),
|
||||
terminal_ansi_white: Some(rgba(0xc8ccd4ff).into()),
|
||||
link_text_hover: Some(rgba(0x74ade8ff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
status: StatusColorsRefinement {
|
||||
conflict: Some(rgba(0xdec184ff).into()),
|
||||
conflict_background: Some(rgba(0x41331dff).into()),
|
||||
conflict_border: Some(rgba(0x5d4c2fff).into()),
|
||||
created: Some(rgba(0xa1c181ff).into()),
|
||||
created_background: Some(rgba(0x222e1dff).into()),
|
||||
created_border: Some(rgba(0x38482fff).into()),
|
||||
deleted: Some(rgba(0xd07277ff).into()),
|
||||
deleted_background: Some(rgba(0x301b1cff).into()),
|
||||
deleted_border: Some(rgba(0x4c2b2cff).into()),
|
||||
error: Some(rgba(0xd07277ff).into()),
|
||||
error_background: Some(rgba(0x301b1cff).into()),
|
||||
error_border: Some(rgba(0x4c2b2cff).into()),
|
||||
hidden: Some(rgba(0x555a63ff).into()),
|
||||
hidden_background: Some(rgba(0x3b414dff).into()),
|
||||
hidden_border: Some(rgba(0x414754ff).into()),
|
||||
hint: Some(rgba(0x5b708aff).into()),
|
||||
hint_background: Some(rgba(0x18243dff).into()),
|
||||
hint_border: Some(rgba(0x293c5bff).into()),
|
||||
ignored: Some(rgba(0x838994ff).into()),
|
||||
ignored_background: Some(rgba(0x3b414dff).into()),
|
||||
ignored_border: Some(rgba(0x464b57ff).into()),
|
||||
info: Some(rgba(0x74ade8ff).into()),
|
||||
info_background: Some(rgba(0x18243dff).into()),
|
||||
info_border: Some(rgba(0x293c5bff).into()),
|
||||
modified: Some(rgba(0xdec184ff).into()),
|
||||
modified_background: Some(rgba(0x41331dff).into()),
|
||||
modified_border: Some(rgba(0x5d4c2fff).into()),
|
||||
predictive: Some(rgba(0xa1c181ff).into()),
|
||||
predictive_background: Some(rgba(0x222e1dff).into()),
|
||||
predictive_border: Some(rgba(0x38482fff).into()),
|
||||
renamed: Some(rgba(0x74ade8ff).into()),
|
||||
renamed_background: Some(rgba(0x18243dff).into()),
|
||||
renamed_border: Some(rgba(0x293c5bff).into()),
|
||||
success: Some(rgba(0xa1c181ff).into()),
|
||||
success_background: Some(rgba(0x222e1dff).into()),
|
||||
success_border: Some(rgba(0x38482fff).into()),
|
||||
unreachable: Some(rgba(0x838994ff).into()),
|
||||
unreachable_background: Some(rgba(0x3b414dff).into()),
|
||||
unreachable_border: Some(rgba(0x464b57ff).into()),
|
||||
warning: Some(rgba(0xdec184ff).into()),
|
||||
warning_background: Some(rgba(0x41331dff).into()),
|
||||
warning_border: Some(rgba(0x5d4c2fff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
player: Some(PlayerColors(vec![
|
||||
PlayerColor {
|
||||
cursor: rgba(0x74ade8ff).into(),
|
||||
background: rgba(0x74ade8ff).into(),
|
||||
selection: rgba(0x74ade83d).into(),
|
||||
},
|
||||
PlayerColor {
|
||||
cursor: rgba(0xbe5046ff).into(),
|
||||
background: rgba(0xbe5046ff).into(),
|
||||
selection: rgba(0xbe50463d).into(),
|
||||
},
|
||||
PlayerColor {
|
||||
cursor: rgba(0xc0966bff).into(),
|
||||
background: rgba(0xc0966bff).into(),
|
||||
selection: rgba(0xc0966b3d).into(),
|
||||
},
|
||||
PlayerColor {
|
||||
cursor: rgba(0xb478cfff).into(),
|
||||
background: rgba(0xb478cfff).into(),
|
||||
selection: rgba(0xb478cf3d).into(),
|
||||
},
|
||||
PlayerColor {
|
||||
cursor: rgba(0x6fb4c0ff).into(),
|
||||
background: rgba(0x6fb4c0ff).into(),
|
||||
selection: rgba(0x6fb4c03d).into(),
|
||||
},
|
||||
PlayerColor {
|
||||
cursor: rgba(0xd07277ff).into(),
|
||||
background: rgba(0xd07277ff).into(),
|
||||
selection: rgba(0xd072773d).into(),
|
||||
},
|
||||
PlayerColor {
|
||||
cursor: rgba(0xdec184ff).into(),
|
||||
background: rgba(0xdec184ff).into(),
|
||||
selection: rgba(0xdec1843d).into(),
|
||||
},
|
||||
PlayerColor {
|
||||
cursor: rgba(0xa1c181ff).into(),
|
||||
background: rgba(0xa1c181ff).into(),
|
||||
selection: rgba(0xa1c1813d).into(),
|
||||
},
|
||||
])),
|
||||
syntax: Some(UserSyntaxTheme {
|
||||
highlights: vec![
|
||||
(
|
||||
"attribute".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0x74ade8ff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"boolean".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0xc0966bff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"comment".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0x5d636fff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"comment.doc".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0x878e98ff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"constant".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0xdfc184ff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"constructor".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0x74ade9ff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"embedded".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0xc8ccd4ff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"emphasis".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0x74ade8ff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"emphasis.strong".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0xc0966bff).into()),
|
||||
font_weight: Some(UserFontWeight(700.0)),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"enum".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0xd07277ff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"function".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0x74ade9ff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"hint".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0x5b708aff).into()),
|
||||
font_weight: Some(UserFontWeight(700.0)),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"keyword".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0xb478cfff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"label".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0x74ade8ff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"link_text".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0x74ade9ff).into()),
|
||||
font_style: Some(UserFontStyle::Normal),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"link_uri".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0x6fb4c0ff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"number".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0xc0966bff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"operator".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0x6fb4c0ff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"predictive".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0x5b6b88ff).into()),
|
||||
font_style: Some(UserFontStyle::Italic),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"preproc".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0xc8ccd4ff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"primary".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0xacb2beff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"property".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0xd07277ff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"punctuation".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0xacb2beff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"punctuation.bracket".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0xb2b9c6ff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"punctuation.delimiter".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0xb2b9c6ff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"punctuation.list_marker".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0xd07277ff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"punctuation.special".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0xb1574bff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"string".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0xa1c181ff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"string.escape".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0x878e98ff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"string.regex".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0xc0966bff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"string.special".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0xc0966bff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"string.special.symbol".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0xc0966bff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"tag".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0x74ade8ff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"text.literal".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0xa1c181ff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"title".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0xd07277ff).into()),
|
||||
font_weight: Some(UserFontWeight(400.0)),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"type".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0x6fb4c0ff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"variable".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0xc8ccd4ff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"variable.special".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0xc0966bff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"variant".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0x74ade9ff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
],
|
||||
}),
|
||||
},
|
||||
},
|
||||
],
|
||||
}
|
||||
}
|
1394
crates/theme/src/themes/rose_pine.rs
Normal file
1394
crates/theme/src/themes/rose_pine.rs
Normal file
File diff suppressed because it is too large
Load diff
462
crates/theme/src/themes/sandcastle.rs
Normal file
462
crates/theme/src/themes/sandcastle.rs
Normal file
|
@ -0,0 +1,462 @@
|
|||
// This file was generated by the `theme_importer`.
|
||||
// Be careful when modifying it by hand.
|
||||
|
||||
use gpui::rgba;
|
||||
|
||||
#[allow(unused)]
|
||||
use crate::{
|
||||
Appearance, PlayerColor, PlayerColors, StatusColorsRefinement, ThemeColorsRefinement,
|
||||
UserFontStyle, UserFontWeight, UserHighlightStyle, UserSyntaxTheme, UserTheme, UserThemeFamily,
|
||||
UserThemeStylesRefinement,
|
||||
};
|
||||
|
||||
pub fn sandcastle() -> UserThemeFamily {
|
||||
UserThemeFamily {
|
||||
name: "Sandcastle".into(),
|
||||
author: "Zed Industries".into(),
|
||||
themes: vec![UserTheme {
|
||||
name: "Sandcastle".into(),
|
||||
appearance: Appearance::Dark,
|
||||
styles: UserThemeStylesRefinement {
|
||||
colors: ThemeColorsRefinement {
|
||||
border: Some(rgba(0x3d4350ff).into()),
|
||||
border_variant: Some(rgba(0x3d4350ff).into()),
|
||||
border_focused: Some(rgba(0x223232ff).into()),
|
||||
border_selected: Some(rgba(0x223232ff).into()),
|
||||
border_transparent: Some(rgba(0x00000000).into()),
|
||||
border_disabled: Some(rgba(0x393f4aff).into()),
|
||||
elevated_surface_background: Some(rgba(0x2b3039ff).into()),
|
||||
surface_background: Some(rgba(0x2b3039ff).into()),
|
||||
background: Some(rgba(0x333944ff).into()),
|
||||
panel_background: Some(rgba(0x2b3039ff).into()),
|
||||
element_background: Some(rgba(0x2b3039ff).into()),
|
||||
element_hover: Some(rgba(0x313741ff).into()),
|
||||
element_active: Some(rgba(0x3d4350ff).into()),
|
||||
element_selected: Some(rgba(0x3d4350ff).into()),
|
||||
element_disabled: Some(rgba(0x2b3039ff).into()),
|
||||
drop_target_background: Some(rgba(0xa6978280).into()),
|
||||
ghost_element_background: Some(rgba(0x00000000).into()),
|
||||
ghost_element_hover: Some(rgba(0x313741ff).into()),
|
||||
ghost_element_active: Some(rgba(0x3d4350ff).into()),
|
||||
ghost_element_selected: Some(rgba(0x3d4350ff).into()),
|
||||
ghost_element_disabled: Some(rgba(0x2b3039ff).into()),
|
||||
text: Some(rgba(0xfdf4c1ff).into()),
|
||||
text_muted: Some(rgba(0xa69782ff).into()),
|
||||
text_placeholder: Some(rgba(0x827568ff).into()),
|
||||
text_disabled: Some(rgba(0x827568ff).into()),
|
||||
text_accent: Some(rgba(0x528b8bff).into()),
|
||||
icon: Some(rgba(0xfdf4c1ff).into()),
|
||||
icon_muted: Some(rgba(0xa69782ff).into()),
|
||||
icon_disabled: Some(rgba(0x827568ff).into()),
|
||||
icon_placeholder: Some(rgba(0xa69782ff).into()),
|
||||
icon_accent: Some(rgba(0x528b8bff).into()),
|
||||
status_bar_background: Some(rgba(0x333944ff).into()),
|
||||
title_bar_background: Some(rgba(0x333944ff).into()),
|
||||
toolbar_background: Some(rgba(0x282c34ff).into()),
|
||||
tab_bar_background: Some(rgba(0x2b3039ff).into()),
|
||||
tab_inactive_background: Some(rgba(0x2b3039ff).into()),
|
||||
tab_active_background: Some(rgba(0x282c34ff).into()),
|
||||
scrollbar_thumb_background: Some(rgba(0xfdf4c14c).into()),
|
||||
scrollbar_thumb_hover_background: Some(rgba(0x313741ff).into()),
|
||||
scrollbar_thumb_border: Some(rgba(0x313741ff).into()),
|
||||
scrollbar_track_background: Some(rgba(0x282c34ff).into()),
|
||||
scrollbar_track_border: Some(rgba(0x2a2f38ff).into()),
|
||||
editor_foreground: Some(rgba(0xfdf4c1ff).into()),
|
||||
editor_background: Some(rgba(0x282c34ff).into()),
|
||||
editor_gutter_background: Some(rgba(0x282c34ff).into()),
|
||||
editor_subheader_background: Some(rgba(0x2b3039ff).into()),
|
||||
editor_active_line_background: Some(rgba(0x2b3039bf).into()),
|
||||
editor_highlighted_line_background: Some(rgba(0x2b3039ff).into()),
|
||||
editor_line_number: Some(rgba(0xfdf4c159).into()),
|
||||
editor_active_line_number: Some(rgba(0xfdf4c1ff).into()),
|
||||
editor_invisible: Some(rgba(0xa69782ff).into()),
|
||||
editor_wrap_guide: Some(rgba(0xfdf4c10d).into()),
|
||||
editor_active_wrap_guide: Some(rgba(0xfdf4c11a).into()),
|
||||
editor_document_highlight_read_background: Some(rgba(0x528b8b1a).into()),
|
||||
editor_document_highlight_write_background: Some(rgba(0x7c6f6466).into()),
|
||||
terminal_background: Some(rgba(0x282c34ff).into()),
|
||||
terminal_ansi_bright_black: Some(rgba(0x5e5753ff).into()),
|
||||
terminal_ansi_bright_red: Some(rgba(0x57333dff).into()),
|
||||
terminal_ansi_bright_green: Some(rgba(0x414f4aff).into()),
|
||||
terminal_ansi_bright_yellow: Some(rgba(0x4e3f22ff).into()),
|
||||
terminal_ansi_bright_blue: Some(rgba(0x2c4444ff).into()),
|
||||
terminal_ansi_bright_magenta: Some(rgba(0x523a18ff).into()),
|
||||
terminal_ansi_bright_cyan: Some(rgba(0x414f4aff).into()),
|
||||
terminal_ansi_bright_white: Some(rgba(0xfdf4c1ff).into()),
|
||||
terminal_ansi_black: Some(rgba(0x282c34ff).into()),
|
||||
terminal_ansi_red: Some(rgba(0xb4637aff).into()),
|
||||
terminal_ansi_green: Some(rgba(0x83a598ff).into()),
|
||||
terminal_ansi_yellow: Some(rgba(0xa07e3bff).into()),
|
||||
terminal_ansi_blue: Some(rgba(0x528b8bff).into()),
|
||||
terminal_ansi_magenta: Some(rgba(0xa87323ff).into()),
|
||||
terminal_ansi_cyan: Some(rgba(0x83a598ff).into()),
|
||||
terminal_ansi_white: Some(rgba(0xfdf4c1ff).into()),
|
||||
link_text_hover: Some(rgba(0x528b8bff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
status: StatusColorsRefinement {
|
||||
conflict: Some(rgba(0xa07e3bff).into()),
|
||||
conflict_background: Some(rgba(0x231d12ff).into()),
|
||||
conflict_border: Some(rgba(0x392e1aff).into()),
|
||||
created: Some(rgba(0x83a598ff).into()),
|
||||
created_background: Some(rgba(0x1e2321ff).into()),
|
||||
created_border: Some(rgba(0x303a36ff).into()),
|
||||
deleted: Some(rgba(0xb4637aff).into()),
|
||||
deleted_background: Some(rgba(0x26191cff).into()),
|
||||
deleted_border: Some(rgba(0x3f272dff).into()),
|
||||
error: Some(rgba(0xb4637aff).into()),
|
||||
error_background: Some(rgba(0x26191cff).into()),
|
||||
error_border: Some(rgba(0x3f272dff).into()),
|
||||
hidden: Some(rgba(0x827568ff).into()),
|
||||
hidden_background: Some(rgba(0x333944ff).into()),
|
||||
hidden_border: Some(rgba(0x393f4aff).into()),
|
||||
hint: Some(rgba(0x727d68ff).into()),
|
||||
hint_background: Some(rgba(0x171f1fff).into()),
|
||||
hint_border: Some(rgba(0x223232ff).into()),
|
||||
ignored: Some(rgba(0xa69782ff).into()),
|
||||
ignored_background: Some(rgba(0x333944ff).into()),
|
||||
ignored_border: Some(rgba(0x3d4350ff).into()),
|
||||
info: Some(rgba(0x528b8bff).into()),
|
||||
info_background: Some(rgba(0x171f1fff).into()),
|
||||
info_border: Some(rgba(0x223232ff).into()),
|
||||
modified: Some(rgba(0xa07e3bff).into()),
|
||||
modified_background: Some(rgba(0x231d12ff).into()),
|
||||
modified_border: Some(rgba(0x392e1aff).into()),
|
||||
predictive: Some(rgba(0x83a598ff).into()),
|
||||
predictive_background: Some(rgba(0x1e2321ff).into()),
|
||||
predictive_border: Some(rgba(0x303a36ff).into()),
|
||||
renamed: Some(rgba(0x528b8bff).into()),
|
||||
renamed_background: Some(rgba(0x171f1fff).into()),
|
||||
renamed_border: Some(rgba(0x223232ff).into()),
|
||||
success: Some(rgba(0x83a598ff).into()),
|
||||
success_background: Some(rgba(0x1e2321ff).into()),
|
||||
success_border: Some(rgba(0x303a36ff).into()),
|
||||
unreachable: Some(rgba(0xa69782ff).into()),
|
||||
unreachable_background: Some(rgba(0x333944ff).into()),
|
||||
unreachable_border: Some(rgba(0x3d4350ff).into()),
|
||||
warning: Some(rgba(0xa07e3bff).into()),
|
||||
warning_background: Some(rgba(0x231d12ff).into()),
|
||||
warning_border: Some(rgba(0x392e1aff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
player: Some(PlayerColors(vec![
|
||||
PlayerColor {
|
||||
cursor: rgba(0x528b8bff).into(),
|
||||
background: rgba(0x528b8bff).into(),
|
||||
selection: rgba(0x528b8b3d).into(),
|
||||
},
|
||||
PlayerColor {
|
||||
cursor: rgba(0xa87323ff).into(),
|
||||
background: rgba(0xa87323ff).into(),
|
||||
selection: rgba(0xa873233d).into(),
|
||||
},
|
||||
PlayerColor {
|
||||
cursor: rgba(0xa07e3bff).into(),
|
||||
background: rgba(0xa07e3bff).into(),
|
||||
selection: rgba(0xa07e3b3d).into(),
|
||||
},
|
||||
PlayerColor {
|
||||
cursor: rgba(0xd75f5fff).into(),
|
||||
background: rgba(0xd75f5fff).into(),
|
||||
selection: rgba(0xd75f5f3d).into(),
|
||||
},
|
||||
PlayerColor {
|
||||
cursor: rgba(0x83a598ff).into(),
|
||||
background: rgba(0x83a598ff).into(),
|
||||
selection: rgba(0x83a5983d).into(),
|
||||
},
|
||||
PlayerColor {
|
||||
cursor: rgba(0xb4637aff).into(),
|
||||
background: rgba(0xb4637aff).into(),
|
||||
selection: rgba(0xb4637a3d).into(),
|
||||
},
|
||||
PlayerColor {
|
||||
cursor: rgba(0xa07e3bff).into(),
|
||||
background: rgba(0xa07e3bff).into(),
|
||||
selection: rgba(0xa07e3b3d).into(),
|
||||
},
|
||||
PlayerColor {
|
||||
cursor: rgba(0x83a598ff).into(),
|
||||
background: rgba(0x83a598ff).into(),
|
||||
selection: rgba(0x83a5983d).into(),
|
||||
},
|
||||
])),
|
||||
syntax: Some(UserSyntaxTheme {
|
||||
highlights: vec![
|
||||
(
|
||||
"attribute".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0x528b8bff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"boolean".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0x83a598ff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"comment".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0xa89984ff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"comment.doc".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0xa89984ff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"constant".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0x83a598ff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"constructor".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0x528b8bff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"embedded".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0xfdf4c1ff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"emphasis".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0x528b8bff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"emphasis.strong".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0x528b8bff).into()),
|
||||
font_weight: Some(UserFontWeight(700.0)),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"enum".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0xa07e3bff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"function".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0xa07e3bff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"hint".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0x727d68ff).into()),
|
||||
font_weight: Some(UserFontWeight(700.0)),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"keyword".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0x528b8bff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"label".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0x528b8bff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"link_text".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0xa07e3bff).into()),
|
||||
font_style: Some(UserFontStyle::Italic),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"link_uri".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0x83a598ff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"number".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0x83a598ff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"operator".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0xa07e3bff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"predictive".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0x5c6152ff).into()),
|
||||
font_style: Some(UserFontStyle::Italic),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"preproc".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0xfdf4c1ff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"primary".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0xfdf4c1ff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"property".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0x528b8bff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"punctuation".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0xd5c5a1ff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"punctuation.bracket".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0xd5c5a1ff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"punctuation.delimiter".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0xd5c5a1ff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"punctuation.list_marker".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0xd5c5a1ff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"punctuation.special".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0xd5c5a1ff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"string".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0xa07e3bff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"string.escape".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0xa89984ff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"string.regex".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0xa07e3bff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"string.special".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0xa07e3bff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"string.special.symbol".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0xa07e3bff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"tag".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0x528b8bff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"text.literal".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0xa07e3bff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"title".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0xfdf4c1ff).into()),
|
||||
font_weight: Some(UserFontWeight(700.0)),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"type".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0x83a598ff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"variable".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0xfdf4c1ff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"variant".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0x528b8bff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
],
|
||||
}),
|
||||
},
|
||||
}],
|
||||
}
|
||||
}
|
908
crates/theme/src/themes/solarized.rs
Normal file
908
crates/theme/src/themes/solarized.rs
Normal file
|
@ -0,0 +1,908 @@
|
|||
// This file was generated by the `theme_importer`.
|
||||
// Be careful when modifying it by hand.
|
||||
|
||||
use gpui::rgba;
|
||||
|
||||
#[allow(unused)]
|
||||
use crate::{
|
||||
Appearance, PlayerColor, PlayerColors, StatusColorsRefinement, ThemeColorsRefinement,
|
||||
UserFontStyle, UserFontWeight, UserHighlightStyle, UserSyntaxTheme, UserTheme, UserThemeFamily,
|
||||
UserThemeStylesRefinement,
|
||||
};
|
||||
|
||||
pub fn solarized() -> UserThemeFamily {
|
||||
UserThemeFamily {
|
||||
name: "Solarized".into(),
|
||||
author: "Zed Industries".into(),
|
||||
themes: vec![
|
||||
UserTheme {
|
||||
name: "Solarized Light".into(),
|
||||
appearance: Appearance::Light,
|
||||
styles: UserThemeStylesRefinement {
|
||||
colors: ThemeColorsRefinement {
|
||||
border: Some(rgba(0x9faaa8ff).into()),
|
||||
border_variant: Some(rgba(0x9faaa8ff).into()),
|
||||
border_focused: Some(rgba(0xbfd3efff).into()),
|
||||
border_selected: Some(rgba(0xbfd3efff).into()),
|
||||
border_transparent: Some(rgba(0x00000000).into()),
|
||||
border_disabled: Some(rgba(0xb7bdb6ff).into()),
|
||||
elevated_surface_background: Some(rgba(0xf3eddaff).into()),
|
||||
surface_background: Some(rgba(0xf3eddaff).into()),
|
||||
background: Some(rgba(0xcfd0c4ff).into()),
|
||||
panel_background: Some(rgba(0xf3eddaff).into()),
|
||||
element_background: Some(rgba(0xf3eddaff).into()),
|
||||
element_hover: Some(rgba(0xdcdacbff).into()),
|
||||
element_active: Some(rgba(0xa2aca9ff).into()),
|
||||
element_selected: Some(rgba(0xa2aca9ff).into()),
|
||||
element_disabled: Some(rgba(0xf3eddaff).into()),
|
||||
drop_target_background: Some(rgba(0x34555e80).into()),
|
||||
ghost_element_background: Some(rgba(0x00000000).into()),
|
||||
ghost_element_hover: Some(rgba(0xdcdacbff).into()),
|
||||
ghost_element_active: Some(rgba(0xa2aca9ff).into()),
|
||||
ghost_element_selected: Some(rgba(0xa2aca9ff).into()),
|
||||
ghost_element_disabled: Some(rgba(0xf3eddaff).into()),
|
||||
text: Some(rgba(0x002b36ff).into()),
|
||||
text_muted: Some(rgba(0x34555eff).into()),
|
||||
text_placeholder: Some(rgba(0x6a7f86ff).into()),
|
||||
text_disabled: Some(rgba(0x6a7f86ff).into()),
|
||||
text_accent: Some(rgba(0x298bd1ff).into()),
|
||||
icon: Some(rgba(0x002b36ff).into()),
|
||||
icon_muted: Some(rgba(0x34555eff).into()),
|
||||
icon_disabled: Some(rgba(0x6a7f86ff).into()),
|
||||
icon_placeholder: Some(rgba(0x34555eff).into()),
|
||||
icon_accent: Some(rgba(0x298bd1ff).into()),
|
||||
status_bar_background: Some(rgba(0xcfd0c4ff).into()),
|
||||
title_bar_background: Some(rgba(0xcfd0c4ff).into()),
|
||||
toolbar_background: Some(rgba(0xfdf6e3ff).into()),
|
||||
tab_bar_background: Some(rgba(0xf3eddaff).into()),
|
||||
tab_inactive_background: Some(rgba(0xf3eddaff).into()),
|
||||
tab_active_background: Some(rgba(0xfdf6e3ff).into()),
|
||||
scrollbar_thumb_background: Some(rgba(0x002b364c).into()),
|
||||
scrollbar_thumb_hover_background: Some(rgba(0xdcdacbff).into()),
|
||||
scrollbar_thumb_border: Some(rgba(0xdcdacbff).into()),
|
||||
scrollbar_track_background: Some(rgba(0xfdf6e3ff).into()),
|
||||
scrollbar_track_border: Some(rgba(0xf5eedbff).into()),
|
||||
editor_foreground: Some(rgba(0x002b36ff).into()),
|
||||
editor_background: Some(rgba(0xfdf6e3ff).into()),
|
||||
editor_gutter_background: Some(rgba(0xfdf6e3ff).into()),
|
||||
editor_subheader_background: Some(rgba(0xf3eddaff).into()),
|
||||
editor_active_line_background: Some(rgba(0xf3eddabf).into()),
|
||||
editor_highlighted_line_background: Some(rgba(0xf3eddaff).into()),
|
||||
editor_line_number: Some(rgba(0x002b3659).into()),
|
||||
editor_active_line_number: Some(rgba(0x002b36ff).into()),
|
||||
editor_invisible: Some(rgba(0x34555eff).into()),
|
||||
editor_wrap_guide: Some(rgba(0x002b360d).into()),
|
||||
editor_active_wrap_guide: Some(rgba(0x002b361a).into()),
|
||||
editor_document_highlight_read_background: Some(rgba(0x298bd11a).into()),
|
||||
editor_document_highlight_write_background: Some(rgba(0x6d828866).into()),
|
||||
terminal_background: Some(rgba(0xfdf6e3ff).into()),
|
||||
terminal_ansi_bright_black: Some(rgba(0x7b8e91ff).into()),
|
||||
terminal_ansi_bright_red: Some(rgba(0xfaa091ff).into()),
|
||||
terminal_ansi_bright_green: Some(rgba(0xc6cb8bff).into()),
|
||||
terminal_ansi_bright_yellow: Some(rgba(0xe1c28aff).into()),
|
||||
terminal_ansi_bright_blue: Some(rgba(0xa5c3e9ff).into()),
|
||||
terminal_ansi_bright_magenta: Some(rgba(0xf0a2bfff).into()),
|
||||
terminal_ansi_bright_cyan: Some(rgba(0x9fd0cbff).into()),
|
||||
terminal_ansi_bright_white: Some(rgba(0x002b36ff).into()),
|
||||
terminal_ansi_black: Some(rgba(0xfdf6e3ff).into()),
|
||||
terminal_ansi_red: Some(rgba(0xdc3330ff).into()),
|
||||
terminal_ansi_green: Some(rgba(0x859904ff).into()),
|
||||
terminal_ansi_yellow: Some(rgba(0xb58904ff).into()),
|
||||
terminal_ansi_blue: Some(rgba(0x298bd1ff).into()),
|
||||
terminal_ansi_magenta: Some(rgba(0xd33882ff).into()),
|
||||
terminal_ansi_cyan: Some(rgba(0x2ca198ff).into()),
|
||||
terminal_ansi_white: Some(rgba(0x002b36ff).into()),
|
||||
link_text_hover: Some(rgba(0x298bd1ff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
status: StatusColorsRefinement {
|
||||
conflict: Some(rgba(0xb58904ff).into()),
|
||||
conflict_background: Some(rgba(0xf5e6d0ff).into()),
|
||||
conflict_border: Some(rgba(0xebd3aaff).into()),
|
||||
created: Some(rgba(0x859904ff).into()),
|
||||
created_background: Some(rgba(0xe9ead0ff).into()),
|
||||
created_border: Some(rgba(0xd6d9abff).into()),
|
||||
deleted: Some(rgba(0xdc3330ff).into()),
|
||||
deleted_background: Some(rgba(0xffd9d2ff).into()),
|
||||
deleted_border: Some(rgba(0xffbbafff).into()),
|
||||
error: Some(rgba(0xdc3330ff).into()),
|
||||
error_background: Some(rgba(0xffd9d2ff).into()),
|
||||
error_border: Some(rgba(0xffbbafff).into()),
|
||||
hidden: Some(rgba(0x6a7f86ff).into()),
|
||||
hidden_background: Some(rgba(0xcfd0c4ff).into()),
|
||||
hidden_border: Some(rgba(0xb7bdb6ff).into()),
|
||||
hint: Some(rgba(0x5889a3ff).into()),
|
||||
hint_background: Some(rgba(0xdbe6f6ff).into()),
|
||||
hint_border: Some(rgba(0xbfd3efff).into()),
|
||||
ignored: Some(rgba(0x34555eff).into()),
|
||||
ignored_background: Some(rgba(0xcfd0c4ff).into()),
|
||||
ignored_border: Some(rgba(0x9faaa8ff).into()),
|
||||
info: Some(rgba(0x298bd1ff).into()),
|
||||
info_background: Some(rgba(0xdbe6f6ff).into()),
|
||||
info_border: Some(rgba(0xbfd3efff).into()),
|
||||
modified: Some(rgba(0xb58904ff).into()),
|
||||
modified_background: Some(rgba(0xf5e6d0ff).into()),
|
||||
modified_border: Some(rgba(0xebd3aaff).into()),
|
||||
predictive: Some(rgba(0x859904ff).into()),
|
||||
predictive_background: Some(rgba(0xe9ead0ff).into()),
|
||||
predictive_border: Some(rgba(0xd6d9abff).into()),
|
||||
renamed: Some(rgba(0x298bd1ff).into()),
|
||||
renamed_background: Some(rgba(0xdbe6f6ff).into()),
|
||||
renamed_border: Some(rgba(0xbfd3efff).into()),
|
||||
success: Some(rgba(0x859904ff).into()),
|
||||
success_background: Some(rgba(0xe9ead0ff).into()),
|
||||
success_border: Some(rgba(0xd6d9abff).into()),
|
||||
unreachable: Some(rgba(0x34555eff).into()),
|
||||
unreachable_background: Some(rgba(0xcfd0c4ff).into()),
|
||||
unreachable_border: Some(rgba(0x9faaa8ff).into()),
|
||||
warning: Some(rgba(0xb58904ff).into()),
|
||||
warning_background: Some(rgba(0xf5e6d0ff).into()),
|
||||
warning_border: Some(rgba(0xebd3aaff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
player: Some(PlayerColors(vec![
|
||||
PlayerColor {
|
||||
cursor: rgba(0x298bd1ff).into(),
|
||||
background: rgba(0x298bd1ff).into(),
|
||||
selection: rgba(0x298bd13d).into(),
|
||||
},
|
||||
PlayerColor {
|
||||
cursor: rgba(0xd33882ff).into(),
|
||||
background: rgba(0xd33882ff).into(),
|
||||
selection: rgba(0xd338823d).into(),
|
||||
},
|
||||
PlayerColor {
|
||||
cursor: rgba(0xcb4c18ff).into(),
|
||||
background: rgba(0xcb4c18ff).into(),
|
||||
selection: rgba(0xcb4c183d).into(),
|
||||
},
|
||||
PlayerColor {
|
||||
cursor: rgba(0x6d71c4ff).into(),
|
||||
background: rgba(0x6d71c4ff).into(),
|
||||
selection: rgba(0x6d71c43d).into(),
|
||||
},
|
||||
PlayerColor {
|
||||
cursor: rgba(0x2ca198ff).into(),
|
||||
background: rgba(0x2ca198ff).into(),
|
||||
selection: rgba(0x2ca1983d).into(),
|
||||
},
|
||||
PlayerColor {
|
||||
cursor: rgba(0xdc3330ff).into(),
|
||||
background: rgba(0xdc3330ff).into(),
|
||||
selection: rgba(0xdc33303d).into(),
|
||||
},
|
||||
PlayerColor {
|
||||
cursor: rgba(0xb58904ff).into(),
|
||||
background: rgba(0xb58904ff).into(),
|
||||
selection: rgba(0xb589043d).into(),
|
||||
},
|
||||
PlayerColor {
|
||||
cursor: rgba(0x859904ff).into(),
|
||||
background: rgba(0x859904ff).into(),
|
||||
selection: rgba(0x8599043d).into(),
|
||||
},
|
||||
])),
|
||||
syntax: Some(UserSyntaxTheme {
|
||||
highlights: vec![
|
||||
(
|
||||
"attribute".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0x298bd1ff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"boolean".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0x859904ff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"comment".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0x30525bff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"comment.doc".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0x30525bff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"constant".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0x859904ff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"constructor".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0x298bd1ff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"embedded".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0x002b36ff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"emphasis".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0x298bd1ff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"emphasis.strong".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0x298bd1ff).into()),
|
||||
font_weight: Some(UserFontWeight(700.0)),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"enum".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0xcb4c18ff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"function".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0xb58904ff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"hint".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0x5889a3ff).into()),
|
||||
font_weight: Some(UserFontWeight(700.0)),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"keyword".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0x298bd1ff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"label".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0x298bd1ff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"link_text".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0xcb4c18ff).into()),
|
||||
font_style: Some(UserFontStyle::Italic),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"link_uri".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0x859904ff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"number".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0x859904ff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"operator".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0xcb4c18ff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"predictive".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0x679aafff).into()),
|
||||
font_style: Some(UserFontStyle::Italic),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"preproc".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0x002b36ff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"primary".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0x002b36ff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"property".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0x298bd1ff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"punctuation".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0x05333eff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"punctuation.bracket".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0x05333eff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"punctuation.delimiter".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0x05333eff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"punctuation.list_marker".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0x05333eff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"punctuation.special".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0x05333eff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"string".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0xcb4c18ff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"string.escape".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0x30525bff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"string.regex".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0xcb4c18ff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"string.special".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0xcb4c18ff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"string.special.symbol".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0xcb4c18ff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"tag".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0x298bd1ff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"text.literal".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0xcb4c18ff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"title".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0x002b36ff).into()),
|
||||
font_weight: Some(UserFontWeight(700.0)),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"type".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0x2ca198ff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"variable".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0x002b36ff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"variant".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0x298bd1ff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
],
|
||||
}),
|
||||
},
|
||||
},
|
||||
UserTheme {
|
||||
name: "Solarized Dark".into(),
|
||||
appearance: Appearance::Dark,
|
||||
styles: UserThemeStylesRefinement {
|
||||
colors: ThemeColorsRefinement {
|
||||
border: Some(rgba(0x2b4f58ff).into()),
|
||||
border_variant: Some(rgba(0x2b4f58ff).into()),
|
||||
border_focused: Some(rgba(0x1c3249ff).into()),
|
||||
border_selected: Some(rgba(0x1c3249ff).into()),
|
||||
border_transparent: Some(rgba(0x00000000).into()),
|
||||
border_disabled: Some(rgba(0x19424dff).into()),
|
||||
elevated_surface_background: Some(rgba(0x04313cff).into()),
|
||||
surface_background: Some(rgba(0x04313cff).into()),
|
||||
background: Some(rgba(0x083743ff).into()),
|
||||
panel_background: Some(rgba(0x04313cff).into()),
|
||||
element_background: Some(rgba(0x04313cff).into()),
|
||||
element_hover: Some(rgba(0x063541ff).into()),
|
||||
element_active: Some(rgba(0x294e58ff).into()),
|
||||
element_selected: Some(rgba(0x294e58ff).into()),
|
||||
element_disabled: Some(rgba(0x04313cff).into()),
|
||||
drop_target_background: Some(rgba(0x93a1a180).into()),
|
||||
ghost_element_background: Some(rgba(0x00000000).into()),
|
||||
ghost_element_hover: Some(rgba(0x063541ff).into()),
|
||||
ghost_element_active: Some(rgba(0x294e58ff).into()),
|
||||
ghost_element_selected: Some(rgba(0x294e58ff).into()),
|
||||
ghost_element_disabled: Some(rgba(0x04313cff).into()),
|
||||
text: Some(rgba(0xfdf6e3ff).into()),
|
||||
text_muted: Some(rgba(0x93a1a1ff).into()),
|
||||
text_placeholder: Some(rgba(0x6f8389ff).into()),
|
||||
text_disabled: Some(rgba(0x6f8389ff).into()),
|
||||
text_accent: Some(rgba(0x288bd1ff).into()),
|
||||
icon: Some(rgba(0xfdf6e3ff).into()),
|
||||
icon_muted: Some(rgba(0x93a1a1ff).into()),
|
||||
icon_disabled: Some(rgba(0x6f8389ff).into()),
|
||||
icon_placeholder: Some(rgba(0x93a1a1ff).into()),
|
||||
icon_accent: Some(rgba(0x288bd1ff).into()),
|
||||
status_bar_background: Some(rgba(0x083743ff).into()),
|
||||
title_bar_background: Some(rgba(0x083743ff).into()),
|
||||
toolbar_background: Some(rgba(0x002b36ff).into()),
|
||||
tab_bar_background: Some(rgba(0x04313cff).into()),
|
||||
tab_inactive_background: Some(rgba(0x04313cff).into()),
|
||||
tab_active_background: Some(rgba(0x002b36ff).into()),
|
||||
scrollbar_thumb_background: Some(rgba(0xfdf6e34c).into()),
|
||||
scrollbar_thumb_hover_background: Some(rgba(0x063541ff).into()),
|
||||
scrollbar_thumb_border: Some(rgba(0x063541ff).into()),
|
||||
scrollbar_track_background: Some(rgba(0x002b36ff).into()),
|
||||
scrollbar_track_border: Some(rgba(0x032f3bff).into()),
|
||||
editor_foreground: Some(rgba(0xfdf6e3ff).into()),
|
||||
editor_background: Some(rgba(0x002b36ff).into()),
|
||||
editor_gutter_background: Some(rgba(0x002b36ff).into()),
|
||||
editor_subheader_background: Some(rgba(0x04313cff).into()),
|
||||
editor_active_line_background: Some(rgba(0x04313cbf).into()),
|
||||
editor_highlighted_line_background: Some(rgba(0x04313cff).into()),
|
||||
editor_line_number: Some(rgba(0xfdf6e359).into()),
|
||||
editor_active_line_number: Some(rgba(0xfdf6e3ff).into()),
|
||||
editor_invisible: Some(rgba(0x93a1a1ff).into()),
|
||||
editor_wrap_guide: Some(rgba(0xfdf6e30d).into()),
|
||||
editor_active_wrap_guide: Some(rgba(0xfdf6e31a).into()),
|
||||
editor_document_highlight_read_background: Some(rgba(0x288bd11a).into()),
|
||||
editor_document_highlight_write_background: Some(rgba(0x6d828866).into()),
|
||||
terminal_background: Some(rgba(0x002b36ff).into()),
|
||||
terminal_ansi_bright_black: Some(rgba(0x5c7279ff).into()),
|
||||
terminal_ansi_bright_red: Some(rgba(0x7d181cff).into()),
|
||||
terminal_ansi_bright_green: Some(rgba(0x434a11ff).into()),
|
||||
terminal_ansi_bright_yellow: Some(rgba(0x5d4310ff).into()),
|
||||
terminal_ansi_bright_blue: Some(rgba(0x214465ff).into()),
|
||||
terminal_ansi_bright_magenta: Some(rgba(0x6f1f40ff).into()),
|
||||
terminal_ansi_bright_cyan: Some(rgba(0x204e4aff).into()),
|
||||
terminal_ansi_bright_white: Some(rgba(0xfdf6e3ff).into()),
|
||||
terminal_ansi_black: Some(rgba(0x002b36ff).into()),
|
||||
terminal_ansi_red: Some(rgba(0xdc3330ff).into()),
|
||||
terminal_ansi_green: Some(rgba(0x859904ff).into()),
|
||||
terminal_ansi_yellow: Some(rgba(0xb58903ff).into()),
|
||||
terminal_ansi_blue: Some(rgba(0x288bd1ff).into()),
|
||||
terminal_ansi_magenta: Some(rgba(0xd33782ff).into()),
|
||||
terminal_ansi_cyan: Some(rgba(0x2ca198ff).into()),
|
||||
terminal_ansi_white: Some(rgba(0xfdf6e3ff).into()),
|
||||
link_text_hover: Some(rgba(0x288bd1ff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
status: StatusColorsRefinement {
|
||||
conflict: Some(rgba(0xb58903ff).into()),
|
||||
conflict_background: Some(rgba(0x2f1e0cff).into()),
|
||||
conflict_border: Some(rgba(0x473110ff).into()),
|
||||
created: Some(rgba(0x859904ff).into()),
|
||||
created_background: Some(rgba(0x1f210cff).into()),
|
||||
created_border: Some(rgba(0x323610ff).into()),
|
||||
deleted: Some(rgba(0xdc3330ff).into()),
|
||||
deleted_background: Some(rgba(0x4a090fff).into()),
|
||||
deleted_border: Some(rgba(0x641116ff).into()),
|
||||
error: Some(rgba(0xdc3330ff).into()),
|
||||
error_background: Some(rgba(0x4a090fff).into()),
|
||||
error_border: Some(rgba(0x641116ff).into()),
|
||||
hidden: Some(rgba(0x6f8389ff).into()),
|
||||
hidden_background: Some(rgba(0x083743ff).into()),
|
||||
hidden_border: Some(rgba(0x19424dff).into()),
|
||||
hint: Some(rgba(0x4f8297ff).into()),
|
||||
hint_background: Some(rgba(0x141f2cff).into()),
|
||||
hint_border: Some(rgba(0x1c3249ff).into()),
|
||||
ignored: Some(rgba(0x93a1a1ff).into()),
|
||||
ignored_background: Some(rgba(0x083743ff).into()),
|
||||
ignored_border: Some(rgba(0x2b4f58ff).into()),
|
||||
info: Some(rgba(0x288bd1ff).into()),
|
||||
info_background: Some(rgba(0x141f2cff).into()),
|
||||
info_border: Some(rgba(0x1c3249ff).into()),
|
||||
modified: Some(rgba(0xb58903ff).into()),
|
||||
modified_background: Some(rgba(0x2f1e0cff).into()),
|
||||
modified_border: Some(rgba(0x473110ff).into()),
|
||||
predictive: Some(rgba(0x859904ff).into()),
|
||||
predictive_background: Some(rgba(0x1f210cff).into()),
|
||||
predictive_border: Some(rgba(0x323610ff).into()),
|
||||
renamed: Some(rgba(0x288bd1ff).into()),
|
||||
renamed_background: Some(rgba(0x141f2cff).into()),
|
||||
renamed_border: Some(rgba(0x1c3249ff).into()),
|
||||
success: Some(rgba(0x859904ff).into()),
|
||||
success_background: Some(rgba(0x1f210cff).into()),
|
||||
success_border: Some(rgba(0x323610ff).into()),
|
||||
unreachable: Some(rgba(0x93a1a1ff).into()),
|
||||
unreachable_background: Some(rgba(0x083743ff).into()),
|
||||
unreachable_border: Some(rgba(0x2b4f58ff).into()),
|
||||
warning: Some(rgba(0xb58903ff).into()),
|
||||
warning_background: Some(rgba(0x2f1e0cff).into()),
|
||||
warning_border: Some(rgba(0x473110ff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
player: Some(PlayerColors(vec![
|
||||
PlayerColor {
|
||||
cursor: rgba(0x288bd1ff).into(),
|
||||
background: rgba(0x288bd1ff).into(),
|
||||
selection: rgba(0x288bd13d).into(),
|
||||
},
|
||||
PlayerColor {
|
||||
cursor: rgba(0xd33782ff).into(),
|
||||
background: rgba(0xd33782ff).into(),
|
||||
selection: rgba(0xd337823d).into(),
|
||||
},
|
||||
PlayerColor {
|
||||
cursor: rgba(0xcb4b17ff).into(),
|
||||
background: rgba(0xcb4b17ff).into(),
|
||||
selection: rgba(0xcb4b173d).into(),
|
||||
},
|
||||
PlayerColor {
|
||||
cursor: rgba(0x6c71c4ff).into(),
|
||||
background: rgba(0x6c71c4ff).into(),
|
||||
selection: rgba(0x6c71c43d).into(),
|
||||
},
|
||||
PlayerColor {
|
||||
cursor: rgba(0x2ca198ff).into(),
|
||||
background: rgba(0x2ca198ff).into(),
|
||||
selection: rgba(0x2ca1983d).into(),
|
||||
},
|
||||
PlayerColor {
|
||||
cursor: rgba(0xdc3330ff).into(),
|
||||
background: rgba(0xdc3330ff).into(),
|
||||
selection: rgba(0xdc33303d).into(),
|
||||
},
|
||||
PlayerColor {
|
||||
cursor: rgba(0xb58903ff).into(),
|
||||
background: rgba(0xb58903ff).into(),
|
||||
selection: rgba(0xb589033d).into(),
|
||||
},
|
||||
PlayerColor {
|
||||
cursor: rgba(0x859904ff).into(),
|
||||
background: rgba(0x859904ff).into(),
|
||||
selection: rgba(0x8599043d).into(),
|
||||
},
|
||||
])),
|
||||
syntax: Some(UserSyntaxTheme {
|
||||
highlights: vec![
|
||||
(
|
||||
"attribute".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0x288bd1ff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"boolean".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0x859904ff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"comment".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0x99a5a4ff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"comment.doc".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0x99a5a4ff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"constant".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0x859904ff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"constructor".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0x288bd1ff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"embedded".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0xfdf6e3ff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"emphasis".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0x288bd1ff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"emphasis.strong".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0x288bd1ff).into()),
|
||||
font_weight: Some(UserFontWeight(700.0)),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"enum".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0xcb4b17ff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"function".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0xb58903ff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"hint".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0x4f8297ff).into()),
|
||||
font_weight: Some(UserFontWeight(700.0)),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"keyword".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0x288bd1ff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"label".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0x288bd1ff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"link_text".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0xcb4b17ff).into()),
|
||||
font_style: Some(UserFontStyle::Italic),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"link_uri".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0x859904ff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"number".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0x859904ff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"operator".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0xcb4b17ff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"predictive".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0x40728bff).into()),
|
||||
font_style: Some(UserFontStyle::Italic),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"preproc".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0xfdf6e3ff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"primary".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0xfdf6e3ff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"property".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0x288bd1ff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"punctuation".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0xefe9d6ff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"punctuation.bracket".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0xefe9d6ff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"punctuation.delimiter".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0xefe9d6ff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"punctuation.list_marker".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0xefe9d6ff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"punctuation.special".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0xefe9d6ff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"string".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0xcb4b17ff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"string.escape".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0x99a5a4ff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"string.regex".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0xcb4b17ff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"string.special".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0xcb4b17ff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"string.special.symbol".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0xcb4b17ff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"tag".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0x288bd1ff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"text.literal".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0xcb4b17ff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"title".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0xfdf6e3ff).into()),
|
||||
font_weight: Some(UserFontWeight(700.0)),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"type".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0x2ca198ff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"variable".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0xfdf6e3ff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"variant".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0x288bd1ff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
],
|
||||
}),
|
||||
},
|
||||
},
|
||||
],
|
||||
}
|
||||
}
|
462
crates/theme/src/themes/summercamp.rs
Normal file
462
crates/theme/src/themes/summercamp.rs
Normal file
|
@ -0,0 +1,462 @@
|
|||
// This file was generated by the `theme_importer`.
|
||||
// Be careful when modifying it by hand.
|
||||
|
||||
use gpui::rgba;
|
||||
|
||||
#[allow(unused)]
|
||||
use crate::{
|
||||
Appearance, PlayerColor, PlayerColors, StatusColorsRefinement, ThemeColorsRefinement,
|
||||
UserFontStyle, UserFontWeight, UserHighlightStyle, UserSyntaxTheme, UserTheme, UserThemeFamily,
|
||||
UserThemeStylesRefinement,
|
||||
};
|
||||
|
||||
pub fn summercamp() -> UserThemeFamily {
|
||||
UserThemeFamily {
|
||||
name: "Summercamp".into(),
|
||||
author: "Zed Industries".into(),
|
||||
themes: vec![UserTheme {
|
||||
name: "Summercamp".into(),
|
||||
appearance: Appearance::Dark,
|
||||
styles: UserThemeStylesRefinement {
|
||||
colors: ThemeColorsRefinement {
|
||||
border: Some(rgba(0x312d21ff).into()),
|
||||
border_variant: Some(rgba(0x312d21ff).into()),
|
||||
border_focused: Some(rgba(0x193761ff).into()),
|
||||
border_selected: Some(rgba(0x193761ff).into()),
|
||||
border_transparent: Some(rgba(0x00000000).into()),
|
||||
border_disabled: Some(rgba(0x2e2a1fff).into()),
|
||||
elevated_surface_background: Some(rgba(0x231f16ff).into()),
|
||||
surface_background: Some(rgba(0x231f16ff).into()),
|
||||
background: Some(rgba(0x2a261cff).into()),
|
||||
panel_background: Some(rgba(0x231f16ff).into()),
|
||||
element_background: Some(rgba(0x231f16ff).into()),
|
||||
element_hover: Some(rgba(0x29251bff).into()),
|
||||
element_active: Some(rgba(0x302c20ff).into()),
|
||||
element_selected: Some(rgba(0x302c20ff).into()),
|
||||
element_disabled: Some(rgba(0x231f16ff).into()),
|
||||
drop_target_background: Some(rgba(0x736e5580).into()),
|
||||
ghost_element_background: Some(rgba(0x00000000).into()),
|
||||
ghost_element_hover: Some(rgba(0x29251bff).into()),
|
||||
ghost_element_active: Some(rgba(0x302c20ff).into()),
|
||||
ghost_element_selected: Some(rgba(0x302c20ff).into()),
|
||||
ghost_element_disabled: Some(rgba(0x231f16ff).into()),
|
||||
text: Some(rgba(0xf8f5deff).into()),
|
||||
text_muted: Some(rgba(0x736e55ff).into()),
|
||||
text_placeholder: Some(rgba(0x4c4735ff).into()),
|
||||
text_disabled: Some(rgba(0x4c4735ff).into()),
|
||||
text_accent: Some(rgba(0x499befff).into()),
|
||||
icon: Some(rgba(0xf8f5deff).into()),
|
||||
icon_muted: Some(rgba(0x736e55ff).into()),
|
||||
icon_disabled: Some(rgba(0x4c4735ff).into()),
|
||||
icon_placeholder: Some(rgba(0x736e55ff).into()),
|
||||
icon_accent: Some(rgba(0x499befff).into()),
|
||||
status_bar_background: Some(rgba(0x2a261cff).into()),
|
||||
title_bar_background: Some(rgba(0x2a261cff).into()),
|
||||
toolbar_background: Some(rgba(0x1c1810ff).into()),
|
||||
tab_bar_background: Some(rgba(0x231f16ff).into()),
|
||||
tab_inactive_background: Some(rgba(0x231f16ff).into()),
|
||||
tab_active_background: Some(rgba(0x1c1810ff).into()),
|
||||
scrollbar_thumb_background: Some(rgba(0xf8f5de4c).into()),
|
||||
scrollbar_thumb_hover_background: Some(rgba(0x29251bff).into()),
|
||||
scrollbar_thumb_border: Some(rgba(0x29251bff).into()),
|
||||
scrollbar_track_background: Some(rgba(0x1c1810ff).into()),
|
||||
scrollbar_track_border: Some(rgba(0x221e15ff).into()),
|
||||
editor_foreground: Some(rgba(0xf8f5deff).into()),
|
||||
editor_background: Some(rgba(0x1c1810ff).into()),
|
||||
editor_gutter_background: Some(rgba(0x1c1810ff).into()),
|
||||
editor_subheader_background: Some(rgba(0x231f16ff).into()),
|
||||
editor_active_line_background: Some(rgba(0x231f16bf).into()),
|
||||
editor_highlighted_line_background: Some(rgba(0x231f16ff).into()),
|
||||
editor_line_number: Some(rgba(0xf8f5de59).into()),
|
||||
editor_active_line_number: Some(rgba(0xf8f5deff).into()),
|
||||
editor_invisible: Some(rgba(0x736e55ff).into()),
|
||||
editor_wrap_guide: Some(rgba(0xf8f5de0d).into()),
|
||||
editor_active_wrap_guide: Some(rgba(0xf8f5de1a).into()),
|
||||
editor_document_highlight_read_background: Some(rgba(0x499bef1a).into()),
|
||||
editor_document_highlight_write_background: Some(rgba(0x49443366).into()),
|
||||
terminal_background: Some(rgba(0x1c1810ff).into()),
|
||||
terminal_ansi_bright_black: Some(rgba(0x3b3627ff).into()),
|
||||
terminal_ansi_bright_red: Some(rgba(0x7f2724ff).into()),
|
||||
terminal_ansi_bright_green: Some(rgba(0x28842cff).into()),
|
||||
terminal_ansi_bright_yellow: Some(rgba(0x8c9a10ff).into()),
|
||||
terminal_ansi_bright_blue: Some(rgba(0x234b7fff).into()),
|
||||
terminal_ansi_bright_magenta: Some(rgba(0x88487eff).into()),
|
||||
terminal_ansi_bright_cyan: Some(rgba(0x298462ff).into()),
|
||||
terminal_ansi_bright_white: Some(rgba(0xf8f5deff).into()),
|
||||
terminal_ansi_black: Some(rgba(0x1c1810ff).into()),
|
||||
terminal_ansi_red: Some(rgba(0xe35142ff).into()),
|
||||
terminal_ansi_green: Some(rgba(0x5dea5aff).into()),
|
||||
terminal_ansi_yellow: Some(rgba(0xf1fe29ff).into()),
|
||||
terminal_ansi_blue: Some(rgba(0x499befff).into()),
|
||||
terminal_ansi_magenta: Some(rgba(0xf59be6ff).into()),
|
||||
terminal_ansi_cyan: Some(rgba(0x5beabcff).into()),
|
||||
terminal_ansi_white: Some(rgba(0xf8f5deff).into()),
|
||||
link_text_hover: Some(rgba(0x499befff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
status: StatusColorsRefinement {
|
||||
conflict: Some(rgba(0xf1fe29ff).into()),
|
||||
conflict_background: Some(rgba(0x556305ff).into()),
|
||||
conflict_border: Some(rgba(0x727f0aff).into()),
|
||||
created: Some(rgba(0x5dea5aff).into()),
|
||||
created_background: Some(rgba(0x0a4d13ff).into()),
|
||||
created_border: Some(rgba(0x1a6a20ff).into()),
|
||||
deleted: Some(rgba(0xe35142ff).into()),
|
||||
deleted_background: Some(rgba(0x491013ff).into()),
|
||||
deleted_border: Some(rgba(0x651c1cff).into()),
|
||||
error: Some(rgba(0xe35142ff).into()),
|
||||
error_background: Some(rgba(0x491013ff).into()),
|
||||
error_border: Some(rgba(0x651c1cff).into()),
|
||||
hidden: Some(rgba(0x4c4735ff).into()),
|
||||
hidden_background: Some(rgba(0x2a261cff).into()),
|
||||
hidden_border: Some(rgba(0x2e2a1fff).into()),
|
||||
hint: Some(rgba(0x246e61ff).into()),
|
||||
hint_background: Some(rgba(0x0e2242ff).into()),
|
||||
hint_border: Some(rgba(0x193761ff).into()),
|
||||
ignored: Some(rgba(0x736e55ff).into()),
|
||||
ignored_background: Some(rgba(0x2a261cff).into()),
|
||||
ignored_border: Some(rgba(0x312d21ff).into()),
|
||||
info: Some(rgba(0x499befff).into()),
|
||||
info_background: Some(rgba(0x0e2242ff).into()),
|
||||
info_border: Some(rgba(0x193761ff).into()),
|
||||
modified: Some(rgba(0xf1fe29ff).into()),
|
||||
modified_background: Some(rgba(0x556305ff).into()),
|
||||
modified_border: Some(rgba(0x727f0aff).into()),
|
||||
predictive: Some(rgba(0x5dea5aff).into()),
|
||||
predictive_background: Some(rgba(0x0a4d13ff).into()),
|
||||
predictive_border: Some(rgba(0x1a6a20ff).into()),
|
||||
renamed: Some(rgba(0x499befff).into()),
|
||||
renamed_background: Some(rgba(0x0e2242ff).into()),
|
||||
renamed_border: Some(rgba(0x193761ff).into()),
|
||||
success: Some(rgba(0x5dea5aff).into()),
|
||||
success_background: Some(rgba(0x0a4d13ff).into()),
|
||||
success_border: Some(rgba(0x1a6a20ff).into()),
|
||||
unreachable: Some(rgba(0x736e55ff).into()),
|
||||
unreachable_background: Some(rgba(0x2a261cff).into()),
|
||||
unreachable_border: Some(rgba(0x312d21ff).into()),
|
||||
warning: Some(rgba(0xf1fe29ff).into()),
|
||||
warning_background: Some(rgba(0x556305ff).into()),
|
||||
warning_border: Some(rgba(0x727f0aff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
player: Some(PlayerColors(vec![
|
||||
PlayerColor {
|
||||
cursor: rgba(0x499befff).into(),
|
||||
background: rgba(0x499befff).into(),
|
||||
selection: rgba(0x499bef3d).into(),
|
||||
},
|
||||
PlayerColor {
|
||||
cursor: rgba(0xf59be6ff).into(),
|
||||
background: rgba(0xf59be6ff).into(),
|
||||
selection: rgba(0xf59be63d).into(),
|
||||
},
|
||||
PlayerColor {
|
||||
cursor: rgba(0xfaa11dff).into(),
|
||||
background: rgba(0xfaa11dff).into(),
|
||||
selection: rgba(0xfaa11d3d).into(),
|
||||
},
|
||||
PlayerColor {
|
||||
cursor: rgba(0xfe8080ff).into(),
|
||||
background: rgba(0xfe8080ff).into(),
|
||||
selection: rgba(0xfe80803d).into(),
|
||||
},
|
||||
PlayerColor {
|
||||
cursor: rgba(0x5beabcff).into(),
|
||||
background: rgba(0x5beabcff).into(),
|
||||
selection: rgba(0x5beabc3d).into(),
|
||||
},
|
||||
PlayerColor {
|
||||
cursor: rgba(0xe35142ff).into(),
|
||||
background: rgba(0xe35142ff).into(),
|
||||
selection: rgba(0xe351423d).into(),
|
||||
},
|
||||
PlayerColor {
|
||||
cursor: rgba(0xf1fe29ff).into(),
|
||||
background: rgba(0xf1fe29ff).into(),
|
||||
selection: rgba(0xf1fe293d).into(),
|
||||
},
|
||||
PlayerColor {
|
||||
cursor: rgba(0x5dea5aff).into(),
|
||||
background: rgba(0x5dea5aff).into(),
|
||||
selection: rgba(0x5dea5a3d).into(),
|
||||
},
|
||||
])),
|
||||
syntax: Some(UserSyntaxTheme {
|
||||
highlights: vec![
|
||||
(
|
||||
"attribute".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0x499befff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"boolean".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0x5dea5aff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"comment".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0x777259ff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"comment.doc".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0x777259ff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"constant".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0x5dea5aff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"constructor".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0x499befff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"embedded".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0xf8f5deff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"emphasis".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0x499befff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"emphasis.strong".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0x499befff).into()),
|
||||
font_weight: Some(UserFontWeight(700.0)),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"enum".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0xfaa11dff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"function".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0xf1fe29ff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"hint".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0x246e61ff).into()),
|
||||
font_weight: Some(UserFontWeight(700.0)),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"keyword".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0x499befff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"label".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0x499befff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"link_text".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0xfaa11dff).into()),
|
||||
font_style: Some(UserFontStyle::Italic),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"link_uri".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0x5dea5aff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"number".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0x5dea5aff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"operator".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0xfaa11dff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"predictive".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0x79434bff).into()),
|
||||
font_style: Some(UserFontStyle::Italic),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"preproc".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0xf8f5deff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"primary".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0xf8f5deff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"property".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0x499befff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"punctuation".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0xbfbb9bff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"punctuation.bracket".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0xbfbb9bff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"punctuation.delimiter".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0xbfbb9bff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"punctuation.list_marker".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0xbfbb9bff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"punctuation.special".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0xbfbb9bff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"string".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0xfaa11dff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"string.escape".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0x777259ff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"string.regex".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0xfaa11dff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"string.special".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0xfaa11dff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"string.special.symbol".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0xfaa11dff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"tag".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0x499befff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"text.literal".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0xfaa11dff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"title".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0xf8f5deff).into()),
|
||||
font_weight: Some(UserFontWeight(700.0)),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"type".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0x5beabcff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"variable".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0xf8f5deff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
(
|
||||
"variant".into(),
|
||||
UserHighlightStyle {
|
||||
color: Some(rgba(0x499befff).into()),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
],
|
||||
}),
|
||||
},
|
||||
}],
|
||||
}
|
||||
}
|
|
@ -1,244 +0,0 @@
|
|||
use std::borrow::Cow;
|
||||
|
||||
use gpui::{
|
||||
elements::{
|
||||
ConstrainedBox, Container, ContainerStyle, Dimensions, Empty, Flex, KeystrokeLabel, Label,
|
||||
MouseEventHandler, ParentElement, Stack, Svg, SvgStyle,
|
||||
},
|
||||
fonts::TextStyle,
|
||||
geometry::vector::Vector2F,
|
||||
platform,
|
||||
platform::MouseButton,
|
||||
scene::MouseClick,
|
||||
Action, Element, EventContext, MouseState, ViewContext,
|
||||
};
|
||||
use schemars::JsonSchema;
|
||||
use serde::Deserialize;
|
||||
|
||||
use crate::{ContainedText, Interactive};
|
||||
|
||||
#[derive(Clone, Deserialize, Default, JsonSchema)]
|
||||
pub struct CheckboxStyle {
|
||||
pub icon: SvgStyle,
|
||||
pub label: ContainedText,
|
||||
pub default: ContainerStyle,
|
||||
pub checked: ContainerStyle,
|
||||
pub hovered: ContainerStyle,
|
||||
pub hovered_and_checked: ContainerStyle,
|
||||
}
|
||||
|
||||
pub fn checkbox<Tag, V, F>(
|
||||
label: &'static str,
|
||||
style: &CheckboxStyle,
|
||||
checked: bool,
|
||||
id: usize,
|
||||
cx: &mut ViewContext<V>,
|
||||
change: F,
|
||||
) -> MouseEventHandler<V>
|
||||
where
|
||||
Tag: 'static,
|
||||
V: 'static,
|
||||
F: 'static + Fn(&mut V, bool, &mut EventContext<V>),
|
||||
{
|
||||
let label = Label::new(label, style.label.text.clone())
|
||||
.contained()
|
||||
.with_style(style.label.container);
|
||||
checkbox_with_label::<Tag, _, _, _>(label, style, checked, id, cx, change)
|
||||
}
|
||||
|
||||
pub fn checkbox_with_label<Tag, D, V, F>(
|
||||
label: D,
|
||||
style: &CheckboxStyle,
|
||||
checked: bool,
|
||||
id: usize,
|
||||
cx: &mut ViewContext<V>,
|
||||
change: F,
|
||||
) -> MouseEventHandler<V>
|
||||
where
|
||||
Tag: 'static,
|
||||
D: Element<V>,
|
||||
V: 'static,
|
||||
F: 'static + Fn(&mut V, bool, &mut EventContext<V>),
|
||||
{
|
||||
MouseEventHandler::new::<Tag, _>(id, cx, |state, _| {
|
||||
let indicator = if checked {
|
||||
svg(&style.icon)
|
||||
} else {
|
||||
Empty::new()
|
||||
.constrained()
|
||||
.with_width(style.icon.dimensions.width)
|
||||
.with_height(style.icon.dimensions.height)
|
||||
};
|
||||
|
||||
Flex::row()
|
||||
.with_child(indicator.contained().with_style(if checked {
|
||||
if state.hovered() {
|
||||
style.hovered_and_checked
|
||||
} else {
|
||||
style.checked
|
||||
}
|
||||
} else {
|
||||
if state.hovered() {
|
||||
style.hovered
|
||||
} else {
|
||||
style.default
|
||||
}
|
||||
}))
|
||||
.with_child(label)
|
||||
.align_children_center()
|
||||
})
|
||||
.on_click(platform::MouseButton::Left, move |_, view, cx| {
|
||||
change(view, !checked, cx)
|
||||
})
|
||||
.with_cursor_style(platform::CursorStyle::PointingHand)
|
||||
}
|
||||
|
||||
pub fn svg<V: 'static>(style: &SvgStyle) -> ConstrainedBox<V> {
|
||||
Svg::new(style.asset.clone())
|
||||
.with_color(style.color)
|
||||
.constrained()
|
||||
.with_width(style.dimensions.width)
|
||||
.with_height(style.dimensions.height)
|
||||
}
|
||||
|
||||
#[derive(Clone, Deserialize, Default, JsonSchema)]
|
||||
pub struct IconStyle {
|
||||
pub icon: SvgStyle,
|
||||
pub container: ContainerStyle,
|
||||
}
|
||||
|
||||
impl IconStyle {
|
||||
pub fn width(&self) -> f32 {
|
||||
self.icon.dimensions.width
|
||||
+ self.container.padding.left
|
||||
+ self.container.padding.right
|
||||
+ self.container.margin.left
|
||||
+ self.container.margin.right
|
||||
}
|
||||
}
|
||||
|
||||
pub fn icon<V: 'static>(style: &IconStyle) -> Container<V> {
|
||||
svg(&style.icon).contained().with_style(style.container)
|
||||
}
|
||||
|
||||
pub fn keystroke_label<V: 'static>(
|
||||
label_text: &'static str,
|
||||
label_style: &ContainedText,
|
||||
keystroke_style: &ContainedText,
|
||||
action: Box<dyn Action>,
|
||||
cx: &mut ViewContext<V>,
|
||||
) -> Container<V> {
|
||||
// FIXME: Put the theme in it's own global so we can
|
||||
// query the keystroke style on our own
|
||||
Flex::row()
|
||||
.with_child(Label::new(label_text, label_style.text.clone()).contained())
|
||||
.with_child(
|
||||
KeystrokeLabel::new(
|
||||
cx.view_id(),
|
||||
action,
|
||||
keystroke_style.container,
|
||||
keystroke_style.text.clone(),
|
||||
)
|
||||
.flex_float(),
|
||||
)
|
||||
.contained()
|
||||
.with_style(label_style.container)
|
||||
}
|
||||
|
||||
pub type CopilotCTAButton = Interactive<ContainedText>;
|
||||
|
||||
pub fn cta_button<Tag, L, V, F>(
|
||||
label: L,
|
||||
max_width: f32,
|
||||
style: &CopilotCTAButton,
|
||||
cx: &mut ViewContext<V>,
|
||||
f: F,
|
||||
) -> MouseEventHandler<V>
|
||||
where
|
||||
Tag: 'static,
|
||||
L: Into<Cow<'static, str>>,
|
||||
V: 'static,
|
||||
F: Fn(MouseClick, &mut V, &mut EventContext<V>) + 'static,
|
||||
{
|
||||
MouseEventHandler::new::<Tag, _>(0, cx, |state, _| {
|
||||
let style = style.style_for(state);
|
||||
Label::new(label, style.text.to_owned())
|
||||
.aligned()
|
||||
.contained()
|
||||
.with_style(style.container)
|
||||
.constrained()
|
||||
.with_max_width(max_width)
|
||||
})
|
||||
.on_click(MouseButton::Left, f)
|
||||
.with_cursor_style(platform::CursorStyle::PointingHand)
|
||||
}
|
||||
|
||||
#[derive(Clone, Deserialize, Default, JsonSchema)]
|
||||
pub struct ModalStyle {
|
||||
close_icon: Interactive<IconStyle>,
|
||||
container: ContainerStyle,
|
||||
titlebar: ContainerStyle,
|
||||
title_text: Interactive<TextStyle>,
|
||||
dimensions: Dimensions,
|
||||
}
|
||||
|
||||
impl ModalStyle {
|
||||
pub fn dimensions(&self) -> Vector2F {
|
||||
self.dimensions.to_vec()
|
||||
}
|
||||
}
|
||||
|
||||
pub fn modal<Tag, V, I, D, F>(
|
||||
title: I,
|
||||
style: &ModalStyle,
|
||||
cx: &mut ViewContext<V>,
|
||||
build_modal: F,
|
||||
) -> impl Element<V>
|
||||
where
|
||||
Tag: 'static,
|
||||
I: Into<Cow<'static, str>>,
|
||||
D: Element<V>,
|
||||
V: 'static,
|
||||
F: FnOnce(&mut gpui::ViewContext<V>) -> D,
|
||||
{
|
||||
const TITLEBAR_HEIGHT: f32 = 28.;
|
||||
|
||||
Flex::column()
|
||||
.with_child(
|
||||
Stack::new()
|
||||
.with_child(Label::new(
|
||||
title,
|
||||
style
|
||||
.title_text
|
||||
.style_for(&mut MouseState::default())
|
||||
.clone(),
|
||||
))
|
||||
.with_child(
|
||||
// FIXME: Get a better tag type
|
||||
MouseEventHandler::new::<Tag, _>(999999, cx, |state, _cx| {
|
||||
let style = style.close_icon.style_for(state);
|
||||
icon(style)
|
||||
})
|
||||
.on_click(platform::MouseButton::Left, move |_, _, cx| {
|
||||
cx.remove_window();
|
||||
})
|
||||
.with_cursor_style(platform::CursorStyle::PointingHand)
|
||||
.aligned()
|
||||
.right(),
|
||||
)
|
||||
.contained()
|
||||
.with_style(style.titlebar)
|
||||
.constrained()
|
||||
.with_height(TITLEBAR_HEIGHT),
|
||||
)
|
||||
.with_child(
|
||||
build_modal(cx)
|
||||
.contained()
|
||||
.with_style(style.container)
|
||||
.constrained()
|
||||
.with_width(style.dimensions().x())
|
||||
.with_height(style.dimensions().y() - TITLEBAR_HEIGHT),
|
||||
)
|
||||
.constrained()
|
||||
.with_height(style.dimensions().y())
|
||||
}
|
97
crates/theme/src/user_theme.rs
Normal file
97
crates/theme/src/user_theme.rs
Normal file
|
@ -0,0 +1,97 @@
|
|||
use crate::{
|
||||
Appearance, PlayerColors, StatusColors, StatusColorsRefinement, ThemeColors,
|
||||
ThemeColorsRefinement,
|
||||
};
|
||||
use gpui::{FontStyle, FontWeight, Hsla};
|
||||
use refineable::Refineable;
|
||||
use serde::Deserialize;
|
||||
|
||||
#[derive(Deserialize)]
|
||||
pub struct UserThemeFamily {
|
||||
pub name: String,
|
||||
pub author: String,
|
||||
pub themes: Vec<UserTheme>,
|
||||
}
|
||||
|
||||
#[derive(Deserialize)]
|
||||
pub struct UserTheme {
|
||||
pub name: String,
|
||||
pub appearance: Appearance,
|
||||
pub styles: UserThemeStylesRefinement,
|
||||
}
|
||||
|
||||
#[derive(Refineable, Clone)]
|
||||
#[refineable(Deserialize)]
|
||||
pub struct UserThemeStyles {
|
||||
#[refineable]
|
||||
pub colors: ThemeColors,
|
||||
#[refineable]
|
||||
pub status: StatusColors,
|
||||
pub player: PlayerColors,
|
||||
pub syntax: UserSyntaxTheme,
|
||||
}
|
||||
|
||||
#[derive(Clone, Default, Deserialize)]
|
||||
pub struct UserSyntaxTheme {
|
||||
pub highlights: Vec<(String, UserHighlightStyle)>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Default, Deserialize)]
|
||||
pub struct UserHighlightStyle {
|
||||
pub color: Option<Hsla>,
|
||||
pub font_style: Option<UserFontStyle>,
|
||||
pub font_weight: Option<UserFontWeight>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, Default, Deserialize)]
|
||||
pub struct UserFontWeight(pub f32);
|
||||
|
||||
impl UserFontWeight {
|
||||
/// Thin weight (100), the thinnest value.
|
||||
pub const THIN: Self = Self(FontWeight::THIN.0);
|
||||
/// Extra light weight (200).
|
||||
pub const EXTRA_LIGHT: Self = Self(FontWeight::EXTRA_LIGHT.0);
|
||||
/// Light weight (300).
|
||||
pub const LIGHT: Self = Self(FontWeight::LIGHT.0);
|
||||
/// Normal (400).
|
||||
pub const NORMAL: Self = Self(FontWeight::NORMAL.0);
|
||||
/// Medium weight (500, higher than normal).
|
||||
pub const MEDIUM: Self = Self(FontWeight::MEDIUM.0);
|
||||
/// Semibold weight (600).
|
||||
pub const SEMIBOLD: Self = Self(FontWeight::SEMIBOLD.0);
|
||||
/// Bold weight (700).
|
||||
pub const BOLD: Self = Self(FontWeight::BOLD.0);
|
||||
/// Extra-bold weight (800).
|
||||
pub const EXTRA_BOLD: Self = Self(FontWeight::EXTRA_BOLD.0);
|
||||
/// Black weight (900), the thickest value.
|
||||
pub const BLACK: Self = Self(FontWeight::BLACK.0);
|
||||
}
|
||||
|
||||
impl From<UserFontWeight> for FontWeight {
|
||||
fn from(value: UserFontWeight) -> Self {
|
||||
Self(value.0)
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, Deserialize)]
|
||||
pub enum UserFontStyle {
|
||||
Normal,
|
||||
Italic,
|
||||
Oblique,
|
||||
}
|
||||
|
||||
impl From<UserFontStyle> for FontStyle {
|
||||
fn from(value: UserFontStyle) -> Self {
|
||||
match value {
|
||||
UserFontStyle::Normal => FontStyle::Normal,
|
||||
UserFontStyle::Italic => FontStyle::Italic,
|
||||
UserFontStyle::Oblique => FontStyle::Oblique,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl UserHighlightStyle {
|
||||
pub fn is_empty(&self) -> bool {
|
||||
self.color.is_none() && self.font_style.is_none() && self.font_weight.is_none()
|
||||
}
|
||||
}
|
35
crates/theme/util/hex_to_hsla.py
Normal file
35
crates/theme/util/hex_to_hsla.py
Normal file
|
@ -0,0 +1,35 @@
|
|||
import colorsys
|
||||
import sys
|
||||
|
||||
def hex_to_rgb(hex):
|
||||
hex = hex.lstrip('#')
|
||||
if len(hex) == 8: # 8 digit hex color
|
||||
r, g, b, a = (int(hex[i:i+2], 16) for i in (0, 2, 4, 6))
|
||||
return r, g, b, a / 255.0
|
||||
else: # 6 digit hex color
|
||||
return tuple(int(hex[i:i+2], 16) for i in (0, 2, 4)) + (1.0,)
|
||||
|
||||
def rgb_to_hsla(rgb):
|
||||
h, l, s = colorsys.rgb_to_hls(rgb[0]/255.0, rgb[1]/255.0, rgb[2]/255.0)
|
||||
a = rgb[3] # alpha value
|
||||
return (round(h * 360, 1), round(s * 100, 1), round(l * 100, 1), round(a, 3))
|
||||
|
||||
def hex_to_hsla(hex):
|
||||
return rgb_to_hsla(hex_to_rgb(hex))
|
||||
|
||||
if len(sys.argv) != 2:
|
||||
print("Usage: python util/hex_to_hsla.py <6 or 8 digit hex color or comma-separated list of colors>")
|
||||
else:
|
||||
input_arg = sys.argv[1]
|
||||
if ',' in input_arg: # comma-separated list of colors
|
||||
hex_colors = input_arg.split(',')
|
||||
hslas = [] # output array
|
||||
for hex_color in hex_colors:
|
||||
hex_color = hex_color.strip("'\" ")
|
||||
h, s, l, a = hex_to_hsla(hex_color)
|
||||
hslas.append(f"hsla({h} / 360., {s} / 100., {l} / 100., {a})")
|
||||
print(hslas)
|
||||
else: # single color
|
||||
hex_color = input_arg.strip("'\"")
|
||||
h, s, l, a = hex_to_hsla(hex_color)
|
||||
print(f"hsla({h} / 360., {s} / 100., {l} / 100., {a})")
|
Loading…
Add table
Add a link
Reference in a new issue