Remove ThemeColor
in favor of theme2::Theme
This commit is contained in:
parent
bb3f59252e
commit
e1032c5341
42 changed files with 225 additions and 391 deletions
|
@ -3,12 +3,13 @@ use std::str::FromStr;
|
|||
|
||||
use gpui2::WindowContext;
|
||||
use rand::Rng;
|
||||
use theme2::Theme;
|
||||
|
||||
use crate::{
|
||||
Buffer, BufferRow, BufferRows, Button, EditorPane, FileSystemStatus, GitStatus,
|
||||
theme, Buffer, BufferRow, BufferRows, Button, EditorPane, FileSystemStatus, GitStatus,
|
||||
HighlightedLine, Icon, Keybinding, Label, LabelColor, ListEntry, ListEntrySize, ListItem,
|
||||
Livestream, MicStatus, ModifierKeys, PaletteItem, Player, PlayerCallStatus,
|
||||
PlayerWithCallStatus, ScreenShareStatus, Symbol, Tab, ThemeColor, ToggleState, VideoStatus,
|
||||
PlayerWithCallStatus, ScreenShareStatus, Symbol, Tab, ToggleState, VideoStatus,
|
||||
};
|
||||
use crate::{HighlightedText, ListDetailsEntry};
|
||||
|
||||
|
@ -642,7 +643,7 @@ pub fn empty_buffer_example<S: 'static + Send + Sync + Clone>() -> Buffer<S> {
|
|||
}
|
||||
|
||||
pub fn hello_world_rust_editor_example(cx: &mut WindowContext) -> EditorPane {
|
||||
let color = ThemeColor::new(cx);
|
||||
let theme = theme(cx);
|
||||
|
||||
EditorPane::new(
|
||||
cx,
|
||||
|
@ -651,19 +652,19 @@ pub fn hello_world_rust_editor_example(cx: &mut WindowContext) -> EditorPane {
|
|||
vec![Symbol(vec![
|
||||
HighlightedText {
|
||||
text: "fn ".to_string(),
|
||||
color: color.syntax.keyword,
|
||||
color: theme.syntax.keyword,
|
||||
},
|
||||
HighlightedText {
|
||||
text: "main".to_string(),
|
||||
color: color.syntax.function,
|
||||
color: theme.syntax.function,
|
||||
},
|
||||
])],
|
||||
hello_world_rust_buffer_example(&color),
|
||||
hello_world_rust_buffer_example(&theme),
|
||||
)
|
||||
}
|
||||
|
||||
pub fn hello_world_rust_buffer_example<S: 'static + Send + Sync + Clone>(
|
||||
color: &ThemeColor,
|
||||
theme: &Theme,
|
||||
) -> Buffer<S> {
|
||||
Buffer::new("hello-world-rust-buffer")
|
||||
.set_title("hello_world.rs".to_string())
|
||||
|
@ -671,11 +672,11 @@ pub fn hello_world_rust_buffer_example<S: 'static + Send + Sync + Clone>(
|
|||
.set_language("rust".to_string())
|
||||
.set_rows(Some(BufferRows {
|
||||
show_line_numbers: true,
|
||||
rows: hello_world_rust_buffer_rows(color),
|
||||
rows: hello_world_rust_buffer_rows(theme),
|
||||
}))
|
||||
}
|
||||
|
||||
pub fn hello_world_rust_buffer_rows(color: &ThemeColor) -> Vec<BufferRow> {
|
||||
pub fn hello_world_rust_buffer_rows(theme: &Theme) -> Vec<BufferRow> {
|
||||
let show_line_number = true;
|
||||
|
||||
vec![
|
||||
|
@ -687,15 +688,15 @@ pub fn hello_world_rust_buffer_rows(color: &ThemeColor) -> Vec<BufferRow> {
|
|||
highlighted_texts: vec![
|
||||
HighlightedText {
|
||||
text: "fn ".to_string(),
|
||||
color: color.syntax.keyword,
|
||||
color: theme.syntax.keyword,
|
||||
},
|
||||
HighlightedText {
|
||||
text: "main".to_string(),
|
||||
color: color.syntax.function,
|
||||
color: theme.syntax.function,
|
||||
},
|
||||
HighlightedText {
|
||||
text: "() {".to_string(),
|
||||
color: color.text,
|
||||
color: theme.text,
|
||||
},
|
||||
],
|
||||
}),
|
||||
|
@ -711,7 +712,7 @@ pub fn hello_world_rust_buffer_rows(color: &ThemeColor) -> Vec<BufferRow> {
|
|||
highlighted_texts: vec![HighlightedText {
|
||||
text: " // Statements here are executed when the compiled binary is called."
|
||||
.to_string(),
|
||||
color: color.syntax.comment,
|
||||
color: theme.syntax.comment,
|
||||
}],
|
||||
}),
|
||||
cursors: None,
|
||||
|
@ -734,7 +735,7 @@ pub fn hello_world_rust_buffer_rows(color: &ThemeColor) -> Vec<BufferRow> {
|
|||
line: Some(HighlightedLine {
|
||||
highlighted_texts: vec![HighlightedText {
|
||||
text: " // Print text to the console.".to_string(),
|
||||
color: color.syntax.comment,
|
||||
color: theme.syntax.comment,
|
||||
}],
|
||||
}),
|
||||
cursors: None,
|
||||
|
@ -749,15 +750,15 @@ pub fn hello_world_rust_buffer_rows(color: &ThemeColor) -> Vec<BufferRow> {
|
|||
highlighted_texts: vec![
|
||||
HighlightedText {
|
||||
text: " println!(".to_string(),
|
||||
color: color.text,
|
||||
color: theme.text,
|
||||
},
|
||||
HighlightedText {
|
||||
text: "\"Hello, world!\"".to_string(),
|
||||
color: color.syntax.string,
|
||||
color: theme.syntax.string,
|
||||
},
|
||||
HighlightedText {
|
||||
text: ");".to_string(),
|
||||
color: color.text,
|
||||
color: theme.text,
|
||||
},
|
||||
],
|
||||
}),
|
||||
|
@ -772,7 +773,7 @@ pub fn hello_world_rust_buffer_rows(color: &ThemeColor) -> Vec<BufferRow> {
|
|||
line: Some(HighlightedLine {
|
||||
highlighted_texts: vec![HighlightedText {
|
||||
text: "}".to_string(),
|
||||
color: color.text,
|
||||
color: theme.text,
|
||||
}],
|
||||
}),
|
||||
cursors: None,
|
||||
|
@ -783,7 +784,7 @@ pub fn hello_world_rust_buffer_rows(color: &ThemeColor) -> Vec<BufferRow> {
|
|||
}
|
||||
|
||||
pub fn hello_world_rust_editor_with_status_example(cx: &mut WindowContext) -> EditorPane {
|
||||
let color = ThemeColor::new(cx);
|
||||
let theme = theme(cx);
|
||||
|
||||
EditorPane::new(
|
||||
cx,
|
||||
|
@ -792,19 +793,19 @@ pub fn hello_world_rust_editor_with_status_example(cx: &mut WindowContext) -> Ed
|
|||
vec![Symbol(vec![
|
||||
HighlightedText {
|
||||
text: "fn ".to_string(),
|
||||
color: color.syntax.keyword,
|
||||
color: theme.syntax.keyword,
|
||||
},
|
||||
HighlightedText {
|
||||
text: "main".to_string(),
|
||||
color: color.syntax.function,
|
||||
color: theme.syntax.function,
|
||||
},
|
||||
])],
|
||||
hello_world_rust_buffer_with_status_example(&color),
|
||||
hello_world_rust_buffer_with_status_example(&theme),
|
||||
)
|
||||
}
|
||||
|
||||
pub fn hello_world_rust_buffer_with_status_example<S: 'static + Send + Sync + Clone>(
|
||||
color: &ThemeColor,
|
||||
theme: &Theme,
|
||||
) -> Buffer<S> {
|
||||
Buffer::new("hello-world-rust-buffer-with-status")
|
||||
.set_title("hello_world.rs".to_string())
|
||||
|
@ -812,11 +813,11 @@ pub fn hello_world_rust_buffer_with_status_example<S: 'static + Send + Sync + Cl
|
|||
.set_language("rust".to_string())
|
||||
.set_rows(Some(BufferRows {
|
||||
show_line_numbers: true,
|
||||
rows: hello_world_rust_with_status_buffer_rows(color),
|
||||
rows: hello_world_rust_with_status_buffer_rows(theme),
|
||||
}))
|
||||
}
|
||||
|
||||
pub fn hello_world_rust_with_status_buffer_rows(color: &ThemeColor) -> Vec<BufferRow> {
|
||||
pub fn hello_world_rust_with_status_buffer_rows(theme: &Theme) -> Vec<BufferRow> {
|
||||
let show_line_number = true;
|
||||
|
||||
vec![
|
||||
|
@ -828,15 +829,15 @@ pub fn hello_world_rust_with_status_buffer_rows(color: &ThemeColor) -> Vec<Buffe
|
|||
highlighted_texts: vec![
|
||||
HighlightedText {
|
||||
text: "fn ".to_string(),
|
||||
color: color.syntax.keyword,
|
||||
color: theme.syntax.keyword,
|
||||
},
|
||||
HighlightedText {
|
||||
text: "main".to_string(),
|
||||
color: color.syntax.function,
|
||||
color: theme.syntax.function,
|
||||
},
|
||||
HighlightedText {
|
||||
text: "() {".to_string(),
|
||||
color: color.text,
|
||||
color: theme.text,
|
||||
},
|
||||
],
|
||||
}),
|
||||
|
@ -852,7 +853,7 @@ pub fn hello_world_rust_with_status_buffer_rows(color: &ThemeColor) -> Vec<Buffe
|
|||
highlighted_texts: vec![HighlightedText {
|
||||
text: "// Statements here are executed when the compiled binary is called."
|
||||
.to_string(),
|
||||
color: color.syntax.comment,
|
||||
color: theme.syntax.comment,
|
||||
}],
|
||||
}),
|
||||
cursors: None,
|
||||
|
@ -875,7 +876,7 @@ pub fn hello_world_rust_with_status_buffer_rows(color: &ThemeColor) -> Vec<Buffe
|
|||
line: Some(HighlightedLine {
|
||||
highlighted_texts: vec![HighlightedText {
|
||||
text: " // Print text to the console.".to_string(),
|
||||
color: color.syntax.comment,
|
||||
color: theme.syntax.comment,
|
||||
}],
|
||||
}),
|
||||
cursors: None,
|
||||
|
@ -890,15 +891,15 @@ pub fn hello_world_rust_with_status_buffer_rows(color: &ThemeColor) -> Vec<Buffe
|
|||
highlighted_texts: vec![
|
||||
HighlightedText {
|
||||
text: " println!(".to_string(),
|
||||
color: color.text,
|
||||
color: theme.text,
|
||||
},
|
||||
HighlightedText {
|
||||
text: "\"Hello, world!\"".to_string(),
|
||||
color: color.syntax.string,
|
||||
color: theme.syntax.string,
|
||||
},
|
||||
HighlightedText {
|
||||
text: ");".to_string(),
|
||||
color: color.text,
|
||||
color: theme.text,
|
||||
},
|
||||
],
|
||||
}),
|
||||
|
@ -913,7 +914,7 @@ pub fn hello_world_rust_with_status_buffer_rows(color: &ThemeColor) -> Vec<Buffe
|
|||
line: Some(HighlightedLine {
|
||||
highlighted_texts: vec![HighlightedText {
|
||||
text: "}".to_string(),
|
||||
color: color.text,
|
||||
color: theme.text,
|
||||
}],
|
||||
}),
|
||||
cursors: None,
|
||||
|
@ -927,7 +928,7 @@ pub fn hello_world_rust_with_status_buffer_rows(color: &ThemeColor) -> Vec<Buffe
|
|||
line: Some(HighlightedLine {
|
||||
highlighted_texts: vec![HighlightedText {
|
||||
text: "".to_string(),
|
||||
color: color.text,
|
||||
color: theme.text,
|
||||
}],
|
||||
}),
|
||||
cursors: None,
|
||||
|
@ -941,7 +942,7 @@ pub fn hello_world_rust_with_status_buffer_rows(color: &ThemeColor) -> Vec<Buffe
|
|||
line: Some(HighlightedLine {
|
||||
highlighted_texts: vec![HighlightedText {
|
||||
text: "// Marshall and Nate were here".to_string(),
|
||||
color: color.syntax.comment,
|
||||
color: theme.syntax.comment,
|
||||
}],
|
||||
}),
|
||||
cursors: None,
|
||||
|
@ -951,16 +952,16 @@ pub fn hello_world_rust_with_status_buffer_rows(color: &ThemeColor) -> Vec<Buffe
|
|||
]
|
||||
}
|
||||
|
||||
pub fn terminal_buffer<S: 'static + Send + Sync + Clone>(color: &ThemeColor) -> Buffer<S> {
|
||||
pub fn terminal_buffer<S: 'static + Send + Sync + Clone>(theme: &Theme) -> Buffer<S> {
|
||||
Buffer::new("terminal")
|
||||
.set_title("zed — fish".to_string())
|
||||
.set_rows(Some(BufferRows {
|
||||
show_line_numbers: false,
|
||||
rows: terminal_buffer_rows(color),
|
||||
rows: terminal_buffer_rows(theme),
|
||||
}))
|
||||
}
|
||||
|
||||
pub fn terminal_buffer_rows(color: &ThemeColor) -> Vec<BufferRow> {
|
||||
pub fn terminal_buffer_rows(theme: &Theme) -> Vec<BufferRow> {
|
||||
let show_line_number = false;
|
||||
|
||||
vec![
|
||||
|
@ -972,31 +973,31 @@ pub fn terminal_buffer_rows(color: &ThemeColor) -> Vec<BufferRow> {
|
|||
highlighted_texts: vec![
|
||||
HighlightedText {
|
||||
text: "maxdeviant ".to_string(),
|
||||
color: color.syntax.keyword,
|
||||
color: theme.syntax.keyword,
|
||||
},
|
||||
HighlightedText {
|
||||
text: "in ".to_string(),
|
||||
color: color.text,
|
||||
color: theme.text,
|
||||
},
|
||||
HighlightedText {
|
||||
text: "profaned-capital ".to_string(),
|
||||
color: color.syntax.function,
|
||||
color: theme.syntax.function,
|
||||
},
|
||||
HighlightedText {
|
||||
text: "in ".to_string(),
|
||||
color: color.text,
|
||||
color: theme.text,
|
||||
},
|
||||
HighlightedText {
|
||||
text: "~/p/zed ".to_string(),
|
||||
color: color.syntax.function,
|
||||
color: theme.syntax.function,
|
||||
},
|
||||
HighlightedText {
|
||||
text: "on ".to_string(),
|
||||
color: color.text,
|
||||
color: theme.text,
|
||||
},
|
||||
HighlightedText {
|
||||
text: " gpui2-ui ".to_string(),
|
||||
color: color.syntax.keyword,
|
||||
color: theme.syntax.keyword,
|
||||
},
|
||||
],
|
||||
}),
|
||||
|
@ -1011,7 +1012,7 @@ pub fn terminal_buffer_rows(color: &ThemeColor) -> Vec<BufferRow> {
|
|||
line: Some(HighlightedLine {
|
||||
highlighted_texts: vec![HighlightedText {
|
||||
text: "λ ".to_string(),
|
||||
color: color.syntax.string,
|
||||
color: theme.syntax.string,
|
||||
}],
|
||||
}),
|
||||
cursors: None,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue