Paint editor background
This commit is contained in:
parent
86d1defda2
commit
769526a76a
6 changed files with 948 additions and 809 deletions
|
@ -36,7 +36,7 @@ pub use element::{
|
||||||
use futures::FutureExt;
|
use futures::FutureExt;
|
||||||
use fuzzy::{StringMatch, StringMatchCandidate};
|
use fuzzy::{StringMatch, StringMatchCandidate};
|
||||||
use gpui::{
|
use gpui::{
|
||||||
div, AnyElement, AppContext, BackgroundExecutor, Context, Div, Element, EventEmitter,
|
div, px, AnyElement, AppContext, BackgroundExecutor, Context, Div, Element, EventEmitter,
|
||||||
FocusHandle, Hsla, Model, Pixels, Render, Styled, Subscription, Task, TextStyle, View,
|
FocusHandle, Hsla, Model, Pixels, Render, Styled, Subscription, Task, TextStyle, View,
|
||||||
ViewContext, VisualContext, WeakView, WindowContext,
|
ViewContext, VisualContext, WeakView, WindowContext,
|
||||||
};
|
};
|
||||||
|
@ -597,12 +597,11 @@ pub enum SoftWrap {
|
||||||
|
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
pub struct EditorStyle {
|
pub struct EditorStyle {
|
||||||
|
pub background: Hsla,
|
||||||
pub local_player: PlayerColor,
|
pub local_player: PlayerColor,
|
||||||
pub text: TextStyle,
|
pub text: TextStyle,
|
||||||
pub line_height_scalar: f32,
|
pub line_height_scalar: f32,
|
||||||
// pub placeholder_text: Option<TextStyle>,
|
pub scrollbar_width: Pixels,
|
||||||
// pub theme: theme::Editor,
|
|
||||||
pub theme_id: usize,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type CompletionId = usize;
|
type CompletionId = usize;
|
||||||
|
@ -9327,10 +9326,11 @@ impl Render for Editor {
|
||||||
|
|
||||||
fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Element {
|
fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Element {
|
||||||
EditorElement::new(EditorStyle {
|
EditorElement::new(EditorStyle {
|
||||||
|
background: cx.theme().colors().editor,
|
||||||
local_player: cx.theme().players().local(),
|
local_player: cx.theme().players().local(),
|
||||||
text: cx.text_style(),
|
text: cx.text_style(),
|
||||||
line_height_scalar: 1.,
|
line_height_scalar: 1.,
|
||||||
theme_id: 0,
|
scrollbar_width: px(12.),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -176,6 +176,15 @@ pub fn black() -> Hsla {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn transparent_black() -> Hsla {
|
||||||
|
Hsla {
|
||||||
|
h: 0.,
|
||||||
|
s: 0.,
|
||||||
|
l: 0.,
|
||||||
|
a: 0.,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub fn white() -> Hsla {
|
pub fn white() -> Hsla {
|
||||||
Hsla {
|
Hsla {
|
||||||
h: 0.,
|
h: 0.,
|
||||||
|
|
|
@ -492,6 +492,15 @@ where
|
||||||
impl<T: Clone + Default + Debug + Copy> Copy for Edges<T> {}
|
impl<T: Clone + Default + Debug + Copy> Copy for Edges<T> {}
|
||||||
|
|
||||||
impl<T: Clone + Default + Debug> Edges<T> {
|
impl<T: Clone + Default + Debug> Edges<T> {
|
||||||
|
pub fn all(value: T) -> Self {
|
||||||
|
Self {
|
||||||
|
top: value.clone(),
|
||||||
|
right: value.clone(),
|
||||||
|
bottom: value.clone(),
|
||||||
|
left: value,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub fn map<U>(&self, f: impl Fn(&T) -> U) -> Edges<U>
|
pub fn map<U>(&self, f: impl Fn(&T) -> U) -> Edges<U>
|
||||||
where
|
where
|
||||||
U: Clone + Default + Debug,
|
U: Clone + Default + Debug,
|
||||||
|
|
|
@ -103,10 +103,15 @@ pub struct ThemeColors {
|
||||||
pub tab_inactive: Hsla,
|
pub tab_inactive: Hsla,
|
||||||
pub tab_active: Hsla,
|
pub tab_active: Hsla,
|
||||||
pub editor: Hsla,
|
pub editor: Hsla,
|
||||||
|
pub editor_gutter: Hsla,
|
||||||
pub editor_subheader: Hsla,
|
pub editor_subheader: Hsla,
|
||||||
pub editor_active_line: Hsla,
|
pub editor_active_line: Hsla,
|
||||||
|
pub editor_highlighted_line: Hsla,
|
||||||
pub editor_line_number: Hsla,
|
pub editor_line_number: Hsla,
|
||||||
pub editor_active_line_number: Hsla,
|
pub editor_active_line_number: Hsla,
|
||||||
|
pub editor_invisible: Hsla,
|
||||||
|
pub editor_wrap_guide: Hsla,
|
||||||
|
pub editor_active_wrap_guide: Hsla,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Refineable, Clone)]
|
#[derive(Refineable, Clone)]
|
||||||
|
|
|
@ -238,10 +238,15 @@ impl ThemeColors {
|
||||||
tab_active: neutral().light().step_1(),
|
tab_active: neutral().light().step_1(),
|
||||||
tab_inactive: neutral().light().step_2(),
|
tab_inactive: neutral().light().step_2(),
|
||||||
editor: neutral().light().step_1(),
|
editor: neutral().light().step_1(),
|
||||||
|
editor_gutter: neutral().light().step_1(), // todo!("pick the right colors")
|
||||||
editor_subheader: neutral().light().step_2(),
|
editor_subheader: neutral().light().step_2(),
|
||||||
editor_active_line: neutral().light_alpha().step_3(),
|
editor_active_line: neutral().light_alpha().step_3(),
|
||||||
editor_line_number: neutral().light_alpha().step_3(), // todo!("pick the right colors")
|
editor_line_number: neutral().light_alpha().step_3(), // todo!("pick the right colors")
|
||||||
editor_active_line_number: neutral().light_alpha().step_3(), // todo!("pick the right colors")
|
editor_active_line_number: neutral().light_alpha().step_3(), // todo!("pick the right colors")
|
||||||
|
editor_highlighted_line: neutral().light_alpha().step_4(), // todo!("pick the right colors")
|
||||||
|
editor_invisible: neutral().light_alpha().step_4(), // todo!("pick the right colors")
|
||||||
|
editor_wrap_guide: neutral().light_alpha().step_4(), // todo!("pick the right colors")
|
||||||
|
editor_active_wrap_guide: neutral().light_alpha().step_4(), // todo!("pick the right colors")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -285,10 +290,15 @@ impl ThemeColors {
|
||||||
tab_active: neutral().dark().step_1(),
|
tab_active: neutral().dark().step_1(),
|
||||||
tab_inactive: neutral().dark().step_2(),
|
tab_inactive: neutral().dark().step_2(),
|
||||||
editor: neutral().dark().step_1(),
|
editor: neutral().dark().step_1(),
|
||||||
|
editor_gutter: neutral().dark().step_1(), // todo!("pick the right colors")
|
||||||
editor_subheader: neutral().dark().step_2(),
|
editor_subheader: neutral().dark().step_2(),
|
||||||
editor_active_line: neutral().dark_alpha().step_3(),
|
editor_active_line: neutral().dark_alpha().step_3(),
|
||||||
editor_line_number: neutral().dark_alpha().step_3(), // todo!("pick the right colors")
|
editor_line_number: neutral().dark_alpha().step_3(), // todo!("pick the right colors")
|
||||||
editor_active_line_number: neutral().dark_alpha().step_3(), // todo!("pick the right colors")
|
editor_active_line_number: neutral().dark_alpha().step_3(), // todo!("pick the right colors")
|
||||||
|
editor_highlighted_line: neutral().dark_alpha().step_4(), // todo!("pick the right colors")
|
||||||
|
editor_invisible: neutral().dark_alpha().step_4(), // todo!("pick the right colors")
|
||||||
|
editor_wrap_guide: neutral().dark_alpha().step_4(), // todo!("pick the right colors")
|
||||||
|
editor_active_wrap_guide: neutral().dark_alpha().step_4(), // todo!("pick the right colors")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue