Add a with_style method to Editor
This commit is contained in:
+17
-4
@@ -22,7 +22,7 @@ pub struct Theme {
|
||||
pub workspace: Workspace,
|
||||
pub chat_panel: ChatPanel,
|
||||
pub selector: Selector,
|
||||
pub editor: Editor,
|
||||
pub editor: EditorStyle,
|
||||
pub syntax: SyntaxTheme,
|
||||
}
|
||||
|
||||
@@ -127,8 +127,8 @@ pub struct ContainedLabel {
|
||||
pub label: LabelStyle,
|
||||
}
|
||||
|
||||
#[derive(Deserialize)]
|
||||
pub struct Editor {
|
||||
#[derive(Clone, Deserialize)]
|
||||
pub struct EditorStyle {
|
||||
pub background: Color,
|
||||
pub gutter_background: Color,
|
||||
pub active_line_background: Color,
|
||||
@@ -137,7 +137,7 @@ pub struct Editor {
|
||||
pub replicas: Vec<Replica>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, Deserialize)]
|
||||
#[derive(Clone, Copy, Default, Deserialize)]
|
||||
pub struct Replica {
|
||||
pub cursor: Color,
|
||||
pub selection: Color,
|
||||
@@ -164,6 +164,19 @@ impl SyntaxTheme {
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for EditorStyle {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
background: Default::default(),
|
||||
gutter_background: Default::default(),
|
||||
active_line_background: Default::default(),
|
||||
line_number: Default::default(),
|
||||
line_number_active: Default::default(),
|
||||
replicas: vec![Default::default()],
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<'de> Deserialize<'de> for SyntaxTheme {
|
||||
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
|
||||
where
|
||||
|
||||
Reference in New Issue
Block a user