Merge remote-tracking branch 'origin/main' into gpui2-no-send
This commit is contained in:
Generated
+108
-18
@@ -1169,7 +1169,7 @@ dependencies = [
|
||||
"futures 0.3.28",
|
||||
"gpui2",
|
||||
"language2",
|
||||
"live_kit_client",
|
||||
"live_kit_client2",
|
||||
"log",
|
||||
"media",
|
||||
"postage",
|
||||
@@ -4589,6 +4589,39 @@ dependencies = [
|
||||
"simplelog",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "live_kit_client2"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"async-broadcast",
|
||||
"async-trait",
|
||||
"block",
|
||||
"byteorder",
|
||||
"bytes 1.5.0",
|
||||
"cocoa",
|
||||
"collections",
|
||||
"core-foundation",
|
||||
"core-graphics",
|
||||
"foreign-types",
|
||||
"futures 0.3.28",
|
||||
"gpui2",
|
||||
"hmac 0.12.1",
|
||||
"jwt",
|
||||
"live_kit_server",
|
||||
"log",
|
||||
"media",
|
||||
"nanoid",
|
||||
"objc",
|
||||
"parking_lot 0.11.2",
|
||||
"postage",
|
||||
"serde",
|
||||
"serde_derive",
|
||||
"serde_json",
|
||||
"sha2 0.10.7",
|
||||
"simplelog",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "live_kit_server"
|
||||
version = "0.1.0"
|
||||
@@ -5035,6 +5068,53 @@ dependencies = [
|
||||
"workspace",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "multi_buffer2"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"aho-corasick",
|
||||
"anyhow",
|
||||
"client2",
|
||||
"clock",
|
||||
"collections",
|
||||
"convert_case 0.6.0",
|
||||
"copilot2",
|
||||
"ctor",
|
||||
"env_logger 0.9.3",
|
||||
"futures 0.3.28",
|
||||
"git",
|
||||
"gpui2",
|
||||
"indoc",
|
||||
"itertools 0.10.5",
|
||||
"language2",
|
||||
"lazy_static",
|
||||
"log",
|
||||
"lsp2",
|
||||
"ordered-float 2.10.0",
|
||||
"parking_lot 0.11.2",
|
||||
"postage",
|
||||
"project2",
|
||||
"pulldown-cmark",
|
||||
"rand 0.8.5",
|
||||
"rich_text",
|
||||
"schemars",
|
||||
"serde",
|
||||
"serde_derive",
|
||||
"settings2",
|
||||
"smallvec",
|
||||
"smol",
|
||||
"snippet",
|
||||
"sum_tree",
|
||||
"text",
|
||||
"theme2",
|
||||
"tree-sitter",
|
||||
"tree-sitter-html",
|
||||
"tree-sitter-rust",
|
||||
"tree-sitter-typescript",
|
||||
"unindent",
|
||||
"util",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "multimap"
|
||||
version = "0.8.3"
|
||||
@@ -8726,6 +8806,29 @@ dependencies = [
|
||||
"util",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "text2"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"clock",
|
||||
"collections",
|
||||
"ctor",
|
||||
"digest 0.9.0",
|
||||
"env_logger 0.9.3",
|
||||
"gpui2",
|
||||
"lazy_static",
|
||||
"log",
|
||||
"parking_lot 0.11.2",
|
||||
"postage",
|
||||
"rand 0.8.5",
|
||||
"regex",
|
||||
"rope",
|
||||
"smallvec",
|
||||
"sum_tree",
|
||||
"util",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "textwrap"
|
||||
version = "0.16.0"
|
||||
@@ -8759,6 +8862,7 @@ dependencies = [
|
||||
"gpui2",
|
||||
"indexmap 1.9.3",
|
||||
"parking_lot 0.11.2",
|
||||
"refineable",
|
||||
"schemars",
|
||||
"serde",
|
||||
"serde_derive",
|
||||
@@ -8768,21 +8872,6 @@ dependencies = [
|
||||
"util",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "theme_converter"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"clap 4.4.4",
|
||||
"convert_case 0.6.0",
|
||||
"gpui2",
|
||||
"log",
|
||||
"rust-embed",
|
||||
"serde",
|
||||
"simplelog",
|
||||
"theme2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "theme_selector"
|
||||
version = "0.1.0"
|
||||
@@ -9600,6 +9689,7 @@ dependencies = [
|
||||
"itertools 0.11.0",
|
||||
"rand 0.8.5",
|
||||
"serde",
|
||||
"settings2",
|
||||
"smallvec",
|
||||
"strum",
|
||||
"theme2",
|
||||
@@ -10788,7 +10878,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "zed"
|
||||
version = "0.111.0"
|
||||
version = "0.112.0"
|
||||
dependencies = [
|
||||
"activity_indicator",
|
||||
"ai",
|
||||
@@ -10985,7 +11075,7 @@ dependencies = [
|
||||
"smol",
|
||||
"sum_tree",
|
||||
"tempdir",
|
||||
"text",
|
||||
"text2",
|
||||
"theme2",
|
||||
"thiserror",
|
||||
"tiny_http",
|
||||
|
||||
+1
-1
@@ -61,6 +61,7 @@ members = [
|
||||
"crates/menu",
|
||||
"crates/menu2",
|
||||
"crates/multi_buffer",
|
||||
"crates/multi_buffer2",
|
||||
"crates/node_runtime",
|
||||
"crates/notifications",
|
||||
"crates/outline",
|
||||
@@ -92,7 +93,6 @@ members = [
|
||||
"crates/text",
|
||||
"crates/theme",
|
||||
"crates/theme2",
|
||||
"crates/theme_converter",
|
||||
"crates/theme_selector",
|
||||
"crates/ui2",
|
||||
"crates/util",
|
||||
|
||||
@@ -118,7 +118,7 @@ impl Codegen {
|
||||
|
||||
let (mut hunks_tx, mut hunks_rx) = mpsc::channel(1);
|
||||
let diff = cx.background().spawn(async move {
|
||||
let chunks = strip_markdown_codeblock(response.await?);
|
||||
let chunks = strip_invalid_spans_from_codeblock(response.await?);
|
||||
futures::pin_mut!(chunks);
|
||||
let mut diff = StreamingDiff::new(selected_text.to_string());
|
||||
|
||||
@@ -279,12 +279,13 @@ impl Codegen {
|
||||
}
|
||||
}
|
||||
|
||||
fn strip_markdown_codeblock(
|
||||
fn strip_invalid_spans_from_codeblock(
|
||||
stream: impl Stream<Item = Result<String>>,
|
||||
) -> impl Stream<Item = Result<String>> {
|
||||
let mut first_line = true;
|
||||
let mut buffer = String::new();
|
||||
let mut starts_with_fenced_code_block = false;
|
||||
let mut starts_with_markdown_codeblock = false;
|
||||
let mut includes_start_or_end_span = false;
|
||||
stream.filter_map(move |chunk| {
|
||||
let chunk = match chunk {
|
||||
Ok(chunk) => chunk,
|
||||
@@ -292,11 +293,31 @@ fn strip_markdown_codeblock(
|
||||
};
|
||||
buffer.push_str(&chunk);
|
||||
|
||||
if buffer.len() > "<|S|".len() && buffer.starts_with("<|S|") {
|
||||
includes_start_or_end_span = true;
|
||||
|
||||
buffer = buffer
|
||||
.strip_prefix("<|S|>")
|
||||
.or_else(|| buffer.strip_prefix("<|S|"))
|
||||
.unwrap_or(&buffer)
|
||||
.to_string();
|
||||
} else if buffer.ends_with("|E|>") {
|
||||
includes_start_or_end_span = true;
|
||||
} else if buffer.starts_with("<|")
|
||||
|| buffer.starts_with("<|S")
|
||||
|| buffer.starts_with("<|S|")
|
||||
|| buffer.ends_with("|")
|
||||
|| buffer.ends_with("|E")
|
||||
|| buffer.ends_with("|E|")
|
||||
{
|
||||
return future::ready(None);
|
||||
}
|
||||
|
||||
if first_line {
|
||||
if buffer == "" || buffer == "`" || buffer == "``" {
|
||||
return future::ready(None);
|
||||
} else if buffer.starts_with("```") {
|
||||
starts_with_fenced_code_block = true;
|
||||
starts_with_markdown_codeblock = true;
|
||||
if let Some(newline_ix) = buffer.find('\n') {
|
||||
buffer.replace_range(..newline_ix + 1, "");
|
||||
first_line = false;
|
||||
@@ -306,16 +327,26 @@ fn strip_markdown_codeblock(
|
||||
}
|
||||
}
|
||||
|
||||
let text = if starts_with_fenced_code_block {
|
||||
buffer
|
||||
let mut text = buffer.to_string();
|
||||
if starts_with_markdown_codeblock {
|
||||
text = text
|
||||
.strip_suffix("\n```\n")
|
||||
.or_else(|| buffer.strip_suffix("\n```"))
|
||||
.or_else(|| buffer.strip_suffix("\n``"))
|
||||
.or_else(|| buffer.strip_suffix("\n`"))
|
||||
.or_else(|| buffer.strip_suffix('\n'))
|
||||
.unwrap_or(&buffer)
|
||||
} else {
|
||||
&buffer
|
||||
.or_else(|| text.strip_suffix("\n```"))
|
||||
.or_else(|| text.strip_suffix("\n``"))
|
||||
.or_else(|| text.strip_suffix("\n`"))
|
||||
.or_else(|| text.strip_suffix('\n'))
|
||||
.unwrap_or(&text)
|
||||
.to_string();
|
||||
}
|
||||
|
||||
if includes_start_or_end_span {
|
||||
text = text
|
||||
.strip_suffix("|E|>")
|
||||
.or_else(|| text.strip_suffix("E|>"))
|
||||
.or_else(|| text.strip_prefix("|>"))
|
||||
.or_else(|| text.strip_prefix(">"))
|
||||
.unwrap_or(&text)
|
||||
.to_string();
|
||||
};
|
||||
|
||||
if text.contains('\n') {
|
||||
@@ -328,6 +359,7 @@ fn strip_markdown_codeblock(
|
||||
} else {
|
||||
Some(Ok(buffer.clone()))
|
||||
};
|
||||
|
||||
buffer = remainder;
|
||||
future::ready(result)
|
||||
})
|
||||
@@ -558,50 +590,82 @@ mod tests {
|
||||
}
|
||||
|
||||
#[gpui::test]
|
||||
async fn test_strip_markdown_codeblock() {
|
||||
async fn test_strip_invalid_spans_from_codeblock() {
|
||||
assert_eq!(
|
||||
strip_markdown_codeblock(chunks("Lorem ipsum dolor", 2))
|
||||
strip_invalid_spans_from_codeblock(chunks("Lorem ipsum dolor", 2))
|
||||
.map(|chunk| chunk.unwrap())
|
||||
.collect::<String>()
|
||||
.await,
|
||||
"Lorem ipsum dolor"
|
||||
);
|
||||
assert_eq!(
|
||||
strip_markdown_codeblock(chunks("```\nLorem ipsum dolor", 2))
|
||||
strip_invalid_spans_from_codeblock(chunks("```\nLorem ipsum dolor", 2))
|
||||
.map(|chunk| chunk.unwrap())
|
||||
.collect::<String>()
|
||||
.await,
|
||||
"Lorem ipsum dolor"
|
||||
);
|
||||
assert_eq!(
|
||||
strip_markdown_codeblock(chunks("```\nLorem ipsum dolor\n```", 2))
|
||||
strip_invalid_spans_from_codeblock(chunks("```\nLorem ipsum dolor\n```", 2))
|
||||
.map(|chunk| chunk.unwrap())
|
||||
.collect::<String>()
|
||||
.await,
|
||||
"Lorem ipsum dolor"
|
||||
);
|
||||
assert_eq!(
|
||||
strip_markdown_codeblock(chunks("```\nLorem ipsum dolor\n```\n", 2))
|
||||
strip_invalid_spans_from_codeblock(chunks("```\nLorem ipsum dolor\n```\n", 2))
|
||||
.map(|chunk| chunk.unwrap())
|
||||
.collect::<String>()
|
||||
.await,
|
||||
"Lorem ipsum dolor"
|
||||
);
|
||||
assert_eq!(
|
||||
strip_markdown_codeblock(chunks("```html\n```js\nLorem ipsum dolor\n```\n```", 2))
|
||||
.map(|chunk| chunk.unwrap())
|
||||
.collect::<String>()
|
||||
.await,
|
||||
strip_invalid_spans_from_codeblock(chunks(
|
||||
"```html\n```js\nLorem ipsum dolor\n```\n```",
|
||||
2
|
||||
))
|
||||
.map(|chunk| chunk.unwrap())
|
||||
.collect::<String>()
|
||||
.await,
|
||||
"```js\nLorem ipsum dolor\n```"
|
||||
);
|
||||
assert_eq!(
|
||||
strip_markdown_codeblock(chunks("``\nLorem ipsum dolor\n```", 2))
|
||||
strip_invalid_spans_from_codeblock(chunks("``\nLorem ipsum dolor\n```", 2))
|
||||
.map(|chunk| chunk.unwrap())
|
||||
.collect::<String>()
|
||||
.await,
|
||||
"``\nLorem ipsum dolor\n```"
|
||||
);
|
||||
assert_eq!(
|
||||
strip_invalid_spans_from_codeblock(chunks("<|S|Lorem ipsum|E|>", 2))
|
||||
.map(|chunk| chunk.unwrap())
|
||||
.collect::<String>()
|
||||
.await,
|
||||
"Lorem ipsum"
|
||||
);
|
||||
|
||||
assert_eq!(
|
||||
strip_invalid_spans_from_codeblock(chunks("<|S|>Lorem ipsum", 2))
|
||||
.map(|chunk| chunk.unwrap())
|
||||
.collect::<String>()
|
||||
.await,
|
||||
"Lorem ipsum"
|
||||
);
|
||||
|
||||
assert_eq!(
|
||||
strip_invalid_spans_from_codeblock(chunks("```\n<|S|>Lorem ipsum\n```", 2))
|
||||
.map(|chunk| chunk.unwrap())
|
||||
.collect::<String>()
|
||||
.await,
|
||||
"Lorem ipsum"
|
||||
);
|
||||
assert_eq!(
|
||||
strip_invalid_spans_from_codeblock(chunks("```\n<|S|Lorem ipsum|E|>\n```", 2))
|
||||
.map(|chunk| chunk.unwrap())
|
||||
.collect::<String>()
|
||||
.await,
|
||||
"Lorem ipsum"
|
||||
);
|
||||
fn chunks(text: &str, size: usize) -> impl Stream<Item = Result<String>> {
|
||||
stream::iter(
|
||||
text.chars()
|
||||
|
||||
@@ -80,12 +80,12 @@ fn summarize(buffer: &BufferSnapshot, selected_range: Range<impl ToOffset>) -> S
|
||||
if !flushed_selection {
|
||||
// The collapsed node ends after the selection starts, so we'll flush the selection first.
|
||||
summary.extend(buffer.text_for_range(offset..selected_range.start));
|
||||
summary.push_str("<|START|");
|
||||
summary.push_str("<|S|");
|
||||
if selected_range.end == selected_range.start {
|
||||
summary.push_str(">");
|
||||
} else {
|
||||
summary.extend(buffer.text_for_range(selected_range.clone()));
|
||||
summary.push_str("|END|>");
|
||||
summary.push_str("|E|>");
|
||||
}
|
||||
offset = selected_range.end;
|
||||
flushed_selection = true;
|
||||
@@ -107,12 +107,12 @@ fn summarize(buffer: &BufferSnapshot, selected_range: Range<impl ToOffset>) -> S
|
||||
// Flush selection if we haven't already done so.
|
||||
if !flushed_selection && offset <= selected_range.start {
|
||||
summary.extend(buffer.text_for_range(offset..selected_range.start));
|
||||
summary.push_str("<|START|");
|
||||
summary.push_str("<|S|");
|
||||
if selected_range.end == selected_range.start {
|
||||
summary.push_str(">");
|
||||
} else {
|
||||
summary.extend(buffer.text_for_range(selected_range.clone()));
|
||||
summary.push_str("|END|>");
|
||||
summary.push_str("|E|>");
|
||||
}
|
||||
offset = selected_range.end;
|
||||
}
|
||||
@@ -260,7 +260,7 @@ pub(crate) mod tests {
|
||||
summarize(&snapshot, Point::new(1, 4)..Point::new(1, 4)),
|
||||
indoc! {"
|
||||
struct X {
|
||||
<|START|>a: usize,
|
||||
<|S|>a: usize,
|
||||
b: usize,
|
||||
}
|
||||
|
||||
@@ -286,7 +286,7 @@ pub(crate) mod tests {
|
||||
impl X {
|
||||
|
||||
fn new() -> Self {
|
||||
let <|START|a |END|>= 1;
|
||||
let <|S|a |E|>= 1;
|
||||
let b = 2;
|
||||
Self { a, b }
|
||||
}
|
||||
@@ -307,7 +307,7 @@ pub(crate) mod tests {
|
||||
}
|
||||
|
||||
impl X {
|
||||
<|START|>
|
||||
<|S|>
|
||||
fn new() -> Self {}
|
||||
|
||||
pub fn a(&self, param: bool) -> usize {}
|
||||
@@ -333,7 +333,7 @@ pub(crate) mod tests {
|
||||
|
||||
pub fn b(&self) -> usize {}
|
||||
}
|
||||
<|START|>"}
|
||||
<|S|>"}
|
||||
);
|
||||
|
||||
// Ensure nested functions get collapsed properly.
|
||||
@@ -369,7 +369,7 @@ pub(crate) mod tests {
|
||||
assert_eq!(
|
||||
summarize(&snapshot, Point::new(0, 0)..Point::new(0, 0)),
|
||||
indoc! {"
|
||||
<|START|>struct X {
|
||||
<|S|>struct X {
|
||||
a: usize,
|
||||
b: usize,
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ test-support = [
|
||||
"client2/test-support",
|
||||
"collections/test-support",
|
||||
"gpui2/test-support",
|
||||
"live_kit_client/test-support",
|
||||
"live_kit_client2/test-support",
|
||||
"project2/test-support",
|
||||
"util/test-support"
|
||||
]
|
||||
@@ -24,7 +24,7 @@ client2 = { path = "../client2" }
|
||||
collections = { path = "../collections" }
|
||||
gpui2 = { path = "../gpui2" }
|
||||
log.workspace = true
|
||||
live_kit_client = { path = "../live_kit_client" }
|
||||
live_kit_client2 = { path = "../live_kit_client2" }
|
||||
fs2 = { path = "../fs2" }
|
||||
language2 = { path = "../language2" }
|
||||
media = { path = "../media" }
|
||||
@@ -47,6 +47,6 @@ fs2 = { path = "../fs2", features = ["test-support"] }
|
||||
language2 = { path = "../language2", features = ["test-support"] }
|
||||
collections = { path = "../collections", features = ["test-support"] }
|
||||
gpui2 = { path = "../gpui2", features = ["test-support"] }
|
||||
live_kit_client = { path = "../live_kit_client", features = ["test-support"] }
|
||||
live_kit_client2 = { path = "../live_kit_client2", features = ["test-support"] }
|
||||
project2 = { path = "../project2", features = ["test-support"] }
|
||||
util = { path = "../util", features = ["test-support"] }
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
use anyhow::{anyhow, Result};
|
||||
use client2::ParticipantIndex;
|
||||
use client2::{proto, User};
|
||||
use collections::HashMap;
|
||||
use gpui2::WeakModel;
|
||||
pub use live_kit_client::Frame;
|
||||
pub use live_kit_client2::Frame;
|
||||
use live_kit_client2::{RemoteAudioTrack, RemoteVideoTrack};
|
||||
use project2::Project;
|
||||
use std::{fmt, sync::Arc};
|
||||
use std::sync::Arc;
|
||||
|
||||
#[derive(Copy, Clone, Debug, Eq, PartialEq)]
|
||||
pub enum ParticipantLocation {
|
||||
@@ -45,27 +47,6 @@ pub struct RemoteParticipant {
|
||||
pub participant_index: ParticipantIndex,
|
||||
pub muted: bool,
|
||||
pub speaking: bool,
|
||||
// pub video_tracks: HashMap<live_kit_client::Sid, Arc<RemoteVideoTrack>>,
|
||||
// pub audio_tracks: HashMap<live_kit_client::Sid, Arc<RemoteAudioTrack>>,
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct RemoteVideoTrack {
|
||||
pub(crate) live_kit_track: Arc<live_kit_client::RemoteVideoTrack>,
|
||||
}
|
||||
|
||||
unsafe impl Send for RemoteVideoTrack {}
|
||||
// todo!("remove this sync because it's not legit")
|
||||
unsafe impl Sync for RemoteVideoTrack {}
|
||||
|
||||
impl fmt::Debug for RemoteVideoTrack {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
f.debug_struct("RemoteVideoTrack").finish()
|
||||
}
|
||||
}
|
||||
|
||||
impl RemoteVideoTrack {
|
||||
pub fn frames(&self) -> async_broadcast::Receiver<Frame> {
|
||||
self.live_kit_track.frames()
|
||||
}
|
||||
pub video_tracks: HashMap<live_kit_client2::Sid, Arc<RemoteVideoTrack>>,
|
||||
pub audio_tracks: HashMap<live_kit_client2::Sid, Arc<RemoteAudioTrack>>,
|
||||
}
|
||||
|
||||
+449
-466
File diff suppressed because it is too large
Load Diff
@@ -47,8 +47,8 @@ where
|
||||
subscribers.remove(&subscriber_id);
|
||||
if subscribers.is_empty() {
|
||||
lock.subscribers.remove(&emitter_key);
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// We didn't manage to remove the subscription, which means it was dropped
|
||||
|
||||
@@ -506,6 +506,12 @@ impl<'a, 'w> WindowContext<'a, 'w> {
|
||||
self.window.rem_size
|
||||
}
|
||||
|
||||
/// Sets the size of an em for the base font of the application. Adjusting this value allows the
|
||||
/// UI to scale, just like zooming a web page.
|
||||
pub fn set_rem_size(&mut self, rem_size: impl Into<Pixels>) {
|
||||
self.window.rem_size = rem_size.into();
|
||||
}
|
||||
|
||||
/// The line height associated with the current text style.
|
||||
pub fn line_height(&self) -> Pixels {
|
||||
let rem_size = self.rem_size();
|
||||
|
||||
@@ -42,7 +42,7 @@ use std::{
|
||||
},
|
||||
};
|
||||
use syntax_map::SyntaxSnapshot;
|
||||
use theme2::{SyntaxTheme, Theme};
|
||||
use theme2::{SyntaxTheme, ThemeVariant};
|
||||
use tree_sitter::{self, Query};
|
||||
use unicase::UniCase;
|
||||
use util::{http::HttpClient, paths::PathExt};
|
||||
@@ -642,7 +642,7 @@ struct LanguageRegistryState {
|
||||
next_available_language_id: AvailableLanguageId,
|
||||
loading_languages: HashMap<AvailableLanguageId, Vec<oneshot::Sender<Result<Arc<Language>>>>>,
|
||||
subscription: (watch::Sender<()>, watch::Receiver<()>),
|
||||
theme: Option<Arc<Theme>>,
|
||||
theme: Option<Arc<ThemeVariant>>,
|
||||
version: usize,
|
||||
reload_count: usize,
|
||||
}
|
||||
@@ -743,11 +743,11 @@ impl LanguageRegistry {
|
||||
self.state.read().reload_count
|
||||
}
|
||||
|
||||
pub fn set_theme(&self, theme: Arc<Theme>) {
|
||||
pub fn set_theme(&self, theme: Arc<ThemeVariant>) {
|
||||
let mut state = self.state.write();
|
||||
state.theme = Some(theme.clone());
|
||||
for language in &state.languages {
|
||||
language.set_theme(&theme.syntax);
|
||||
language.set_theme(&theme.syntax());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1048,7 +1048,7 @@ impl LanguageRegistryState {
|
||||
|
||||
fn add(&mut self, language: Arc<Language>) {
|
||||
if let Some(theme) = self.theme.as_ref() {
|
||||
language.set_theme(&theme.syntax);
|
||||
language.set_theme(&theme.syntax());
|
||||
}
|
||||
self.languages.push(language);
|
||||
self.version += 1;
|
||||
|
||||
@@ -42,8 +42,8 @@
|
||||
"repositoryURL": "https://github.com/apple/swift-protobuf.git",
|
||||
"state": {
|
||||
"branch": null,
|
||||
"revision": "ce20dc083ee485524b802669890291c0d8090170",
|
||||
"version": "1.22.1"
|
||||
"revision": "0af9125c4eae12a4973fb66574c53a54962a9e1e",
|
||||
"version": "1.21.0"
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
[live_kit_client_test]
|
||||
rustflags = ["-C", "link-args=-ObjC"]
|
||||
@@ -0,0 +1,71 @@
|
||||
[package]
|
||||
name = "live_kit_client2"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
description = "Bindings to LiveKit Swift client SDK"
|
||||
publish = false
|
||||
|
||||
[lib]
|
||||
path = "src/live_kit_client2.rs"
|
||||
doctest = false
|
||||
|
||||
[[example]]
|
||||
name = "test_app"
|
||||
|
||||
[features]
|
||||
test-support = [
|
||||
"async-trait",
|
||||
"collections/test-support",
|
||||
"gpui2/test-support",
|
||||
"live_kit_server",
|
||||
"nanoid",
|
||||
]
|
||||
|
||||
[dependencies]
|
||||
collections = { path = "../collections", optional = true }
|
||||
gpui2 = { path = "../gpui2", optional = true }
|
||||
live_kit_server = { path = "../live_kit_server", optional = true }
|
||||
media = { path = "../media" }
|
||||
|
||||
anyhow.workspace = true
|
||||
async-broadcast = "0.4"
|
||||
core-foundation = "0.9.3"
|
||||
core-graphics = "0.22.3"
|
||||
futures.workspace = true
|
||||
log.workspace = true
|
||||
parking_lot.workspace = true
|
||||
postage.workspace = true
|
||||
|
||||
async-trait = { workspace = true, optional = true }
|
||||
nanoid = { version ="0.4", optional = true}
|
||||
|
||||
[dev-dependencies]
|
||||
collections = { path = "../collections", features = ["test-support"] }
|
||||
gpui2 = { path = "../gpui2", features = ["test-support"] }
|
||||
live_kit_server = { path = "../live_kit_server" }
|
||||
media = { path = "../media" }
|
||||
nanoid = "0.4"
|
||||
|
||||
anyhow.workspace = true
|
||||
async-trait.workspace = true
|
||||
block = "0.1"
|
||||
bytes = "1.2"
|
||||
byteorder = "1.4"
|
||||
cocoa = "0.24"
|
||||
core-foundation = "0.9.3"
|
||||
core-graphics = "0.22.3"
|
||||
foreign-types = "0.3"
|
||||
futures.workspace = true
|
||||
hmac = "0.12"
|
||||
jwt = "0.16"
|
||||
objc = "0.2"
|
||||
parking_lot.workspace = true
|
||||
serde.workspace = true
|
||||
serde_derive.workspace = true
|
||||
sha2 = "0.10"
|
||||
simplelog = "0.9"
|
||||
|
||||
[build-dependencies]
|
||||
serde.workspace = true
|
||||
serde_derive.workspace = true
|
||||
serde_json.workspace = true
|
||||
@@ -0,0 +1,52 @@
|
||||
{
|
||||
"object": {
|
||||
"pins": [
|
||||
{
|
||||
"package": "LiveKit",
|
||||
"repositoryURL": "https://github.com/livekit/client-sdk-swift.git",
|
||||
"state": {
|
||||
"branch": null,
|
||||
"revision": "7331b813a5ab8a95cfb81fb2b4ed10519428b9ff",
|
||||
"version": "1.0.12"
|
||||
}
|
||||
},
|
||||
{
|
||||
"package": "Promises",
|
||||
"repositoryURL": "https://github.com/google/promises.git",
|
||||
"state": {
|
||||
"branch": null,
|
||||
"revision": "ec957ccddbcc710ccc64c9dcbd4c7006fcf8b73a",
|
||||
"version": "2.2.0"
|
||||
}
|
||||
},
|
||||
{
|
||||
"package": "WebRTC",
|
||||
"repositoryURL": "https://github.com/webrtc-sdk/Specs.git",
|
||||
"state": {
|
||||
"branch": null,
|
||||
"revision": "2f6bab30c8df0fe59ab3e58bc99097f757f85f65",
|
||||
"version": "104.5112.17"
|
||||
}
|
||||
},
|
||||
{
|
||||
"package": "swift-log",
|
||||
"repositoryURL": "https://github.com/apple/swift-log.git",
|
||||
"state": {
|
||||
"branch": null,
|
||||
"revision": "32e8d724467f8fe623624570367e3d50c5638e46",
|
||||
"version": "1.5.2"
|
||||
}
|
||||
},
|
||||
{
|
||||
"package": "SwiftProtobuf",
|
||||
"repositoryURL": "https://github.com/apple/swift-protobuf.git",
|
||||
"state": {
|
||||
"branch": null,
|
||||
"revision": "ce20dc083ee485524b802669890291c0d8090170",
|
||||
"version": "1.22.1"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"version": 1
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
// swift-tools-version: 5.5
|
||||
|
||||
import PackageDescription
|
||||
|
||||
let package = Package(
|
||||
name: "LiveKitBridge2",
|
||||
platforms: [
|
||||
.macOS(.v10_15)
|
||||
],
|
||||
products: [
|
||||
// Products define the executables and libraries a package produces, and make them visible to other packages.
|
||||
.library(
|
||||
name: "LiveKitBridge2",
|
||||
type: .static,
|
||||
targets: ["LiveKitBridge2"]),
|
||||
],
|
||||
dependencies: [
|
||||
.package(url: "https://github.com/livekit/client-sdk-swift.git", .exact("1.0.12")),
|
||||
],
|
||||
targets: [
|
||||
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
|
||||
// Targets can depend on other targets in this package, and on products in packages this package depends on.
|
||||
.target(
|
||||
name: "LiveKitBridge2",
|
||||
dependencies: [.product(name: "LiveKit", package: "client-sdk-swift")]),
|
||||
]
|
||||
)
|
||||
@@ -0,0 +1,3 @@
|
||||
# LiveKitBridge2
|
||||
|
||||
A description of this package.
|
||||
@@ -0,0 +1,327 @@
|
||||
import Foundation
|
||||
import LiveKit
|
||||
import WebRTC
|
||||
import ScreenCaptureKit
|
||||
|
||||
class LKRoomDelegate: RoomDelegate {
|
||||
var data: UnsafeRawPointer
|
||||
var onDidDisconnect: @convention(c) (UnsafeRawPointer) -> Void
|
||||
var onDidSubscribeToRemoteAudioTrack: @convention(c) (UnsafeRawPointer, CFString, CFString, UnsafeRawPointer, UnsafeRawPointer) -> Void
|
||||
var onDidUnsubscribeFromRemoteAudioTrack: @convention(c) (UnsafeRawPointer, CFString, CFString) -> Void
|
||||
var onMuteChangedFromRemoteAudioTrack: @convention(c) (UnsafeRawPointer, CFString, Bool) -> Void
|
||||
var onActiveSpeakersChanged: @convention(c) (UnsafeRawPointer, CFArray) -> Void
|
||||
var onDidSubscribeToRemoteVideoTrack: @convention(c) (UnsafeRawPointer, CFString, CFString, UnsafeRawPointer) -> Void
|
||||
var onDidUnsubscribeFromRemoteVideoTrack: @convention(c) (UnsafeRawPointer, CFString, CFString) -> Void
|
||||
|
||||
init(
|
||||
data: UnsafeRawPointer,
|
||||
onDidDisconnect: @escaping @convention(c) (UnsafeRawPointer) -> Void,
|
||||
onDidSubscribeToRemoteAudioTrack: @escaping @convention(c) (UnsafeRawPointer, CFString, CFString, UnsafeRawPointer, UnsafeRawPointer) -> Void,
|
||||
onDidUnsubscribeFromRemoteAudioTrack: @escaping @convention(c) (UnsafeRawPointer, CFString, CFString) -> Void,
|
||||
onMuteChangedFromRemoteAudioTrack: @escaping @convention(c) (UnsafeRawPointer, CFString, Bool) -> Void,
|
||||
onActiveSpeakersChanged: @convention(c) (UnsafeRawPointer, CFArray) -> Void,
|
||||
onDidSubscribeToRemoteVideoTrack: @escaping @convention(c) (UnsafeRawPointer, CFString, CFString, UnsafeRawPointer) -> Void,
|
||||
onDidUnsubscribeFromRemoteVideoTrack: @escaping @convention(c) (UnsafeRawPointer, CFString, CFString) -> Void)
|
||||
{
|
||||
self.data = data
|
||||
self.onDidDisconnect = onDidDisconnect
|
||||
self.onDidSubscribeToRemoteAudioTrack = onDidSubscribeToRemoteAudioTrack
|
||||
self.onDidUnsubscribeFromRemoteAudioTrack = onDidUnsubscribeFromRemoteAudioTrack
|
||||
self.onDidSubscribeToRemoteVideoTrack = onDidSubscribeToRemoteVideoTrack
|
||||
self.onDidUnsubscribeFromRemoteVideoTrack = onDidUnsubscribeFromRemoteVideoTrack
|
||||
self.onMuteChangedFromRemoteAudioTrack = onMuteChangedFromRemoteAudioTrack
|
||||
self.onActiveSpeakersChanged = onActiveSpeakersChanged
|
||||
}
|
||||
|
||||
func room(_ room: Room, didUpdate connectionState: ConnectionState, oldValue: ConnectionState) {
|
||||
if connectionState.isDisconnected {
|
||||
self.onDidDisconnect(self.data)
|
||||
}
|
||||
}
|
||||
|
||||
func room(_ room: Room, participant: RemoteParticipant, didSubscribe publication: RemoteTrackPublication, track: Track) {
|
||||
if track.kind == .video {
|
||||
self.onDidSubscribeToRemoteVideoTrack(self.data, participant.identity as CFString, track.sid! as CFString, Unmanaged.passUnretained(track).toOpaque())
|
||||
} else if track.kind == .audio {
|
||||
self.onDidSubscribeToRemoteAudioTrack(self.data, participant.identity as CFString, track.sid! as CFString, Unmanaged.passUnretained(track).toOpaque(), Unmanaged.passUnretained(publication).toOpaque())
|
||||
}
|
||||
}
|
||||
|
||||
func room(_ room: Room, participant: Participant, didUpdate publication: TrackPublication, muted: Bool) {
|
||||
if publication.kind == .audio {
|
||||
self.onMuteChangedFromRemoteAudioTrack(self.data, publication.sid as CFString, muted)
|
||||
}
|
||||
}
|
||||
|
||||
func room(_ room: Room, didUpdate speakers: [Participant]) {
|
||||
guard let speaker_ids = speakers.compactMap({ $0.identity as CFString }) as CFArray? else { return }
|
||||
self.onActiveSpeakersChanged(self.data, speaker_ids)
|
||||
}
|
||||
|
||||
func room(_ room: Room, participant: RemoteParticipant, didUnsubscribe publication: RemoteTrackPublication, track: Track) {
|
||||
if track.kind == .video {
|
||||
self.onDidUnsubscribeFromRemoteVideoTrack(self.data, participant.identity as CFString, track.sid! as CFString)
|
||||
} else if track.kind == .audio {
|
||||
self.onDidUnsubscribeFromRemoteAudioTrack(self.data, participant.identity as CFString, track.sid! as CFString)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class LKVideoRenderer: NSObject, VideoRenderer {
|
||||
var data: UnsafeRawPointer
|
||||
var onFrame: @convention(c) (UnsafeRawPointer, CVPixelBuffer) -> Bool
|
||||
var onDrop: @convention(c) (UnsafeRawPointer) -> Void
|
||||
var adaptiveStreamIsEnabled: Bool = false
|
||||
var adaptiveStreamSize: CGSize = .zero
|
||||
weak var track: VideoTrack?
|
||||
|
||||
init(data: UnsafeRawPointer, onFrame: @escaping @convention(c) (UnsafeRawPointer, CVPixelBuffer) -> Bool, onDrop: @escaping @convention(c) (UnsafeRawPointer) -> Void) {
|
||||
self.data = data
|
||||
self.onFrame = onFrame
|
||||
self.onDrop = onDrop
|
||||
}
|
||||
|
||||
deinit {
|
||||
self.onDrop(self.data)
|
||||
}
|
||||
|
||||
func setSize(_ size: CGSize) {
|
||||
}
|
||||
|
||||
func renderFrame(_ frame: RTCVideoFrame?) {
|
||||
let buffer = frame?.buffer as? RTCCVPixelBuffer
|
||||
if let pixelBuffer = buffer?.pixelBuffer {
|
||||
if !self.onFrame(self.data, pixelBuffer) {
|
||||
DispatchQueue.main.async {
|
||||
self.track?.remove(videoRenderer: self)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@_cdecl("LKRoomDelegateCreate")
|
||||
public func LKRoomDelegateCreate(
|
||||
data: UnsafeRawPointer,
|
||||
onDidDisconnect: @escaping @convention(c) (UnsafeRawPointer) -> Void,
|
||||
onDidSubscribeToRemoteAudioTrack: @escaping @convention(c) (UnsafeRawPointer, CFString, CFString, UnsafeRawPointer, UnsafeRawPointer) -> Void,
|
||||
onDidUnsubscribeFromRemoteAudioTrack: @escaping @convention(c) (UnsafeRawPointer, CFString, CFString) -> Void,
|
||||
onMuteChangedFromRemoteAudioTrack: @escaping @convention(c) (UnsafeRawPointer, CFString, Bool) -> Void,
|
||||
onActiveSpeakerChanged: @escaping @convention(c) (UnsafeRawPointer, CFArray) -> Void,
|
||||
onDidSubscribeToRemoteVideoTrack: @escaping @convention(c) (UnsafeRawPointer, CFString, CFString, UnsafeRawPointer) -> Void,
|
||||
onDidUnsubscribeFromRemoteVideoTrack: @escaping @convention(c) (UnsafeRawPointer, CFString, CFString) -> Void
|
||||
) -> UnsafeMutableRawPointer {
|
||||
let delegate = LKRoomDelegate(
|
||||
data: data,
|
||||
onDidDisconnect: onDidDisconnect,
|
||||
onDidSubscribeToRemoteAudioTrack: onDidSubscribeToRemoteAudioTrack,
|
||||
onDidUnsubscribeFromRemoteAudioTrack: onDidUnsubscribeFromRemoteAudioTrack,
|
||||
onMuteChangedFromRemoteAudioTrack: onMuteChangedFromRemoteAudioTrack,
|
||||
onActiveSpeakersChanged: onActiveSpeakerChanged,
|
||||
onDidSubscribeToRemoteVideoTrack: onDidSubscribeToRemoteVideoTrack,
|
||||
onDidUnsubscribeFromRemoteVideoTrack: onDidUnsubscribeFromRemoteVideoTrack
|
||||
)
|
||||
return Unmanaged.passRetained(delegate).toOpaque()
|
||||
}
|
||||
|
||||
@_cdecl("LKRoomCreate")
|
||||
public func LKRoomCreate(delegate: UnsafeRawPointer) -> UnsafeMutableRawPointer {
|
||||
let delegate = Unmanaged<LKRoomDelegate>.fromOpaque(delegate).takeUnretainedValue()
|
||||
return Unmanaged.passRetained(Room(delegate: delegate)).toOpaque()
|
||||
}
|
||||
|
||||
@_cdecl("LKRoomConnect")
|
||||
public func LKRoomConnect(room: UnsafeRawPointer, url: CFString, token: CFString, callback: @escaping @convention(c) (UnsafeRawPointer, CFString?) -> Void, callback_data: UnsafeRawPointer) {
|
||||
let room = Unmanaged<Room>.fromOpaque(room).takeUnretainedValue()
|
||||
|
||||
room.connect(url as String, token as String).then { _ in
|
||||
callback(callback_data, UnsafeRawPointer(nil) as! CFString?)
|
||||
}.catch { error in
|
||||
callback(callback_data, error.localizedDescription as CFString)
|
||||
}
|
||||
}
|
||||
|
||||
@_cdecl("LKRoomDisconnect")
|
||||
public func LKRoomDisconnect(room: UnsafeRawPointer) {
|
||||
let room = Unmanaged<Room>.fromOpaque(room).takeUnretainedValue()
|
||||
room.disconnect()
|
||||
}
|
||||
|
||||
@_cdecl("LKRoomPublishVideoTrack")
|
||||
public func LKRoomPublishVideoTrack(room: UnsafeRawPointer, track: UnsafeRawPointer, callback: @escaping @convention(c) (UnsafeRawPointer, UnsafeMutableRawPointer?, CFString?) -> Void, callback_data: UnsafeRawPointer) {
|
||||
let room = Unmanaged<Room>.fromOpaque(room).takeUnretainedValue()
|
||||
let track = Unmanaged<LocalVideoTrack>.fromOpaque(track).takeUnretainedValue()
|
||||
room.localParticipant?.publishVideoTrack(track: track).then { publication in
|
||||
callback(callback_data, Unmanaged.passRetained(publication).toOpaque(), nil)
|
||||
}.catch { error in
|
||||
callback(callback_data, nil, error.localizedDescription as CFString)
|
||||
}
|
||||
}
|
||||
|
||||
@_cdecl("LKRoomPublishAudioTrack")
|
||||
public func LKRoomPublishAudioTrack(room: UnsafeRawPointer, track: UnsafeRawPointer, callback: @escaping @convention(c) (UnsafeRawPointer, UnsafeMutableRawPointer?, CFString?) -> Void, callback_data: UnsafeRawPointer) {
|
||||
let room = Unmanaged<Room>.fromOpaque(room).takeUnretainedValue()
|
||||
let track = Unmanaged<LocalAudioTrack>.fromOpaque(track).takeUnretainedValue()
|
||||
room.localParticipant?.publishAudioTrack(track: track).then { publication in
|
||||
callback(callback_data, Unmanaged.passRetained(publication).toOpaque(), nil)
|
||||
}.catch { error in
|
||||
callback(callback_data, nil, error.localizedDescription as CFString)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@_cdecl("LKRoomUnpublishTrack")
|
||||
public func LKRoomUnpublishTrack(room: UnsafeRawPointer, publication: UnsafeRawPointer) {
|
||||
let room = Unmanaged<Room>.fromOpaque(room).takeUnretainedValue()
|
||||
let publication = Unmanaged<LocalTrackPublication>.fromOpaque(publication).takeUnretainedValue()
|
||||
let _ = room.localParticipant?.unpublish(publication: publication)
|
||||
}
|
||||
|
||||
@_cdecl("LKRoomAudioTracksForRemoteParticipant")
|
||||
public func LKRoomAudioTracksForRemoteParticipant(room: UnsafeRawPointer, participantId: CFString) -> CFArray? {
|
||||
let room = Unmanaged<Room>.fromOpaque(room).takeUnretainedValue()
|
||||
|
||||
for (_, participant) in room.remoteParticipants {
|
||||
if participant.identity == participantId as String {
|
||||
return participant.audioTracks.compactMap { $0.track as? RemoteAudioTrack } as CFArray?
|
||||
}
|
||||
}
|
||||
|
||||
return nil;
|
||||
}
|
||||
|
||||
@_cdecl("LKRoomAudioTrackPublicationsForRemoteParticipant")
|
||||
public func LKRoomAudioTrackPublicationsForRemoteParticipant(room: UnsafeRawPointer, participantId: CFString) -> CFArray? {
|
||||
let room = Unmanaged<Room>.fromOpaque(room).takeUnretainedValue()
|
||||
|
||||
for (_, participant) in room.remoteParticipants {
|
||||
if participant.identity == participantId as String {
|
||||
return participant.audioTracks.compactMap { $0 as? RemoteTrackPublication } as CFArray?
|
||||
}
|
||||
}
|
||||
|
||||
return nil;
|
||||
}
|
||||
|
||||
@_cdecl("LKRoomVideoTracksForRemoteParticipant")
|
||||
public func LKRoomVideoTracksForRemoteParticipant(room: UnsafeRawPointer, participantId: CFString) -> CFArray? {
|
||||
let room = Unmanaged<Room>.fromOpaque(room).takeUnretainedValue()
|
||||
|
||||
for (_, participant) in room.remoteParticipants {
|
||||
if participant.identity == participantId as String {
|
||||
return participant.videoTracks.compactMap { $0.track as? RemoteVideoTrack } as CFArray?
|
||||
}
|
||||
}
|
||||
|
||||
return nil;
|
||||
}
|
||||
|
||||
@_cdecl("LKLocalAudioTrackCreateTrack")
|
||||
public func LKLocalAudioTrackCreateTrack() -> UnsafeMutableRawPointer {
|
||||
let track = LocalAudioTrack.createTrack(options: AudioCaptureOptions(
|
||||
echoCancellation: true,
|
||||
noiseSuppression: true
|
||||
))
|
||||
|
||||
return Unmanaged.passRetained(track).toOpaque()
|
||||
}
|
||||
|
||||
|
||||
@_cdecl("LKCreateScreenShareTrackForDisplay")
|
||||
public func LKCreateScreenShareTrackForDisplay(display: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer {
|
||||
let display = Unmanaged<MacOSDisplay>.fromOpaque(display).takeUnretainedValue()
|
||||
let track = LocalVideoTrack.createMacOSScreenShareTrack(source: display, preferredMethod: .legacy)
|
||||
return Unmanaged.passRetained(track).toOpaque()
|
||||
}
|
||||
|
||||
@_cdecl("LKVideoRendererCreate")
|
||||
public func LKVideoRendererCreate(data: UnsafeRawPointer, onFrame: @escaping @convention(c) (UnsafeRawPointer, CVPixelBuffer) -> Bool, onDrop: @escaping @convention(c) (UnsafeRawPointer) -> Void) -> UnsafeMutableRawPointer {
|
||||
Unmanaged.passRetained(LKVideoRenderer(data: data, onFrame: onFrame, onDrop: onDrop)).toOpaque()
|
||||
}
|
||||
|
||||
@_cdecl("LKVideoTrackAddRenderer")
|
||||
public func LKVideoTrackAddRenderer(track: UnsafeRawPointer, renderer: UnsafeRawPointer) {
|
||||
let track = Unmanaged<Track>.fromOpaque(track).takeUnretainedValue() as! VideoTrack
|
||||
let renderer = Unmanaged<LKVideoRenderer>.fromOpaque(renderer).takeRetainedValue()
|
||||
renderer.track = track
|
||||
track.add(videoRenderer: renderer)
|
||||
}
|
||||
|
||||
@_cdecl("LKRemoteVideoTrackGetSid")
|
||||
public func LKRemoteVideoTrackGetSid(track: UnsafeRawPointer) -> CFString {
|
||||
let track = Unmanaged<RemoteVideoTrack>.fromOpaque(track).takeUnretainedValue()
|
||||
return track.sid! as CFString
|
||||
}
|
||||
|
||||
@_cdecl("LKRemoteAudioTrackGetSid")
|
||||
public func LKRemoteAudioTrackGetSid(track: UnsafeRawPointer) -> CFString {
|
||||
let track = Unmanaged<RemoteAudioTrack>.fromOpaque(track).takeUnretainedValue()
|
||||
return track.sid! as CFString
|
||||
}
|
||||
|
||||
@_cdecl("LKDisplaySources")
|
||||
public func LKDisplaySources(data: UnsafeRawPointer, callback: @escaping @convention(c) (UnsafeRawPointer, CFArray?, CFString?) -> Void) {
|
||||
MacOSScreenCapturer.sources(for: .display, includeCurrentApplication: false, preferredMethod: .legacy).then { displaySources in
|
||||
callback(data, displaySources as CFArray, nil)
|
||||
}.catch { error in
|
||||
callback(data, nil, error.localizedDescription as CFString)
|
||||
}
|
||||
}
|
||||
|
||||
@_cdecl("LKLocalTrackPublicationSetMute")
|
||||
public func LKLocalTrackPublicationSetMute(
|
||||
publication: UnsafeRawPointer,
|
||||
muted: Bool,
|
||||
on_complete: @escaping @convention(c) (UnsafeRawPointer, CFString?) -> Void,
|
||||
callback_data: UnsafeRawPointer
|
||||
) {
|
||||
let publication = Unmanaged<LocalTrackPublication>.fromOpaque(publication).takeUnretainedValue()
|
||||
|
||||
if muted {
|
||||
publication.mute().then {
|
||||
on_complete(callback_data, nil)
|
||||
}.catch { error in
|
||||
on_complete(callback_data, error.localizedDescription as CFString)
|
||||
}
|
||||
} else {
|
||||
publication.unmute().then {
|
||||
on_complete(callback_data, nil)
|
||||
}.catch { error in
|
||||
on_complete(callback_data, error.localizedDescription as CFString)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@_cdecl("LKRemoteTrackPublicationSetEnabled")
|
||||
public func LKRemoteTrackPublicationSetEnabled(
|
||||
publication: UnsafeRawPointer,
|
||||
enabled: Bool,
|
||||
on_complete: @escaping @convention(c) (UnsafeRawPointer, CFString?) -> Void,
|
||||
callback_data: UnsafeRawPointer
|
||||
) {
|
||||
let publication = Unmanaged<RemoteTrackPublication>.fromOpaque(publication).takeUnretainedValue()
|
||||
|
||||
publication.set(enabled: enabled).then {
|
||||
on_complete(callback_data, nil)
|
||||
}.catch { error in
|
||||
on_complete(callback_data, error.localizedDescription as CFString)
|
||||
}
|
||||
}
|
||||
|
||||
@_cdecl("LKRemoteTrackPublicationIsMuted")
|
||||
public func LKRemoteTrackPublicationIsMuted(
|
||||
publication: UnsafeRawPointer
|
||||
) -> Bool {
|
||||
let publication = Unmanaged<RemoteTrackPublication>.fromOpaque(publication).takeUnretainedValue()
|
||||
|
||||
return publication.muted
|
||||
}
|
||||
|
||||
@_cdecl("LKRemoteTrackPublicationGetSid")
|
||||
public func LKRemoteTrackPublicationGetSid(
|
||||
publication: UnsafeRawPointer
|
||||
) -> CFString {
|
||||
let publication = Unmanaged<RemoteTrackPublication>.fromOpaque(publication).takeUnretainedValue()
|
||||
|
||||
return publication.sid as CFString
|
||||
}
|
||||
@@ -0,0 +1,172 @@
|
||||
use serde::Deserialize;
|
||||
use std::{
|
||||
env,
|
||||
path::{Path, PathBuf},
|
||||
process::Command,
|
||||
};
|
||||
|
||||
const SWIFT_PACKAGE_NAME: &str = "LiveKitBridge2";
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct SwiftTargetInfo {
|
||||
pub triple: String,
|
||||
pub unversioned_triple: String,
|
||||
pub module_triple: String,
|
||||
pub swift_runtime_compatibility_version: String,
|
||||
#[serde(rename = "librariesRequireRPath")]
|
||||
pub libraries_require_rpath: bool,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct SwiftPaths {
|
||||
pub runtime_library_paths: Vec<String>,
|
||||
pub runtime_library_import_paths: Vec<String>,
|
||||
pub runtime_resource_path: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
pub struct SwiftTarget {
|
||||
pub target: SwiftTargetInfo,
|
||||
pub paths: SwiftPaths,
|
||||
}
|
||||
|
||||
const MACOS_TARGET_VERSION: &str = "10.15.7";
|
||||
|
||||
fn main() {
|
||||
if cfg!(not(any(test, feature = "test-support"))) {
|
||||
let swift_target = get_swift_target();
|
||||
|
||||
build_bridge(&swift_target);
|
||||
link_swift_stdlib(&swift_target);
|
||||
link_webrtc_framework(&swift_target);
|
||||
|
||||
// Register exported Objective-C selectors, protocols, etc when building example binaries.
|
||||
println!("cargo:rustc-link-arg=-Wl,-ObjC");
|
||||
}
|
||||
}
|
||||
|
||||
fn build_bridge(swift_target: &SwiftTarget) {
|
||||
println!("cargo:rerun-if-env-changed=MACOSX_DEPLOYMENT_TARGET");
|
||||
println!("cargo:rerun-if-changed={}/Sources", SWIFT_PACKAGE_NAME);
|
||||
println!(
|
||||
"cargo:rerun-if-changed={}/Package.swift",
|
||||
SWIFT_PACKAGE_NAME
|
||||
);
|
||||
println!(
|
||||
"cargo:rerun-if-changed={}/Package.resolved",
|
||||
SWIFT_PACKAGE_NAME
|
||||
);
|
||||
|
||||
let swift_package_root = swift_package_root();
|
||||
let swift_target_folder = swift_target_folder();
|
||||
if !Command::new("swift")
|
||||
.arg("build")
|
||||
.arg("--disable-automatic-resolution")
|
||||
.args(["--configuration", &env::var("PROFILE").unwrap()])
|
||||
.args(["--triple", &swift_target.target.triple])
|
||||
.args(["--build-path".into(), swift_target_folder])
|
||||
.current_dir(&swift_package_root)
|
||||
.status()
|
||||
.unwrap()
|
||||
.success()
|
||||
{
|
||||
panic!(
|
||||
"Failed to compile swift package in {}",
|
||||
swift_package_root.display()
|
||||
);
|
||||
}
|
||||
|
||||
println!(
|
||||
"cargo:rustc-link-search=native={}",
|
||||
swift_target.out_dir_path().display()
|
||||
);
|
||||
println!("cargo:rustc-link-lib=static={}", SWIFT_PACKAGE_NAME);
|
||||
}
|
||||
|
||||
fn link_swift_stdlib(swift_target: &SwiftTarget) {
|
||||
for path in &swift_target.paths.runtime_library_paths {
|
||||
println!("cargo:rustc-link-search=native={}", path);
|
||||
}
|
||||
}
|
||||
|
||||
fn link_webrtc_framework(swift_target: &SwiftTarget) {
|
||||
let swift_out_dir_path = swift_target.out_dir_path();
|
||||
println!("cargo:rustc-link-lib=framework=WebRTC");
|
||||
println!(
|
||||
"cargo:rustc-link-search=framework={}",
|
||||
swift_out_dir_path.display()
|
||||
);
|
||||
// Find WebRTC.framework as a sibling of the executable when running tests.
|
||||
println!("cargo:rustc-link-arg=-Wl,-rpath,@executable_path");
|
||||
// Find WebRTC.framework in parent directory of the executable when running examples.
|
||||
println!("cargo:rustc-link-arg=-Wl,-rpath,@executable_path/..");
|
||||
|
||||
let source_path = swift_out_dir_path.join("WebRTC.framework");
|
||||
let deps_dir_path =
|
||||
PathBuf::from(env::var("OUT_DIR").unwrap()).join("../../../deps/WebRTC.framework");
|
||||
let target_dir_path =
|
||||
PathBuf::from(env::var("OUT_DIR").unwrap()).join("../../../WebRTC.framework");
|
||||
copy_dir(&source_path, &deps_dir_path);
|
||||
copy_dir(&source_path, &target_dir_path);
|
||||
}
|
||||
|
||||
fn get_swift_target() -> SwiftTarget {
|
||||
let mut arch = env::var("CARGO_CFG_TARGET_ARCH").unwrap();
|
||||
if arch == "aarch64" {
|
||||
arch = "arm64".into();
|
||||
}
|
||||
let target = format!("{}-apple-macosx{}", arch, MACOS_TARGET_VERSION);
|
||||
|
||||
let swift_target_info_str = Command::new("swift")
|
||||
.args(["-target", &target, "-print-target-info"])
|
||||
.output()
|
||||
.unwrap()
|
||||
.stdout;
|
||||
|
||||
serde_json::from_slice(&swift_target_info_str).unwrap()
|
||||
}
|
||||
|
||||
fn swift_package_root() -> PathBuf {
|
||||
env::current_dir().unwrap().join(SWIFT_PACKAGE_NAME)
|
||||
}
|
||||
|
||||
fn swift_target_folder() -> PathBuf {
|
||||
env::current_dir()
|
||||
.unwrap()
|
||||
.join(format!("../../target/{SWIFT_PACKAGE_NAME}"))
|
||||
}
|
||||
|
||||
fn copy_dir(source: &Path, destination: &Path) {
|
||||
assert!(
|
||||
Command::new("rm")
|
||||
.arg("-rf")
|
||||
.arg(destination)
|
||||
.status()
|
||||
.unwrap()
|
||||
.success(),
|
||||
"could not remove {:?} before copying",
|
||||
destination
|
||||
);
|
||||
|
||||
assert!(
|
||||
Command::new("cp")
|
||||
.arg("-R")
|
||||
.args([source, destination])
|
||||
.status()
|
||||
.unwrap()
|
||||
.success(),
|
||||
"could not copy {:?} to {:?}",
|
||||
source,
|
||||
destination
|
||||
);
|
||||
}
|
||||
|
||||
impl SwiftTarget {
|
||||
fn out_dir_path(&self) -> PathBuf {
|
||||
swift_target_folder()
|
||||
.join(&self.target.unversioned_triple)
|
||||
.join(env::var("PROFILE").unwrap())
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,178 @@
|
||||
use std::{sync::Arc, time::Duration};
|
||||
|
||||
use futures::StreamExt;
|
||||
use gpui2::KeyBinding;
|
||||
use live_kit_client2::{
|
||||
LocalAudioTrack, LocalVideoTrack, RemoteAudioTrackUpdate, RemoteVideoTrackUpdate, Room,
|
||||
};
|
||||
use live_kit_server::token::{self, VideoGrant};
|
||||
use log::LevelFilter;
|
||||
use serde_derive::Deserialize;
|
||||
use simplelog::SimpleLogger;
|
||||
|
||||
#[derive(Deserialize, Debug, Clone, Copy, PartialEq, Eq, Default)]
|
||||
struct Quit;
|
||||
|
||||
fn main() {
|
||||
SimpleLogger::init(LevelFilter::Info, Default::default()).expect("could not initialize logger");
|
||||
|
||||
gpui2::App::production(Arc::new(())).run(|cx| {
|
||||
#[cfg(any(test, feature = "test-support"))]
|
||||
println!("USING TEST LIVEKIT");
|
||||
|
||||
#[cfg(not(any(test, feature = "test-support")))]
|
||||
println!("USING REAL LIVEKIT");
|
||||
|
||||
cx.activate(true);
|
||||
|
||||
cx.on_action(quit);
|
||||
cx.bind_keys([KeyBinding::new("cmd-q", Quit, None)]);
|
||||
|
||||
// todo!()
|
||||
// cx.set_menus(vec![Menu {
|
||||
// name: "Zed",
|
||||
// items: vec![MenuItem::Action {
|
||||
// name: "Quit",
|
||||
// action: Box::new(Quit),
|
||||
// os_action: None,
|
||||
// }],
|
||||
// }]);
|
||||
|
||||
let live_kit_url = std::env::var("LIVE_KIT_URL").unwrap_or("http://localhost:7880".into());
|
||||
let live_kit_key = std::env::var("LIVE_KIT_KEY").unwrap_or("devkey".into());
|
||||
let live_kit_secret = std::env::var("LIVE_KIT_SECRET").unwrap_or("secret".into());
|
||||
|
||||
cx.spawn_on_main(|cx| async move {
|
||||
let user_a_token = token::create(
|
||||
&live_kit_key,
|
||||
&live_kit_secret,
|
||||
Some("test-participant-1"),
|
||||
VideoGrant::to_join("test-room"),
|
||||
)
|
||||
.unwrap();
|
||||
let room_a = Room::new();
|
||||
room_a.connect(&live_kit_url, &user_a_token).await.unwrap();
|
||||
|
||||
let user2_token = token::create(
|
||||
&live_kit_key,
|
||||
&live_kit_secret,
|
||||
Some("test-participant-2"),
|
||||
VideoGrant::to_join("test-room"),
|
||||
)
|
||||
.unwrap();
|
||||
let room_b = Room::new();
|
||||
room_b.connect(&live_kit_url, &user2_token).await.unwrap();
|
||||
|
||||
let mut audio_track_updates = room_b.remote_audio_track_updates();
|
||||
let audio_track = LocalAudioTrack::create();
|
||||
let audio_track_publication = room_a.publish_audio_track(audio_track).await.unwrap();
|
||||
|
||||
if let RemoteAudioTrackUpdate::Subscribed(track, _) =
|
||||
audio_track_updates.next().await.unwrap()
|
||||
{
|
||||
let remote_tracks = room_b.remote_audio_tracks("test-participant-1");
|
||||
assert_eq!(remote_tracks.len(), 1);
|
||||
assert_eq!(remote_tracks[0].publisher_id(), "test-participant-1");
|
||||
assert_eq!(track.publisher_id(), "test-participant-1");
|
||||
} else {
|
||||
panic!("unexpected message");
|
||||
}
|
||||
|
||||
audio_track_publication.set_mute(true).await.unwrap();
|
||||
|
||||
println!("waiting for mute changed!");
|
||||
if let RemoteAudioTrackUpdate::MuteChanged { track_id, muted } =
|
||||
audio_track_updates.next().await.unwrap()
|
||||
{
|
||||
let remote_tracks = room_b.remote_audio_tracks("test-participant-1");
|
||||
assert_eq!(remote_tracks[0].sid(), track_id);
|
||||
assert_eq!(muted, true);
|
||||
} else {
|
||||
panic!("unexpected message");
|
||||
}
|
||||
|
||||
audio_track_publication.set_mute(false).await.unwrap();
|
||||
|
||||
if let RemoteAudioTrackUpdate::MuteChanged { track_id, muted } =
|
||||
audio_track_updates.next().await.unwrap()
|
||||
{
|
||||
let remote_tracks = room_b.remote_audio_tracks("test-participant-1");
|
||||
assert_eq!(remote_tracks[0].sid(), track_id);
|
||||
assert_eq!(muted, false);
|
||||
} else {
|
||||
panic!("unexpected message");
|
||||
}
|
||||
|
||||
println!("Pausing for 5 seconds to test audio, make some noise!");
|
||||
let timer = cx.executor().timer(Duration::from_secs(5));
|
||||
timer.await;
|
||||
let remote_audio_track = room_b
|
||||
.remote_audio_tracks("test-participant-1")
|
||||
.pop()
|
||||
.unwrap();
|
||||
room_a.unpublish_track(audio_track_publication);
|
||||
|
||||
// Clear out any active speakers changed messages
|
||||
let mut next = audio_track_updates.next().await.unwrap();
|
||||
while let RemoteAudioTrackUpdate::ActiveSpeakersChanged { speakers } = next {
|
||||
println!("Speakers changed: {:?}", speakers);
|
||||
next = audio_track_updates.next().await.unwrap();
|
||||
}
|
||||
|
||||
if let RemoteAudioTrackUpdate::Unsubscribed {
|
||||
publisher_id,
|
||||
track_id,
|
||||
} = next
|
||||
{
|
||||
assert_eq!(publisher_id, "test-participant-1");
|
||||
assert_eq!(remote_audio_track.sid(), track_id);
|
||||
assert_eq!(room_b.remote_audio_tracks("test-participant-1").len(), 0);
|
||||
} else {
|
||||
panic!("unexpected message");
|
||||
}
|
||||
|
||||
let mut video_track_updates = room_b.remote_video_track_updates();
|
||||
let displays = room_a.display_sources().await.unwrap();
|
||||
let display = displays.into_iter().next().unwrap();
|
||||
|
||||
let local_video_track = LocalVideoTrack::screen_share_for_display(&display);
|
||||
let local_video_track_publication =
|
||||
room_a.publish_video_track(local_video_track).await.unwrap();
|
||||
|
||||
if let RemoteVideoTrackUpdate::Subscribed(track) =
|
||||
video_track_updates.next().await.unwrap()
|
||||
{
|
||||
let remote_video_tracks = room_b.remote_video_tracks("test-participant-1");
|
||||
assert_eq!(remote_video_tracks.len(), 1);
|
||||
assert_eq!(remote_video_tracks[0].publisher_id(), "test-participant-1");
|
||||
assert_eq!(track.publisher_id(), "test-participant-1");
|
||||
} else {
|
||||
panic!("unexpected message");
|
||||
}
|
||||
|
||||
let remote_video_track = room_b
|
||||
.remote_video_tracks("test-participant-1")
|
||||
.pop()
|
||||
.unwrap();
|
||||
room_a.unpublish_track(local_video_track_publication);
|
||||
if let RemoteVideoTrackUpdate::Unsubscribed {
|
||||
publisher_id,
|
||||
track_id,
|
||||
} = video_track_updates.next().await.unwrap()
|
||||
{
|
||||
assert_eq!(publisher_id, "test-participant-1");
|
||||
assert_eq!(remote_video_track.sid(), track_id);
|
||||
assert_eq!(room_b.remote_video_tracks("test-participant-1").len(), 0);
|
||||
} else {
|
||||
panic!("unexpected message");
|
||||
}
|
||||
|
||||
cx.update(|cx| cx.quit()).ok();
|
||||
})
|
||||
.detach();
|
||||
});
|
||||
}
|
||||
|
||||
fn quit(_: &Quit, cx: &mut gpui2::AppContext) {
|
||||
cx.quit();
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
#[cfg(not(any(test, feature = "test-support")))]
|
||||
pub mod prod;
|
||||
|
||||
#[cfg(not(any(test, feature = "test-support")))]
|
||||
pub use prod::*;
|
||||
|
||||
#[cfg(any(test, feature = "test-support"))]
|
||||
pub mod test;
|
||||
|
||||
#[cfg(any(test, feature = "test-support"))]
|
||||
pub use test::*;
|
||||
@@ -0,0 +1,947 @@
|
||||
use anyhow::{anyhow, Context, Result};
|
||||
use core_foundation::{
|
||||
array::{CFArray, CFArrayRef},
|
||||
base::{CFRelease, CFRetain, TCFType},
|
||||
string::{CFString, CFStringRef},
|
||||
};
|
||||
use futures::{
|
||||
channel::{mpsc, oneshot},
|
||||
Future,
|
||||
};
|
||||
pub use media::core_video::CVImageBuffer;
|
||||
use media::core_video::CVImageBufferRef;
|
||||
use parking_lot::Mutex;
|
||||
use postage::watch;
|
||||
use std::{
|
||||
ffi::c_void,
|
||||
sync::{Arc, Weak},
|
||||
};
|
||||
|
||||
// SAFETY: Most live kit types are threadsafe:
|
||||
// https://github.com/livekit/client-sdk-swift#thread-safety
|
||||
macro_rules! pointer_type {
|
||||
($pointer_name:ident) => {
|
||||
#[repr(transparent)]
|
||||
#[derive(Copy, Clone, Debug)]
|
||||
pub struct $pointer_name(pub *const std::ffi::c_void);
|
||||
unsafe impl Send for $pointer_name {}
|
||||
};
|
||||
}
|
||||
|
||||
mod swift {
|
||||
pointer_type!(Room);
|
||||
pointer_type!(LocalAudioTrack);
|
||||
pointer_type!(RemoteAudioTrack);
|
||||
pointer_type!(LocalVideoTrack);
|
||||
pointer_type!(RemoteVideoTrack);
|
||||
pointer_type!(LocalTrackPublication);
|
||||
pointer_type!(RemoteTrackPublication);
|
||||
pointer_type!(MacOSDisplay);
|
||||
pointer_type!(RoomDelegate);
|
||||
}
|
||||
|
||||
extern "C" {
|
||||
fn LKRoomDelegateCreate(
|
||||
callback_data: *mut c_void,
|
||||
on_did_disconnect: extern "C" fn(callback_data: *mut c_void),
|
||||
on_did_subscribe_to_remote_audio_track: extern "C" fn(
|
||||
callback_data: *mut c_void,
|
||||
publisher_id: CFStringRef,
|
||||
track_id: CFStringRef,
|
||||
remote_track: swift::RemoteAudioTrack,
|
||||
remote_publication: swift::RemoteTrackPublication,
|
||||
),
|
||||
on_did_unsubscribe_from_remote_audio_track: extern "C" fn(
|
||||
callback_data: *mut c_void,
|
||||
publisher_id: CFStringRef,
|
||||
track_id: CFStringRef,
|
||||
),
|
||||
on_mute_changed_from_remote_audio_track: extern "C" fn(
|
||||
callback_data: *mut c_void,
|
||||
track_id: CFStringRef,
|
||||
muted: bool,
|
||||
),
|
||||
on_active_speakers_changed: extern "C" fn(
|
||||
callback_data: *mut c_void,
|
||||
participants: CFArrayRef,
|
||||
),
|
||||
on_did_subscribe_to_remote_video_track: extern "C" fn(
|
||||
callback_data: *mut c_void,
|
||||
publisher_id: CFStringRef,
|
||||
track_id: CFStringRef,
|
||||
remote_track: swift::RemoteVideoTrack,
|
||||
),
|
||||
on_did_unsubscribe_from_remote_video_track: extern "C" fn(
|
||||
callback_data: *mut c_void,
|
||||
publisher_id: CFStringRef,
|
||||
track_id: CFStringRef,
|
||||
),
|
||||
) -> swift::RoomDelegate;
|
||||
|
||||
fn LKRoomCreate(delegate: swift::RoomDelegate) -> swift::Room;
|
||||
fn LKRoomConnect(
|
||||
room: swift::Room,
|
||||
url: CFStringRef,
|
||||
token: CFStringRef,
|
||||
callback: extern "C" fn(*mut c_void, CFStringRef),
|
||||
callback_data: *mut c_void,
|
||||
);
|
||||
fn LKRoomDisconnect(room: swift::Room);
|
||||
fn LKRoomPublishVideoTrack(
|
||||
room: swift::Room,
|
||||
track: swift::LocalVideoTrack,
|
||||
callback: extern "C" fn(*mut c_void, swift::LocalTrackPublication, CFStringRef),
|
||||
callback_data: *mut c_void,
|
||||
);
|
||||
fn LKRoomPublishAudioTrack(
|
||||
room: swift::Room,
|
||||
track: swift::LocalAudioTrack,
|
||||
callback: extern "C" fn(*mut c_void, swift::LocalTrackPublication, CFStringRef),
|
||||
callback_data: *mut c_void,
|
||||
);
|
||||
fn LKRoomUnpublishTrack(room: swift::Room, publication: swift::LocalTrackPublication);
|
||||
|
||||
fn LKRoomAudioTracksForRemoteParticipant(
|
||||
room: swift::Room,
|
||||
participant_id: CFStringRef,
|
||||
) -> CFArrayRef;
|
||||
|
||||
fn LKRoomAudioTrackPublicationsForRemoteParticipant(
|
||||
room: swift::Room,
|
||||
participant_id: CFStringRef,
|
||||
) -> CFArrayRef;
|
||||
|
||||
fn LKRoomVideoTracksForRemoteParticipant(
|
||||
room: swift::Room,
|
||||
participant_id: CFStringRef,
|
||||
) -> CFArrayRef;
|
||||
|
||||
fn LKVideoRendererCreate(
|
||||
callback_data: *mut c_void,
|
||||
on_frame: extern "C" fn(callback_data: *mut c_void, frame: CVImageBufferRef) -> bool,
|
||||
on_drop: extern "C" fn(callback_data: *mut c_void),
|
||||
) -> *const c_void;
|
||||
|
||||
fn LKRemoteAudioTrackGetSid(track: swift::RemoteAudioTrack) -> CFStringRef;
|
||||
fn LKVideoTrackAddRenderer(track: swift::RemoteVideoTrack, renderer: *const c_void);
|
||||
fn LKRemoteVideoTrackGetSid(track: swift::RemoteVideoTrack) -> CFStringRef;
|
||||
|
||||
fn LKDisplaySources(
|
||||
callback_data: *mut c_void,
|
||||
callback: extern "C" fn(
|
||||
callback_data: *mut c_void,
|
||||
sources: CFArrayRef,
|
||||
error: CFStringRef,
|
||||
),
|
||||
);
|
||||
fn LKCreateScreenShareTrackForDisplay(display: swift::MacOSDisplay) -> swift::LocalVideoTrack;
|
||||
fn LKLocalAudioTrackCreateTrack() -> swift::LocalAudioTrack;
|
||||
|
||||
fn LKLocalTrackPublicationSetMute(
|
||||
publication: swift::LocalTrackPublication,
|
||||
muted: bool,
|
||||
on_complete: extern "C" fn(callback_data: *mut c_void, error: CFStringRef),
|
||||
callback_data: *mut c_void,
|
||||
);
|
||||
|
||||
fn LKRemoteTrackPublicationSetEnabled(
|
||||
publication: swift::RemoteTrackPublication,
|
||||
enabled: bool,
|
||||
on_complete: extern "C" fn(callback_data: *mut c_void, error: CFStringRef),
|
||||
callback_data: *mut c_void,
|
||||
);
|
||||
|
||||
fn LKRemoteTrackPublicationIsMuted(publication: swift::RemoteTrackPublication) -> bool;
|
||||
fn LKRemoteTrackPublicationGetSid(publication: swift::RemoteTrackPublication) -> CFStringRef;
|
||||
}
|
||||
|
||||
pub type Sid = String;
|
||||
|
||||
#[derive(Clone, Eq, PartialEq)]
|
||||
pub enum ConnectionState {
|
||||
Disconnected,
|
||||
Connected { url: String, token: String },
|
||||
}
|
||||
|
||||
pub struct Room {
|
||||
native_room: Mutex<swift::Room>,
|
||||
connection: Mutex<(
|
||||
watch::Sender<ConnectionState>,
|
||||
watch::Receiver<ConnectionState>,
|
||||
)>,
|
||||
remote_audio_track_subscribers: Mutex<Vec<mpsc::UnboundedSender<RemoteAudioTrackUpdate>>>,
|
||||
remote_video_track_subscribers: Mutex<Vec<mpsc::UnboundedSender<RemoteVideoTrackUpdate>>>,
|
||||
_delegate: Mutex<RoomDelegate>,
|
||||
}
|
||||
|
||||
trait AssertSendSync: Send {}
|
||||
impl AssertSendSync for Room {}
|
||||
|
||||
impl Room {
|
||||
pub fn new() -> Arc<Self> {
|
||||
Arc::new_cyclic(|weak_room| {
|
||||
let delegate = RoomDelegate::new(weak_room.clone());
|
||||
Self {
|
||||
native_room: Mutex::new(unsafe { LKRoomCreate(delegate.native_delegate) }),
|
||||
connection: Mutex::new(watch::channel_with(ConnectionState::Disconnected)),
|
||||
remote_audio_track_subscribers: Default::default(),
|
||||
remote_video_track_subscribers: Default::default(),
|
||||
_delegate: Mutex::new(delegate),
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
pub fn status(&self) -> watch::Receiver<ConnectionState> {
|
||||
self.connection.lock().1.clone()
|
||||
}
|
||||
|
||||
pub fn connect(self: &Arc<Self>, url: &str, token: &str) -> impl Future<Output = Result<()>> {
|
||||
let url = CFString::new(url);
|
||||
let token = CFString::new(token);
|
||||
let (did_connect, tx, rx) = Self::build_done_callback();
|
||||
unsafe {
|
||||
LKRoomConnect(
|
||||
*self.native_room.lock(),
|
||||
url.as_concrete_TypeRef(),
|
||||
token.as_concrete_TypeRef(),
|
||||
did_connect,
|
||||
tx,
|
||||
)
|
||||
}
|
||||
|
||||
let this = self.clone();
|
||||
let url = url.to_string();
|
||||
let token = token.to_string();
|
||||
async move {
|
||||
rx.await.unwrap().context("error connecting to room")?;
|
||||
*this.connection.lock().0.borrow_mut() = ConnectionState::Connected { url, token };
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
fn did_disconnect(&self) {
|
||||
*self.connection.lock().0.borrow_mut() = ConnectionState::Disconnected;
|
||||
}
|
||||
|
||||
pub fn display_sources(self: &Arc<Self>) -> impl Future<Output = Result<Vec<MacOSDisplay>>> {
|
||||
extern "C" fn callback(tx: *mut c_void, sources: CFArrayRef, error: CFStringRef) {
|
||||
unsafe {
|
||||
let tx = Box::from_raw(tx as *mut oneshot::Sender<Result<Vec<MacOSDisplay>>>);
|
||||
|
||||
if sources.is_null() {
|
||||
let _ = tx.send(Err(anyhow!("{}", CFString::wrap_under_get_rule(error))));
|
||||
} else {
|
||||
let sources = CFArray::wrap_under_get_rule(sources)
|
||||
.into_iter()
|
||||
.map(|source| MacOSDisplay::new(swift::MacOSDisplay(*source)))
|
||||
.collect();
|
||||
|
||||
let _ = tx.send(Ok(sources));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let (tx, rx) = oneshot::channel();
|
||||
|
||||
unsafe {
|
||||
LKDisplaySources(Box::into_raw(Box::new(tx)) as *mut _, callback);
|
||||
}
|
||||
|
||||
async move { rx.await.unwrap() }
|
||||
}
|
||||
|
||||
pub fn publish_video_track(
|
||||
self: &Arc<Self>,
|
||||
track: LocalVideoTrack,
|
||||
) -> impl Future<Output = Result<LocalTrackPublication>> {
|
||||
let (tx, rx) = oneshot::channel::<Result<LocalTrackPublication>>();
|
||||
extern "C" fn callback(
|
||||
tx: *mut c_void,
|
||||
publication: swift::LocalTrackPublication,
|
||||
error: CFStringRef,
|
||||
) {
|
||||
let tx =
|
||||
unsafe { Box::from_raw(tx as *mut oneshot::Sender<Result<LocalTrackPublication>>) };
|
||||
if error.is_null() {
|
||||
let _ = tx.send(Ok(LocalTrackPublication::new(publication)));
|
||||
} else {
|
||||
let error = unsafe { CFString::wrap_under_get_rule(error).to_string() };
|
||||
let _ = tx.send(Err(anyhow!(error)));
|
||||
}
|
||||
}
|
||||
unsafe {
|
||||
LKRoomPublishVideoTrack(
|
||||
*self.native_room.lock(),
|
||||
track.0,
|
||||
callback,
|
||||
Box::into_raw(Box::new(tx)) as *mut c_void,
|
||||
);
|
||||
}
|
||||
async { rx.await.unwrap().context("error publishing video track") }
|
||||
}
|
||||
|
||||
pub fn publish_audio_track(
|
||||
self: &Arc<Self>,
|
||||
track: LocalAudioTrack,
|
||||
) -> impl Future<Output = Result<LocalTrackPublication>> {
|
||||
let (tx, rx) = oneshot::channel::<Result<LocalTrackPublication>>();
|
||||
extern "C" fn callback(
|
||||
tx: *mut c_void,
|
||||
publication: swift::LocalTrackPublication,
|
||||
error: CFStringRef,
|
||||
) {
|
||||
let tx =
|
||||
unsafe { Box::from_raw(tx as *mut oneshot::Sender<Result<LocalTrackPublication>>) };
|
||||
if error.is_null() {
|
||||
let _ = tx.send(Ok(LocalTrackPublication::new(publication)));
|
||||
} else {
|
||||
let error = unsafe { CFString::wrap_under_get_rule(error).to_string() };
|
||||
let _ = tx.send(Err(anyhow!(error)));
|
||||
}
|
||||
}
|
||||
unsafe {
|
||||
LKRoomPublishAudioTrack(
|
||||
*self.native_room.lock(),
|
||||
track.0,
|
||||
callback,
|
||||
Box::into_raw(Box::new(tx)) as *mut c_void,
|
||||
);
|
||||
}
|
||||
async { rx.await.unwrap().context("error publishing audio track") }
|
||||
}
|
||||
|
||||
pub fn unpublish_track(&self, publication: LocalTrackPublication) {
|
||||
unsafe {
|
||||
LKRoomUnpublishTrack(*self.native_room.lock(), publication.0);
|
||||
}
|
||||
}
|
||||
|
||||
pub fn remote_video_tracks(&self, participant_id: &str) -> Vec<Arc<RemoteVideoTrack>> {
|
||||
unsafe {
|
||||
let tracks = LKRoomVideoTracksForRemoteParticipant(
|
||||
*self.native_room.lock(),
|
||||
CFString::new(participant_id).as_concrete_TypeRef(),
|
||||
);
|
||||
|
||||
if tracks.is_null() {
|
||||
Vec::new()
|
||||
} else {
|
||||
let tracks = CFArray::wrap_under_get_rule(tracks);
|
||||
tracks
|
||||
.into_iter()
|
||||
.map(|native_track| {
|
||||
let native_track = swift::RemoteVideoTrack(*native_track);
|
||||
let id =
|
||||
CFString::wrap_under_get_rule(LKRemoteVideoTrackGetSid(native_track))
|
||||
.to_string();
|
||||
Arc::new(RemoteVideoTrack::new(
|
||||
native_track,
|
||||
id,
|
||||
participant_id.into(),
|
||||
))
|
||||
})
|
||||
.collect()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn remote_audio_tracks(&self, participant_id: &str) -> Vec<Arc<RemoteAudioTrack>> {
|
||||
unsafe {
|
||||
let tracks = LKRoomAudioTracksForRemoteParticipant(
|
||||
*self.native_room.lock(),
|
||||
CFString::new(participant_id).as_concrete_TypeRef(),
|
||||
);
|
||||
|
||||
if tracks.is_null() {
|
||||
Vec::new()
|
||||
} else {
|
||||
let tracks = CFArray::wrap_under_get_rule(tracks);
|
||||
tracks
|
||||
.into_iter()
|
||||
.map(|native_track| {
|
||||
let native_track = swift::RemoteAudioTrack(*native_track);
|
||||
let id =
|
||||
CFString::wrap_under_get_rule(LKRemoteAudioTrackGetSid(native_track))
|
||||
.to_string();
|
||||
Arc::new(RemoteAudioTrack::new(
|
||||
native_track,
|
||||
id,
|
||||
participant_id.into(),
|
||||
))
|
||||
})
|
||||
.collect()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn remote_audio_track_publications(
|
||||
&self,
|
||||
participant_id: &str,
|
||||
) -> Vec<Arc<RemoteTrackPublication>> {
|
||||
unsafe {
|
||||
let tracks = LKRoomAudioTrackPublicationsForRemoteParticipant(
|
||||
*self.native_room.lock(),
|
||||
CFString::new(participant_id).as_concrete_TypeRef(),
|
||||
);
|
||||
|
||||
if tracks.is_null() {
|
||||
Vec::new()
|
||||
} else {
|
||||
let tracks = CFArray::wrap_under_get_rule(tracks);
|
||||
tracks
|
||||
.into_iter()
|
||||
.map(|native_track_publication| {
|
||||
let native_track_publication =
|
||||
swift::RemoteTrackPublication(*native_track_publication);
|
||||
Arc::new(RemoteTrackPublication::new(native_track_publication))
|
||||
})
|
||||
.collect()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn remote_audio_track_updates(&self) -> mpsc::UnboundedReceiver<RemoteAudioTrackUpdate> {
|
||||
let (tx, rx) = mpsc::unbounded();
|
||||
self.remote_audio_track_subscribers.lock().push(tx);
|
||||
rx
|
||||
}
|
||||
|
||||
pub fn remote_video_track_updates(&self) -> mpsc::UnboundedReceiver<RemoteVideoTrackUpdate> {
|
||||
let (tx, rx) = mpsc::unbounded();
|
||||
self.remote_video_track_subscribers.lock().push(tx);
|
||||
rx
|
||||
}
|
||||
|
||||
fn did_subscribe_to_remote_audio_track(
|
||||
&self,
|
||||
track: RemoteAudioTrack,
|
||||
publication: RemoteTrackPublication,
|
||||
) {
|
||||
let track = Arc::new(track);
|
||||
let publication = Arc::new(publication);
|
||||
self.remote_audio_track_subscribers.lock().retain(|tx| {
|
||||
tx.unbounded_send(RemoteAudioTrackUpdate::Subscribed(
|
||||
track.clone(),
|
||||
publication.clone(),
|
||||
))
|
||||
.is_ok()
|
||||
});
|
||||
}
|
||||
|
||||
fn did_unsubscribe_from_remote_audio_track(&self, publisher_id: String, track_id: String) {
|
||||
self.remote_audio_track_subscribers.lock().retain(|tx| {
|
||||
tx.unbounded_send(RemoteAudioTrackUpdate::Unsubscribed {
|
||||
publisher_id: publisher_id.clone(),
|
||||
track_id: track_id.clone(),
|
||||
})
|
||||
.is_ok()
|
||||
});
|
||||
}
|
||||
|
||||
fn mute_changed_from_remote_audio_track(&self, track_id: String, muted: bool) {
|
||||
self.remote_audio_track_subscribers.lock().retain(|tx| {
|
||||
tx.unbounded_send(RemoteAudioTrackUpdate::MuteChanged {
|
||||
track_id: track_id.clone(),
|
||||
muted,
|
||||
})
|
||||
.is_ok()
|
||||
});
|
||||
}
|
||||
|
||||
// A vec of publisher IDs
|
||||
fn active_speakers_changed(&self, speakers: Vec<String>) {
|
||||
self.remote_audio_track_subscribers
|
||||
.lock()
|
||||
.retain(move |tx| {
|
||||
tx.unbounded_send(RemoteAudioTrackUpdate::ActiveSpeakersChanged {
|
||||
speakers: speakers.clone(),
|
||||
})
|
||||
.is_ok()
|
||||
});
|
||||
}
|
||||
|
||||
fn did_subscribe_to_remote_video_track(&self, track: RemoteVideoTrack) {
|
||||
let track = Arc::new(track);
|
||||
self.remote_video_track_subscribers.lock().retain(|tx| {
|
||||
tx.unbounded_send(RemoteVideoTrackUpdate::Subscribed(track.clone()))
|
||||
.is_ok()
|
||||
});
|
||||
}
|
||||
|
||||
fn did_unsubscribe_from_remote_video_track(&self, publisher_id: String, track_id: String) {
|
||||
self.remote_video_track_subscribers.lock().retain(|tx| {
|
||||
tx.unbounded_send(RemoteVideoTrackUpdate::Unsubscribed {
|
||||
publisher_id: publisher_id.clone(),
|
||||
track_id: track_id.clone(),
|
||||
})
|
||||
.is_ok()
|
||||
});
|
||||
}
|
||||
|
||||
fn build_done_callback() -> (
|
||||
extern "C" fn(*mut c_void, CFStringRef),
|
||||
*mut c_void,
|
||||
oneshot::Receiver<Result<()>>,
|
||||
) {
|
||||
let (tx, rx) = oneshot::channel();
|
||||
extern "C" fn done_callback(tx: *mut c_void, error: CFStringRef) {
|
||||
let tx = unsafe { Box::from_raw(tx as *mut oneshot::Sender<Result<()>>) };
|
||||
if error.is_null() {
|
||||
let _ = tx.send(Ok(()));
|
||||
} else {
|
||||
let error = unsafe { CFString::wrap_under_get_rule(error).to_string() };
|
||||
let _ = tx.send(Err(anyhow!(error)));
|
||||
}
|
||||
}
|
||||
(
|
||||
done_callback,
|
||||
Box::into_raw(Box::new(tx)) as *mut c_void,
|
||||
rx,
|
||||
)
|
||||
}
|
||||
|
||||
pub fn set_display_sources(&self, _: Vec<MacOSDisplay>) {
|
||||
unreachable!("This is a test-only function")
|
||||
}
|
||||
}
|
||||
|
||||
impl Drop for Room {
|
||||
fn drop(&mut self) {
|
||||
unsafe {
|
||||
let native_room = &*self.native_room.lock();
|
||||
LKRoomDisconnect(*native_room);
|
||||
CFRelease(native_room.0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
struct RoomDelegate {
|
||||
native_delegate: swift::RoomDelegate,
|
||||
_weak_room: Weak<Room>,
|
||||
}
|
||||
|
||||
impl RoomDelegate {
|
||||
fn new(weak_room: Weak<Room>) -> Self {
|
||||
let native_delegate = unsafe {
|
||||
LKRoomDelegateCreate(
|
||||
weak_room.as_ptr() as *mut c_void,
|
||||
Self::on_did_disconnect,
|
||||
Self::on_did_subscribe_to_remote_audio_track,
|
||||
Self::on_did_unsubscribe_from_remote_audio_track,
|
||||
Self::on_mute_change_from_remote_audio_track,
|
||||
Self::on_active_speakers_changed,
|
||||
Self::on_did_subscribe_to_remote_video_track,
|
||||
Self::on_did_unsubscribe_from_remote_video_track,
|
||||
)
|
||||
};
|
||||
Self {
|
||||
native_delegate,
|
||||
_weak_room: weak_room,
|
||||
}
|
||||
}
|
||||
|
||||
extern "C" fn on_did_disconnect(room: *mut c_void) {
|
||||
let room = unsafe { Weak::from_raw(room as *mut Room) };
|
||||
if let Some(room) = room.upgrade() {
|
||||
room.did_disconnect();
|
||||
}
|
||||
let _ = Weak::into_raw(room);
|
||||
}
|
||||
|
||||
extern "C" fn on_did_subscribe_to_remote_audio_track(
|
||||
room: *mut c_void,
|
||||
publisher_id: CFStringRef,
|
||||
track_id: CFStringRef,
|
||||
track: swift::RemoteAudioTrack,
|
||||
publication: swift::RemoteTrackPublication,
|
||||
) {
|
||||
let room = unsafe { Weak::from_raw(room as *mut Room) };
|
||||
let publisher_id = unsafe { CFString::wrap_under_get_rule(publisher_id).to_string() };
|
||||
let track_id = unsafe { CFString::wrap_under_get_rule(track_id).to_string() };
|
||||
let track = RemoteAudioTrack::new(track, track_id, publisher_id);
|
||||
let publication = RemoteTrackPublication::new(publication);
|
||||
if let Some(room) = room.upgrade() {
|
||||
room.did_subscribe_to_remote_audio_track(track, publication);
|
||||
}
|
||||
let _ = Weak::into_raw(room);
|
||||
}
|
||||
|
||||
extern "C" fn on_did_unsubscribe_from_remote_audio_track(
|
||||
room: *mut c_void,
|
||||
publisher_id: CFStringRef,
|
||||
track_id: CFStringRef,
|
||||
) {
|
||||
let room = unsafe { Weak::from_raw(room as *mut Room) };
|
||||
let publisher_id = unsafe { CFString::wrap_under_get_rule(publisher_id).to_string() };
|
||||
let track_id = unsafe { CFString::wrap_under_get_rule(track_id).to_string() };
|
||||
if let Some(room) = room.upgrade() {
|
||||
room.did_unsubscribe_from_remote_audio_track(publisher_id, track_id);
|
||||
}
|
||||
let _ = Weak::into_raw(room);
|
||||
}
|
||||
|
||||
extern "C" fn on_mute_change_from_remote_audio_track(
|
||||
room: *mut c_void,
|
||||
track_id: CFStringRef,
|
||||
muted: bool,
|
||||
) {
|
||||
let room = unsafe { Weak::from_raw(room as *mut Room) };
|
||||
let track_id = unsafe { CFString::wrap_under_get_rule(track_id).to_string() };
|
||||
if let Some(room) = room.upgrade() {
|
||||
room.mute_changed_from_remote_audio_track(track_id, muted);
|
||||
}
|
||||
let _ = Weak::into_raw(room);
|
||||
}
|
||||
|
||||
extern "C" fn on_active_speakers_changed(room: *mut c_void, participants: CFArrayRef) {
|
||||
if participants.is_null() {
|
||||
return;
|
||||
}
|
||||
|
||||
let room = unsafe { Weak::from_raw(room as *mut Room) };
|
||||
let speakers = unsafe {
|
||||
CFArray::wrap_under_get_rule(participants)
|
||||
.into_iter()
|
||||
.map(
|
||||
|speaker: core_foundation::base::ItemRef<'_, *const c_void>| {
|
||||
CFString::wrap_under_get_rule(*speaker as CFStringRef).to_string()
|
||||
},
|
||||
)
|
||||
.collect()
|
||||
};
|
||||
|
||||
if let Some(room) = room.upgrade() {
|
||||
room.active_speakers_changed(speakers);
|
||||
}
|
||||
let _ = Weak::into_raw(room);
|
||||
}
|
||||
|
||||
extern "C" fn on_did_subscribe_to_remote_video_track(
|
||||
room: *mut c_void,
|
||||
publisher_id: CFStringRef,
|
||||
track_id: CFStringRef,
|
||||
track: swift::RemoteVideoTrack,
|
||||
) {
|
||||
let room = unsafe { Weak::from_raw(room as *mut Room) };
|
||||
let publisher_id = unsafe { CFString::wrap_under_get_rule(publisher_id).to_string() };
|
||||
let track_id = unsafe { CFString::wrap_under_get_rule(track_id).to_string() };
|
||||
let track = RemoteVideoTrack::new(track, track_id, publisher_id);
|
||||
if let Some(room) = room.upgrade() {
|
||||
room.did_subscribe_to_remote_video_track(track);
|
||||
}
|
||||
let _ = Weak::into_raw(room);
|
||||
}
|
||||
|
||||
extern "C" fn on_did_unsubscribe_from_remote_video_track(
|
||||
room: *mut c_void,
|
||||
publisher_id: CFStringRef,
|
||||
track_id: CFStringRef,
|
||||
) {
|
||||
let room = unsafe { Weak::from_raw(room as *mut Room) };
|
||||
let publisher_id = unsafe { CFString::wrap_under_get_rule(publisher_id).to_string() };
|
||||
let track_id = unsafe { CFString::wrap_under_get_rule(track_id).to_string() };
|
||||
if let Some(room) = room.upgrade() {
|
||||
room.did_unsubscribe_from_remote_video_track(publisher_id, track_id);
|
||||
}
|
||||
let _ = Weak::into_raw(room);
|
||||
}
|
||||
}
|
||||
|
||||
impl Drop for RoomDelegate {
|
||||
fn drop(&mut self) {
|
||||
unsafe {
|
||||
CFRelease(self.native_delegate.0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub struct LocalAudioTrack(swift::LocalAudioTrack);
|
||||
|
||||
impl LocalAudioTrack {
|
||||
pub fn create() -> Self {
|
||||
Self(unsafe { LKLocalAudioTrackCreateTrack() })
|
||||
}
|
||||
}
|
||||
|
||||
impl Drop for LocalAudioTrack {
|
||||
fn drop(&mut self) {
|
||||
unsafe { CFRelease(self.0 .0) }
|
||||
}
|
||||
}
|
||||
|
||||
pub struct LocalVideoTrack(swift::LocalVideoTrack);
|
||||
|
||||
impl LocalVideoTrack {
|
||||
pub fn screen_share_for_display(display: &MacOSDisplay) -> Self {
|
||||
Self(unsafe { LKCreateScreenShareTrackForDisplay(display.0) })
|
||||
}
|
||||
}
|
||||
|
||||
impl Drop for LocalVideoTrack {
|
||||
fn drop(&mut self) {
|
||||
unsafe { CFRelease(self.0 .0) }
|
||||
}
|
||||
}
|
||||
|
||||
pub struct LocalTrackPublication(swift::LocalTrackPublication);
|
||||
|
||||
impl LocalTrackPublication {
|
||||
pub fn new(native_track_publication: swift::LocalTrackPublication) -> Self {
|
||||
unsafe {
|
||||
CFRetain(native_track_publication.0);
|
||||
}
|
||||
Self(native_track_publication)
|
||||
}
|
||||
|
||||
pub fn set_mute(&self, muted: bool) -> impl Future<Output = Result<()>> {
|
||||
let (tx, rx) = futures::channel::oneshot::channel();
|
||||
|
||||
extern "C" fn complete_callback(callback_data: *mut c_void, error: CFStringRef) {
|
||||
let tx = unsafe { Box::from_raw(callback_data as *mut oneshot::Sender<Result<()>>) };
|
||||
if error.is_null() {
|
||||
tx.send(Ok(())).ok();
|
||||
} else {
|
||||
let error = unsafe { CFString::wrap_under_get_rule(error).to_string() };
|
||||
tx.send(Err(anyhow!(error))).ok();
|
||||
}
|
||||
}
|
||||
|
||||
unsafe {
|
||||
LKLocalTrackPublicationSetMute(
|
||||
self.0,
|
||||
muted,
|
||||
complete_callback,
|
||||
Box::into_raw(Box::new(tx)) as *mut c_void,
|
||||
)
|
||||
}
|
||||
|
||||
async move { rx.await.unwrap() }
|
||||
}
|
||||
}
|
||||
|
||||
impl Drop for LocalTrackPublication {
|
||||
fn drop(&mut self) {
|
||||
unsafe { CFRelease(self.0 .0) }
|
||||
}
|
||||
}
|
||||
|
||||
pub struct RemoteTrackPublication {
|
||||
native_publication: Mutex<swift::RemoteTrackPublication>,
|
||||
}
|
||||
|
||||
impl RemoteTrackPublication {
|
||||
pub fn new(native_track_publication: swift::RemoteTrackPublication) -> Self {
|
||||
unsafe {
|
||||
CFRetain(native_track_publication.0);
|
||||
}
|
||||
Self {
|
||||
native_publication: Mutex::new(native_track_publication),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn sid(&self) -> String {
|
||||
unsafe {
|
||||
CFString::wrap_under_get_rule(LKRemoteTrackPublicationGetSid(
|
||||
*self.native_publication.lock(),
|
||||
))
|
||||
.to_string()
|
||||
}
|
||||
}
|
||||
|
||||
pub fn is_muted(&self) -> bool {
|
||||
unsafe { LKRemoteTrackPublicationIsMuted(*self.native_publication.lock()) }
|
||||
}
|
||||
|
||||
pub fn set_enabled(&self, enabled: bool) -> impl Future<Output = Result<()>> {
|
||||
let (tx, rx) = futures::channel::oneshot::channel();
|
||||
|
||||
extern "C" fn complete_callback(callback_data: *mut c_void, error: CFStringRef) {
|
||||
let tx = unsafe { Box::from_raw(callback_data as *mut oneshot::Sender<Result<()>>) };
|
||||
if error.is_null() {
|
||||
tx.send(Ok(())).ok();
|
||||
} else {
|
||||
let error = unsafe { CFString::wrap_under_get_rule(error).to_string() };
|
||||
tx.send(Err(anyhow!(error))).ok();
|
||||
}
|
||||
}
|
||||
|
||||
unsafe {
|
||||
LKRemoteTrackPublicationSetEnabled(
|
||||
*self.native_publication.lock(),
|
||||
enabled,
|
||||
complete_callback,
|
||||
Box::into_raw(Box::new(tx)) as *mut c_void,
|
||||
)
|
||||
}
|
||||
|
||||
async move { rx.await.unwrap() }
|
||||
}
|
||||
}
|
||||
|
||||
impl Drop for RemoteTrackPublication {
|
||||
fn drop(&mut self) {
|
||||
unsafe { CFRelease((*self.native_publication.lock()).0) }
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct RemoteAudioTrack {
|
||||
native_track: Mutex<swift::RemoteAudioTrack>,
|
||||
sid: Sid,
|
||||
publisher_id: String,
|
||||
}
|
||||
|
||||
impl RemoteAudioTrack {
|
||||
fn new(native_track: swift::RemoteAudioTrack, sid: Sid, publisher_id: String) -> Self {
|
||||
unsafe {
|
||||
CFRetain(native_track.0);
|
||||
}
|
||||
Self {
|
||||
native_track: Mutex::new(native_track),
|
||||
sid,
|
||||
publisher_id,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn sid(&self) -> &str {
|
||||
&self.sid
|
||||
}
|
||||
|
||||
pub fn publisher_id(&self) -> &str {
|
||||
&self.publisher_id
|
||||
}
|
||||
|
||||
pub fn enable(&self) -> impl Future<Output = Result<()>> {
|
||||
async { Ok(()) }
|
||||
}
|
||||
|
||||
pub fn disable(&self) -> impl Future<Output = Result<()>> {
|
||||
async { Ok(()) }
|
||||
}
|
||||
}
|
||||
|
||||
impl Drop for RemoteAudioTrack {
|
||||
fn drop(&mut self) {
|
||||
unsafe { CFRelease(self.native_track.lock().0) }
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct RemoteVideoTrack {
|
||||
native_track: Mutex<swift::RemoteVideoTrack>,
|
||||
sid: Sid,
|
||||
publisher_id: String,
|
||||
}
|
||||
|
||||
impl RemoteVideoTrack {
|
||||
fn new(native_track: swift::RemoteVideoTrack, sid: Sid, publisher_id: String) -> Self {
|
||||
unsafe {
|
||||
CFRetain(native_track.0);
|
||||
}
|
||||
Self {
|
||||
native_track: Mutex::new(native_track),
|
||||
sid,
|
||||
publisher_id,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn sid(&self) -> &str {
|
||||
&self.sid
|
||||
}
|
||||
|
||||
pub fn publisher_id(&self) -> &str {
|
||||
&self.publisher_id
|
||||
}
|
||||
|
||||
pub fn frames(&self) -> async_broadcast::Receiver<Frame> {
|
||||
extern "C" fn on_frame(callback_data: *mut c_void, frame: CVImageBufferRef) -> bool {
|
||||
unsafe {
|
||||
let tx = Box::from_raw(callback_data as *mut async_broadcast::Sender<Frame>);
|
||||
let buffer = CVImageBuffer::wrap_under_get_rule(frame);
|
||||
let result = tx.try_broadcast(Frame(buffer));
|
||||
let _ = Box::into_raw(tx);
|
||||
match result {
|
||||
Ok(_) => true,
|
||||
Err(async_broadcast::TrySendError::Closed(_))
|
||||
| Err(async_broadcast::TrySendError::Inactive(_)) => {
|
||||
log::warn!("no active receiver for frame");
|
||||
false
|
||||
}
|
||||
Err(async_broadcast::TrySendError::Full(_)) => {
|
||||
log::warn!("skipping frame as receiver is not keeping up");
|
||||
true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
extern "C" fn on_drop(callback_data: *mut c_void) {
|
||||
unsafe {
|
||||
let _ = Box::from_raw(callback_data as *mut async_broadcast::Sender<Frame>);
|
||||
}
|
||||
}
|
||||
|
||||
let (tx, rx) = async_broadcast::broadcast(64);
|
||||
unsafe {
|
||||
let renderer = LKVideoRendererCreate(
|
||||
Box::into_raw(Box::new(tx)) as *mut c_void,
|
||||
on_frame,
|
||||
on_drop,
|
||||
);
|
||||
LKVideoTrackAddRenderer(*self.native_track.lock(), renderer);
|
||||
rx
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Drop for RemoteVideoTrack {
|
||||
fn drop(&mut self) {
|
||||
unsafe { CFRelease(self.native_track.lock().0) }
|
||||
}
|
||||
}
|
||||
|
||||
pub enum RemoteVideoTrackUpdate {
|
||||
Subscribed(Arc<RemoteVideoTrack>),
|
||||
Unsubscribed { publisher_id: Sid, track_id: Sid },
|
||||
}
|
||||
|
||||
pub enum RemoteAudioTrackUpdate {
|
||||
ActiveSpeakersChanged { speakers: Vec<Sid> },
|
||||
MuteChanged { track_id: Sid, muted: bool },
|
||||
Subscribed(Arc<RemoteAudioTrack>, Arc<RemoteTrackPublication>),
|
||||
Unsubscribed { publisher_id: Sid, track_id: Sid },
|
||||
}
|
||||
|
||||
pub struct MacOSDisplay(swift::MacOSDisplay);
|
||||
|
||||
impl MacOSDisplay {
|
||||
fn new(ptr: swift::MacOSDisplay) -> Self {
|
||||
unsafe {
|
||||
CFRetain(ptr.0);
|
||||
}
|
||||
Self(ptr)
|
||||
}
|
||||
}
|
||||
|
||||
impl Drop for MacOSDisplay {
|
||||
fn drop(&mut self) {
|
||||
unsafe { CFRelease(self.0 .0) }
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct Frame(CVImageBuffer);
|
||||
|
||||
impl Frame {
|
||||
pub fn width(&self) -> usize {
|
||||
self.0.width()
|
||||
}
|
||||
|
||||
pub fn height(&self) -> usize {
|
||||
self.0.height()
|
||||
}
|
||||
|
||||
pub fn image(&self) -> CVImageBuffer {
|
||||
self.0.clone()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,651 @@
|
||||
use anyhow::{anyhow, Context, Result};
|
||||
use async_trait::async_trait;
|
||||
use collections::{BTreeMap, HashMap};
|
||||
use futures::Stream;
|
||||
use gpui2::Executor;
|
||||
use live_kit_server::token;
|
||||
use media::core_video::CVImageBuffer;
|
||||
use parking_lot::Mutex;
|
||||
use postage::watch;
|
||||
use std::{future::Future, mem, sync::Arc};
|
||||
|
||||
static SERVERS: Mutex<BTreeMap<String, Arc<TestServer>>> = Mutex::new(BTreeMap::new());
|
||||
|
||||
pub struct TestServer {
|
||||
pub url: String,
|
||||
pub api_key: String,
|
||||
pub secret_key: String,
|
||||
rooms: Mutex<HashMap<String, TestServerRoom>>,
|
||||
executor: Arc<Executor>,
|
||||
}
|
||||
|
||||
impl TestServer {
|
||||
pub fn create(
|
||||
url: String,
|
||||
api_key: String,
|
||||
secret_key: String,
|
||||
executor: Arc<Executor>,
|
||||
) -> Result<Arc<TestServer>> {
|
||||
let mut servers = SERVERS.lock();
|
||||
if servers.contains_key(&url) {
|
||||
Err(anyhow!("a server with url {:?} already exists", url))
|
||||
} else {
|
||||
let server = Arc::new(TestServer {
|
||||
url: url.clone(),
|
||||
api_key,
|
||||
secret_key,
|
||||
rooms: Default::default(),
|
||||
executor,
|
||||
});
|
||||
servers.insert(url, server.clone());
|
||||
Ok(server)
|
||||
}
|
||||
}
|
||||
|
||||
fn get(url: &str) -> Result<Arc<TestServer>> {
|
||||
Ok(SERVERS
|
||||
.lock()
|
||||
.get(url)
|
||||
.ok_or_else(|| anyhow!("no server found for url"))?
|
||||
.clone())
|
||||
}
|
||||
|
||||
pub fn teardown(&self) -> Result<()> {
|
||||
SERVERS
|
||||
.lock()
|
||||
.remove(&self.url)
|
||||
.ok_or_else(|| anyhow!("server with url {:?} does not exist", self.url))?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn create_api_client(&self) -> TestApiClient {
|
||||
TestApiClient {
|
||||
url: self.url.clone(),
|
||||
}
|
||||
}
|
||||
|
||||
pub async fn create_room(&self, room: String) -> Result<()> {
|
||||
self.executor.simulate_random_delay().await;
|
||||
let mut server_rooms = self.rooms.lock();
|
||||
if server_rooms.contains_key(&room) {
|
||||
Err(anyhow!("room {:?} already exists", room))
|
||||
} else {
|
||||
server_rooms.insert(room, Default::default());
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
async fn delete_room(&self, room: String) -> Result<()> {
|
||||
// TODO: clear state associated with all `Room`s.
|
||||
self.executor.simulate_random_delay().await;
|
||||
let mut server_rooms = self.rooms.lock();
|
||||
server_rooms
|
||||
.remove(&room)
|
||||
.ok_or_else(|| anyhow!("room {:?} does not exist", room))?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
async fn join_room(&self, token: String, client_room: Arc<Room>) -> Result<()> {
|
||||
self.executor.simulate_random_delay().await;
|
||||
let claims = live_kit_server::token::validate(&token, &self.secret_key)?;
|
||||
let identity = claims.sub.unwrap().to_string();
|
||||
let room_name = claims.video.room.unwrap();
|
||||
let mut server_rooms = self.rooms.lock();
|
||||
let room = (*server_rooms).entry(room_name.to_string()).or_default();
|
||||
|
||||
if room.client_rooms.contains_key(&identity) {
|
||||
Err(anyhow!(
|
||||
"{:?} attempted to join room {:?} twice",
|
||||
identity,
|
||||
room_name
|
||||
))
|
||||
} else {
|
||||
for track in &room.video_tracks {
|
||||
client_room
|
||||
.0
|
||||
.lock()
|
||||
.video_track_updates
|
||||
.0
|
||||
.try_broadcast(RemoteVideoTrackUpdate::Subscribed(track.clone()))
|
||||
.unwrap();
|
||||
}
|
||||
room.client_rooms.insert(identity, client_room);
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
async fn leave_room(&self, token: String) -> Result<()> {
|
||||
self.executor.simulate_random_delay().await;
|
||||
let claims = live_kit_server::token::validate(&token, &self.secret_key)?;
|
||||
let identity = claims.sub.unwrap().to_string();
|
||||
let room_name = claims.video.room.unwrap();
|
||||
let mut server_rooms = self.rooms.lock();
|
||||
let room = server_rooms
|
||||
.get_mut(&*room_name)
|
||||
.ok_or_else(|| anyhow!("room {} does not exist", room_name))?;
|
||||
room.client_rooms.remove(&identity).ok_or_else(|| {
|
||||
anyhow!(
|
||||
"{:?} attempted to leave room {:?} before joining it",
|
||||
identity,
|
||||
room_name
|
||||
)
|
||||
})?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
async fn remove_participant(&self, room_name: String, identity: String) -> Result<()> {
|
||||
// TODO: clear state associated with the `Room`.
|
||||
|
||||
self.executor.simulate_random_delay().await;
|
||||
let mut server_rooms = self.rooms.lock();
|
||||
let room = server_rooms
|
||||
.get_mut(&room_name)
|
||||
.ok_or_else(|| anyhow!("room {} does not exist", room_name))?;
|
||||
room.client_rooms.remove(&identity).ok_or_else(|| {
|
||||
anyhow!(
|
||||
"participant {:?} did not join room {:?}",
|
||||
identity,
|
||||
room_name
|
||||
)
|
||||
})?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub async fn disconnect_client(&self, client_identity: String) {
|
||||
self.executor.simulate_random_delay().await;
|
||||
let mut server_rooms = self.rooms.lock();
|
||||
for room in server_rooms.values_mut() {
|
||||
if let Some(room) = room.client_rooms.remove(&client_identity) {
|
||||
*room.0.lock().connection.0.borrow_mut() = ConnectionState::Disconnected;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async fn publish_video_track(&self, token: String, local_track: LocalVideoTrack) -> Result<()> {
|
||||
self.executor.simulate_random_delay().await;
|
||||
let claims = live_kit_server::token::validate(&token, &self.secret_key)?;
|
||||
let identity = claims.sub.unwrap().to_string();
|
||||
let room_name = claims.video.room.unwrap();
|
||||
|
||||
let mut server_rooms = self.rooms.lock();
|
||||
let room = server_rooms
|
||||
.get_mut(&*room_name)
|
||||
.ok_or_else(|| anyhow!("room {} does not exist", room_name))?;
|
||||
|
||||
let track = Arc::new(RemoteVideoTrack {
|
||||
sid: nanoid::nanoid!(17),
|
||||
publisher_id: identity.clone(),
|
||||
frames_rx: local_track.frames_rx.clone(),
|
||||
});
|
||||
|
||||
room.video_tracks.push(track.clone());
|
||||
|
||||
for (id, client_room) in &room.client_rooms {
|
||||
if *id != identity {
|
||||
let _ = client_room
|
||||
.0
|
||||
.lock()
|
||||
.video_track_updates
|
||||
.0
|
||||
.try_broadcast(RemoteVideoTrackUpdate::Subscribed(track.clone()))
|
||||
.unwrap();
|
||||
}
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
async fn publish_audio_track(
|
||||
&self,
|
||||
token: String,
|
||||
_local_track: &LocalAudioTrack,
|
||||
) -> Result<()> {
|
||||
self.executor.simulate_random_delay().await;
|
||||
let claims = live_kit_server::token::validate(&token, &self.secret_key)?;
|
||||
let identity = claims.sub.unwrap().to_string();
|
||||
let room_name = claims.video.room.unwrap();
|
||||
|
||||
let mut server_rooms = self.rooms.lock();
|
||||
let room = server_rooms
|
||||
.get_mut(&*room_name)
|
||||
.ok_or_else(|| anyhow!("room {} does not exist", room_name))?;
|
||||
|
||||
let track = Arc::new(RemoteAudioTrack {
|
||||
sid: nanoid::nanoid!(17),
|
||||
publisher_id: identity.clone(),
|
||||
});
|
||||
|
||||
let publication = Arc::new(RemoteTrackPublication);
|
||||
|
||||
room.audio_tracks.push(track.clone());
|
||||
|
||||
for (id, client_room) in &room.client_rooms {
|
||||
if *id != identity {
|
||||
let _ = client_room
|
||||
.0
|
||||
.lock()
|
||||
.audio_track_updates
|
||||
.0
|
||||
.try_broadcast(RemoteAudioTrackUpdate::Subscribed(
|
||||
track.clone(),
|
||||
publication.clone(),
|
||||
))
|
||||
.unwrap();
|
||||
}
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn video_tracks(&self, token: String) -> Result<Vec<Arc<RemoteVideoTrack>>> {
|
||||
let claims = live_kit_server::token::validate(&token, &self.secret_key)?;
|
||||
let room_name = claims.video.room.unwrap();
|
||||
|
||||
let mut server_rooms = self.rooms.lock();
|
||||
let room = server_rooms
|
||||
.get_mut(&*room_name)
|
||||
.ok_or_else(|| anyhow!("room {} does not exist", room_name))?;
|
||||
Ok(room.video_tracks.clone())
|
||||
}
|
||||
|
||||
fn audio_tracks(&self, token: String) -> Result<Vec<Arc<RemoteAudioTrack>>> {
|
||||
let claims = live_kit_server::token::validate(&token, &self.secret_key)?;
|
||||
let room_name = claims.video.room.unwrap();
|
||||
|
||||
let mut server_rooms = self.rooms.lock();
|
||||
let room = server_rooms
|
||||
.get_mut(&*room_name)
|
||||
.ok_or_else(|| anyhow!("room {} does not exist", room_name))?;
|
||||
Ok(room.audio_tracks.clone())
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Default)]
|
||||
struct TestServerRoom {
|
||||
client_rooms: HashMap<Sid, Arc<Room>>,
|
||||
video_tracks: Vec<Arc<RemoteVideoTrack>>,
|
||||
audio_tracks: Vec<Arc<RemoteAudioTrack>>,
|
||||
}
|
||||
|
||||
impl TestServerRoom {}
|
||||
|
||||
pub struct TestApiClient {
|
||||
url: String,
|
||||
}
|
||||
|
||||
#[async_trait]
|
||||
impl live_kit_server::api::Client for TestApiClient {
|
||||
fn url(&self) -> &str {
|
||||
&self.url
|
||||
}
|
||||
|
||||
async fn create_room(&self, name: String) -> Result<()> {
|
||||
let server = TestServer::get(&self.url)?;
|
||||
server.create_room(name).await?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
async fn delete_room(&self, name: String) -> Result<()> {
|
||||
let server = TestServer::get(&self.url)?;
|
||||
server.delete_room(name).await?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
async fn remove_participant(&self, room: String, identity: String) -> Result<()> {
|
||||
let server = TestServer::get(&self.url)?;
|
||||
server.remove_participant(room, identity).await?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn room_token(&self, room: &str, identity: &str) -> Result<String> {
|
||||
let server = TestServer::get(&self.url)?;
|
||||
token::create(
|
||||
&server.api_key,
|
||||
&server.secret_key,
|
||||
Some(identity),
|
||||
token::VideoGrant::to_join(room),
|
||||
)
|
||||
}
|
||||
|
||||
fn guest_token(&self, room: &str, identity: &str) -> Result<String> {
|
||||
let server = TestServer::get(&self.url)?;
|
||||
token::create(
|
||||
&server.api_key,
|
||||
&server.secret_key,
|
||||
Some(identity),
|
||||
token::VideoGrant::for_guest(room),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
pub type Sid = String;
|
||||
|
||||
struct RoomState {
|
||||
connection: (
|
||||
watch::Sender<ConnectionState>,
|
||||
watch::Receiver<ConnectionState>,
|
||||
),
|
||||
display_sources: Vec<MacOSDisplay>,
|
||||
audio_track_updates: (
|
||||
async_broadcast::Sender<RemoteAudioTrackUpdate>,
|
||||
async_broadcast::Receiver<RemoteAudioTrackUpdate>,
|
||||
),
|
||||
video_track_updates: (
|
||||
async_broadcast::Sender<RemoteVideoTrackUpdate>,
|
||||
async_broadcast::Receiver<RemoteVideoTrackUpdate>,
|
||||
),
|
||||
}
|
||||
|
||||
#[derive(Clone, Eq, PartialEq)]
|
||||
pub enum ConnectionState {
|
||||
Disconnected,
|
||||
Connected { url: String, token: String },
|
||||
}
|
||||
|
||||
pub struct Room(Mutex<RoomState>);
|
||||
|
||||
impl Room {
|
||||
pub fn new() -> Arc<Self> {
|
||||
Arc::new(Self(Mutex::new(RoomState {
|
||||
connection: watch::channel_with(ConnectionState::Disconnected),
|
||||
display_sources: Default::default(),
|
||||
video_track_updates: async_broadcast::broadcast(128),
|
||||
audio_track_updates: async_broadcast::broadcast(128),
|
||||
})))
|
||||
}
|
||||
|
||||
pub fn status(&self) -> watch::Receiver<ConnectionState> {
|
||||
self.0.lock().connection.1.clone()
|
||||
}
|
||||
|
||||
pub fn connect(self: &Arc<Self>, url: &str, token: &str) -> impl Future<Output = Result<()>> {
|
||||
let this = self.clone();
|
||||
let url = url.to_string();
|
||||
let token = token.to_string();
|
||||
async move {
|
||||
let server = TestServer::get(&url)?;
|
||||
server
|
||||
.join_room(token.clone(), this.clone())
|
||||
.await
|
||||
.context("room join")?;
|
||||
*this.0.lock().connection.0.borrow_mut() = ConnectionState::Connected { url, token };
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
pub fn display_sources(self: &Arc<Self>) -> impl Future<Output = Result<Vec<MacOSDisplay>>> {
|
||||
let this = self.clone();
|
||||
async move {
|
||||
let server = this.test_server();
|
||||
server.executor.simulate_random_delay().await;
|
||||
Ok(this.0.lock().display_sources.clone())
|
||||
}
|
||||
}
|
||||
|
||||
pub fn publish_video_track(
|
||||
self: &Arc<Self>,
|
||||
track: LocalVideoTrack,
|
||||
) -> impl Future<Output = Result<LocalTrackPublication>> {
|
||||
let this = self.clone();
|
||||
let track = track.clone();
|
||||
async move {
|
||||
this.test_server()
|
||||
.publish_video_track(this.token(), track)
|
||||
.await?;
|
||||
Ok(LocalTrackPublication)
|
||||
}
|
||||
}
|
||||
pub fn publish_audio_track(
|
||||
self: &Arc<Self>,
|
||||
track: LocalAudioTrack,
|
||||
) -> impl Future<Output = Result<LocalTrackPublication>> {
|
||||
let this = self.clone();
|
||||
let track = track.clone();
|
||||
async move {
|
||||
this.test_server()
|
||||
.publish_audio_track(this.token(), &track)
|
||||
.await?;
|
||||
Ok(LocalTrackPublication)
|
||||
}
|
||||
}
|
||||
|
||||
pub fn unpublish_track(&self, _publication: LocalTrackPublication) {}
|
||||
|
||||
pub fn remote_audio_tracks(&self, publisher_id: &str) -> Vec<Arc<RemoteAudioTrack>> {
|
||||
if !self.is_connected() {
|
||||
return Vec::new();
|
||||
}
|
||||
|
||||
self.test_server()
|
||||
.audio_tracks(self.token())
|
||||
.unwrap()
|
||||
.into_iter()
|
||||
.filter(|track| track.publisher_id() == publisher_id)
|
||||
.collect()
|
||||
}
|
||||
|
||||
pub fn remote_audio_track_publications(
|
||||
&self,
|
||||
publisher_id: &str,
|
||||
) -> Vec<Arc<RemoteTrackPublication>> {
|
||||
if !self.is_connected() {
|
||||
return Vec::new();
|
||||
}
|
||||
|
||||
self.test_server()
|
||||
.audio_tracks(self.token())
|
||||
.unwrap()
|
||||
.into_iter()
|
||||
.filter(|track| track.publisher_id() == publisher_id)
|
||||
.map(|_track| Arc::new(RemoteTrackPublication {}))
|
||||
.collect()
|
||||
}
|
||||
|
||||
pub fn remote_video_tracks(&self, publisher_id: &str) -> Vec<Arc<RemoteVideoTrack>> {
|
||||
if !self.is_connected() {
|
||||
return Vec::new();
|
||||
}
|
||||
|
||||
self.test_server()
|
||||
.video_tracks(self.token())
|
||||
.unwrap()
|
||||
.into_iter()
|
||||
.filter(|track| track.publisher_id() == publisher_id)
|
||||
.collect()
|
||||
}
|
||||
|
||||
pub fn remote_audio_track_updates(&self) -> impl Stream<Item = RemoteAudioTrackUpdate> {
|
||||
self.0.lock().audio_track_updates.1.clone()
|
||||
}
|
||||
|
||||
pub fn remote_video_track_updates(&self) -> impl Stream<Item = RemoteVideoTrackUpdate> {
|
||||
self.0.lock().video_track_updates.1.clone()
|
||||
}
|
||||
|
||||
pub fn set_display_sources(&self, sources: Vec<MacOSDisplay>) {
|
||||
self.0.lock().display_sources = sources;
|
||||
}
|
||||
|
||||
fn test_server(&self) -> Arc<TestServer> {
|
||||
match self.0.lock().connection.1.borrow().clone() {
|
||||
ConnectionState::Disconnected => panic!("must be connected to call this method"),
|
||||
ConnectionState::Connected { url, .. } => TestServer::get(&url).unwrap(),
|
||||
}
|
||||
}
|
||||
|
||||
fn token(&self) -> String {
|
||||
match self.0.lock().connection.1.borrow().clone() {
|
||||
ConnectionState::Disconnected => panic!("must be connected to call this method"),
|
||||
ConnectionState::Connected { token, .. } => token,
|
||||
}
|
||||
}
|
||||
|
||||
fn is_connected(&self) -> bool {
|
||||
match *self.0.lock().connection.1.borrow() {
|
||||
ConnectionState::Disconnected => false,
|
||||
ConnectionState::Connected { .. } => true,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Drop for Room {
|
||||
fn drop(&mut self) {
|
||||
if let ConnectionState::Connected { token, .. } = mem::replace(
|
||||
&mut *self.0.lock().connection.0.borrow_mut(),
|
||||
ConnectionState::Disconnected,
|
||||
) {
|
||||
if let Ok(server) = TestServer::get(&token) {
|
||||
let executor = server.executor.clone();
|
||||
executor
|
||||
.spawn(async move { server.leave_room(token).await.unwrap() })
|
||||
.detach();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub struct LocalTrackPublication;
|
||||
|
||||
impl LocalTrackPublication {
|
||||
pub fn set_mute(&self, _mute: bool) -> impl Future<Output = Result<()>> {
|
||||
async { Ok(()) }
|
||||
}
|
||||
}
|
||||
|
||||
pub struct RemoteTrackPublication;
|
||||
|
||||
impl RemoteTrackPublication {
|
||||
pub fn set_enabled(&self, _enabled: bool) -> impl Future<Output = Result<()>> {
|
||||
async { Ok(()) }
|
||||
}
|
||||
|
||||
pub fn is_muted(&self) -> bool {
|
||||
false
|
||||
}
|
||||
|
||||
pub fn sid(&self) -> String {
|
||||
"".to_string()
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct LocalVideoTrack {
|
||||
frames_rx: async_broadcast::Receiver<Frame>,
|
||||
}
|
||||
|
||||
impl LocalVideoTrack {
|
||||
pub fn screen_share_for_display(display: &MacOSDisplay) -> Self {
|
||||
Self {
|
||||
frames_rx: display.frames.1.clone(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct LocalAudioTrack;
|
||||
|
||||
impl LocalAudioTrack {
|
||||
pub fn create() -> Self {
|
||||
Self
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct RemoteVideoTrack {
|
||||
sid: Sid,
|
||||
publisher_id: Sid,
|
||||
frames_rx: async_broadcast::Receiver<Frame>,
|
||||
}
|
||||
|
||||
impl RemoteVideoTrack {
|
||||
pub fn sid(&self) -> &str {
|
||||
&self.sid
|
||||
}
|
||||
|
||||
pub fn publisher_id(&self) -> &str {
|
||||
&self.publisher_id
|
||||
}
|
||||
|
||||
pub fn frames(&self) -> async_broadcast::Receiver<Frame> {
|
||||
self.frames_rx.clone()
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct RemoteAudioTrack {
|
||||
sid: Sid,
|
||||
publisher_id: Sid,
|
||||
}
|
||||
|
||||
impl RemoteAudioTrack {
|
||||
pub fn sid(&self) -> &str {
|
||||
&self.sid
|
||||
}
|
||||
|
||||
pub fn publisher_id(&self) -> &str {
|
||||
&self.publisher_id
|
||||
}
|
||||
|
||||
pub fn enable(&self) -> impl Future<Output = Result<()>> {
|
||||
async { Ok(()) }
|
||||
}
|
||||
|
||||
pub fn disable(&self) -> impl Future<Output = Result<()>> {
|
||||
async { Ok(()) }
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
pub enum RemoteVideoTrackUpdate {
|
||||
Subscribed(Arc<RemoteVideoTrack>),
|
||||
Unsubscribed { publisher_id: Sid, track_id: Sid },
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
pub enum RemoteAudioTrackUpdate {
|
||||
ActiveSpeakersChanged { speakers: Vec<Sid> },
|
||||
MuteChanged { track_id: Sid, muted: bool },
|
||||
Subscribed(Arc<RemoteAudioTrack>, Arc<RemoteTrackPublication>),
|
||||
Unsubscribed { publisher_id: Sid, track_id: Sid },
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct MacOSDisplay {
|
||||
frames: (
|
||||
async_broadcast::Sender<Frame>,
|
||||
async_broadcast::Receiver<Frame>,
|
||||
),
|
||||
}
|
||||
|
||||
impl MacOSDisplay {
|
||||
pub fn new() -> Self {
|
||||
Self {
|
||||
frames: async_broadcast::broadcast(128),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn send_frame(&self, frame: Frame) {
|
||||
self.frames.0.try_broadcast(frame).unwrap();
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||
pub struct Frame {
|
||||
pub label: String,
|
||||
pub width: usize,
|
||||
pub height: usize,
|
||||
}
|
||||
|
||||
impl Frame {
|
||||
pub fn width(&self) -> usize {
|
||||
self.width
|
||||
}
|
||||
|
||||
pub fn height(&self) -> usize {
|
||||
self.height
|
||||
}
|
||||
|
||||
pub fn image(&self) -> CVImageBuffer {
|
||||
unimplemented!("you can't call this in test mode")
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
[package]
|
||||
name = "multi_buffer2"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
publish = false
|
||||
|
||||
[lib]
|
||||
path = "src/multi_buffer2.rs"
|
||||
doctest = false
|
||||
|
||||
[features]
|
||||
test-support = [
|
||||
"copilot2/test-support",
|
||||
"text/test-support",
|
||||
"language2/test-support",
|
||||
"gpui2/test-support",
|
||||
"util/test-support",
|
||||
"tree-sitter-rust",
|
||||
"tree-sitter-typescript"
|
||||
]
|
||||
|
||||
[dependencies]
|
||||
client2 = { path = "../client2" }
|
||||
clock = { path = "../clock" }
|
||||
collections = { path = "../collections" }
|
||||
git = { path = "../git" }
|
||||
gpui2 = { path = "../gpui2" }
|
||||
language2 = { path = "../language2" }
|
||||
lsp2 = { path = "../lsp2" }
|
||||
rich_text = { path = "../rich_text" }
|
||||
settings2 = { path = "../settings2" }
|
||||
snippet = { path = "../snippet" }
|
||||
sum_tree = { path = "../sum_tree" }
|
||||
text = { path = "../text" }
|
||||
theme2 = { path = "../theme2" }
|
||||
util = { path = "../util" }
|
||||
|
||||
aho-corasick = "1.1"
|
||||
anyhow.workspace = true
|
||||
convert_case = "0.6.0"
|
||||
futures.workspace = true
|
||||
indoc = "1.0.4"
|
||||
itertools = "0.10"
|
||||
lazy_static.workspace = true
|
||||
log.workspace = true
|
||||
ordered-float.workspace = true
|
||||
parking_lot.workspace = true
|
||||
postage.workspace = true
|
||||
pulldown-cmark = { version = "0.9.2", default-features = false }
|
||||
rand.workspace = true
|
||||
schemars.workspace = true
|
||||
serde.workspace = true
|
||||
serde_derive.workspace = true
|
||||
smallvec.workspace = true
|
||||
smol.workspace = true
|
||||
|
||||
tree-sitter-rust = { workspace = true, optional = true }
|
||||
tree-sitter-html = { workspace = true, optional = true }
|
||||
tree-sitter-typescript = { workspace = true, optional = true }
|
||||
|
||||
[dev-dependencies]
|
||||
copilot2 = { path = "../copilot2", features = ["test-support"] }
|
||||
text = { path = "../text", features = ["test-support"] }
|
||||
language2 = { path = "../language2", features = ["test-support"] }
|
||||
lsp2 = { path = "../lsp2", features = ["test-support"] }
|
||||
gpui2 = { path = "../gpui2", features = ["test-support"] }
|
||||
util = { path = "../util", features = ["test-support"] }
|
||||
project2 = { path = "../project2", features = ["test-support"] }
|
||||
settings2 = { path = "../settings2", features = ["test-support"] }
|
||||
|
||||
ctor.workspace = true
|
||||
env_logger.workspace = true
|
||||
rand.workspace = true
|
||||
unindent.workspace = true
|
||||
tree-sitter.workspace = true
|
||||
tree-sitter-rust.workspace = true
|
||||
tree-sitter-html.workspace = true
|
||||
tree-sitter-typescript.workspace = true
|
||||
@@ -0,0 +1,138 @@
|
||||
use super::{ExcerptId, MultiBufferSnapshot, ToOffset, ToOffsetUtf16, ToPoint};
|
||||
use language2::{OffsetUtf16, Point, TextDimension};
|
||||
use std::{
|
||||
cmp::Ordering,
|
||||
ops::{Range, Sub},
|
||||
};
|
||||
use sum_tree::Bias;
|
||||
|
||||
#[derive(Clone, Copy, Eq, PartialEq, Debug, Hash)]
|
||||
pub struct Anchor {
|
||||
pub buffer_id: Option<u64>,
|
||||
pub excerpt_id: ExcerptId,
|
||||
pub text_anchor: text::Anchor,
|
||||
}
|
||||
|
||||
impl Anchor {
|
||||
pub fn min() -> Self {
|
||||
Self {
|
||||
buffer_id: None,
|
||||
excerpt_id: ExcerptId::min(),
|
||||
text_anchor: text::Anchor::MIN,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn max() -> Self {
|
||||
Self {
|
||||
buffer_id: None,
|
||||
excerpt_id: ExcerptId::max(),
|
||||
text_anchor: text::Anchor::MAX,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn cmp(&self, other: &Anchor, snapshot: &MultiBufferSnapshot) -> Ordering {
|
||||
let excerpt_id_cmp = self.excerpt_id.cmp(&other.excerpt_id, snapshot);
|
||||
if excerpt_id_cmp.is_eq() {
|
||||
if self.excerpt_id == ExcerptId::min() || self.excerpt_id == ExcerptId::max() {
|
||||
Ordering::Equal
|
||||
} else if let Some(excerpt) = snapshot.excerpt(self.excerpt_id) {
|
||||
self.text_anchor.cmp(&other.text_anchor, &excerpt.buffer)
|
||||
} else {
|
||||
Ordering::Equal
|
||||
}
|
||||
} else {
|
||||
excerpt_id_cmp
|
||||
}
|
||||
}
|
||||
|
||||
pub fn bias(&self) -> Bias {
|
||||
self.text_anchor.bias
|
||||
}
|
||||
|
||||
pub fn bias_left(&self, snapshot: &MultiBufferSnapshot) -> Anchor {
|
||||
if self.text_anchor.bias != Bias::Left {
|
||||
if let Some(excerpt) = snapshot.excerpt(self.excerpt_id) {
|
||||
return Self {
|
||||
buffer_id: self.buffer_id,
|
||||
excerpt_id: self.excerpt_id.clone(),
|
||||
text_anchor: self.text_anchor.bias_left(&excerpt.buffer),
|
||||
};
|
||||
}
|
||||
}
|
||||
self.clone()
|
||||
}
|
||||
|
||||
pub fn bias_right(&self, snapshot: &MultiBufferSnapshot) -> Anchor {
|
||||
if self.text_anchor.bias != Bias::Right {
|
||||
if let Some(excerpt) = snapshot.excerpt(self.excerpt_id) {
|
||||
return Self {
|
||||
buffer_id: self.buffer_id,
|
||||
excerpt_id: self.excerpt_id.clone(),
|
||||
text_anchor: self.text_anchor.bias_right(&excerpt.buffer),
|
||||
};
|
||||
}
|
||||
}
|
||||
self.clone()
|
||||
}
|
||||
|
||||
pub fn summary<D>(&self, snapshot: &MultiBufferSnapshot) -> D
|
||||
where
|
||||
D: TextDimension + Ord + Sub<D, Output = D>,
|
||||
{
|
||||
snapshot.summary_for_anchor(self)
|
||||
}
|
||||
|
||||
pub fn is_valid(&self, snapshot: &MultiBufferSnapshot) -> bool {
|
||||
if *self == Anchor::min() || *self == Anchor::max() {
|
||||
true
|
||||
} else if let Some(excerpt) = snapshot.excerpt(self.excerpt_id) {
|
||||
excerpt.contains(self)
|
||||
&& (self.text_anchor == excerpt.range.context.start
|
||||
|| self.text_anchor == excerpt.range.context.end
|
||||
|| self.text_anchor.is_valid(&excerpt.buffer))
|
||||
} else {
|
||||
false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl ToOffset for Anchor {
|
||||
fn to_offset(&self, snapshot: &MultiBufferSnapshot) -> usize {
|
||||
self.summary(snapshot)
|
||||
}
|
||||
}
|
||||
|
||||
impl ToOffsetUtf16 for Anchor {
|
||||
fn to_offset_utf16(&self, snapshot: &MultiBufferSnapshot) -> OffsetUtf16 {
|
||||
self.summary(snapshot)
|
||||
}
|
||||
}
|
||||
|
||||
impl ToPoint for Anchor {
|
||||
fn to_point<'a>(&self, snapshot: &MultiBufferSnapshot) -> Point {
|
||||
self.summary(snapshot)
|
||||
}
|
||||
}
|
||||
|
||||
pub trait AnchorRangeExt {
|
||||
fn cmp(&self, b: &Range<Anchor>, buffer: &MultiBufferSnapshot) -> Ordering;
|
||||
fn to_offset(&self, content: &MultiBufferSnapshot) -> Range<usize>;
|
||||
fn to_point(&self, content: &MultiBufferSnapshot) -> Range<Point>;
|
||||
}
|
||||
|
||||
impl AnchorRangeExt for Range<Anchor> {
|
||||
fn cmp(&self, other: &Range<Anchor>, buffer: &MultiBufferSnapshot) -> Ordering {
|
||||
match self.start.cmp(&other.start, buffer) {
|
||||
Ordering::Equal => other.end.cmp(&self.end, buffer),
|
||||
ord => ord,
|
||||
}
|
||||
}
|
||||
|
||||
fn to_offset(&self, content: &MultiBufferSnapshot) -> Range<usize> {
|
||||
self.start.to_offset(content)..self.end.to_offset(content)
|
||||
}
|
||||
|
||||
fn to_point(&self, content: &MultiBufferSnapshot) -> Range<Point> {
|
||||
self.start.to_point(content)..self.end.to_point(content)
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,5 +1,6 @@
|
||||
use crate::story::Story;
|
||||
use gpui2::{px, Div, Render};
|
||||
use theme2::{default_color_scales, ColorScaleStep};
|
||||
use ui::prelude::*;
|
||||
|
||||
pub struct ColorsStory;
|
||||
@@ -8,7 +9,7 @@ impl Render for ColorsStory {
|
||||
type Element = Div<Self>;
|
||||
|
||||
fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Element {
|
||||
let color_scales = theme2::default_color_scales();
|
||||
let color_scales = default_color_scales();
|
||||
|
||||
Story::container(cx)
|
||||
.child(Story::title(cx, "Colors"))
|
||||
@@ -20,18 +21,23 @@ impl Render for ColorsStory {
|
||||
.gap_1()
|
||||
.overflow_y_scroll()
|
||||
.text_color(gpui2::white())
|
||||
.children(color_scales.into_iter().map(|(name, scale)| {
|
||||
.children(color_scales.into_iter().map(|scale| {
|
||||
div()
|
||||
.flex()
|
||||
.child(
|
||||
div()
|
||||
.w(px(75.))
|
||||
.line_height(px(24.))
|
||||
.child(name.to_string()),
|
||||
.child(scale.name().to_string()),
|
||||
)
|
||||
.child(
|
||||
div()
|
||||
.flex()
|
||||
.gap_1()
|
||||
.children(ColorScaleStep::ALL.map(|step| {
|
||||
div().flex().size_6().bg(scale.step(cx, step))
|
||||
})),
|
||||
)
|
||||
.child(div().flex().gap_1().children(
|
||||
(1..=12).map(|step| div().flex().size_6().bg(scale.step(cx, step))),
|
||||
))
|
||||
})),
|
||||
)
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ use gpui2::{
|
||||
StatelessInteractive, Styled, View, VisualContext, WindowContext,
|
||||
};
|
||||
use serde::Deserialize;
|
||||
use theme2::theme;
|
||||
use theme2::ActiveTheme;
|
||||
|
||||
#[derive(Clone, Default, PartialEq, Deserialize)]
|
||||
struct ActionA;
|
||||
@@ -34,13 +34,13 @@ impl Render for FocusStory {
|
||||
type Element = Div<Self, StatefulInteraction<Self>, FocusEnabled<Self>>;
|
||||
|
||||
fn render(&mut self, cx: &mut gpui2::ViewContext<Self>) -> Self::Element {
|
||||
let theme = theme(cx);
|
||||
let color_1 = theme.git_created;
|
||||
let color_2 = theme.git_modified;
|
||||
let color_3 = theme.git_deleted;
|
||||
let color_4 = theme.git_conflict;
|
||||
let color_5 = theme.git_ignored;
|
||||
let color_6 = theme.git_renamed;
|
||||
let theme = cx.theme();
|
||||
let color_1 = theme.styles.git.created;
|
||||
let color_2 = theme.styles.git.modified;
|
||||
let color_3 = theme.styles.git.deleted;
|
||||
let color_4 = theme.styles.git.conflict;
|
||||
let color_5 = theme.styles.git.ignored;
|
||||
let color_6 = theme.styles.git.renamed;
|
||||
let child_1 = cx.focus_handle();
|
||||
let child_2 = cx.focus_handle();
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ use gpui2::{
|
||||
div, px, Component, Div, ParentElement, Render, SharedString, StatefulInteraction, Styled,
|
||||
View, VisualContext, WindowContext,
|
||||
};
|
||||
use theme2::theme;
|
||||
use theme2::ActiveTheme;
|
||||
|
||||
pub struct ScrollStory;
|
||||
|
||||
@@ -16,13 +16,13 @@ impl Render for ScrollStory {
|
||||
type Element = Div<Self, StatefulInteraction<Self>>;
|
||||
|
||||
fn render(&mut self, cx: &mut gpui2::ViewContext<Self>) -> Self::Element {
|
||||
let theme = theme(cx);
|
||||
let color_1 = theme.git_created;
|
||||
let color_2 = theme.git_modified;
|
||||
let theme = cx.theme();
|
||||
let color_1 = theme.styles.git.created;
|
||||
let color_2 = theme.styles.git.modified;
|
||||
|
||||
div()
|
||||
.id("parent")
|
||||
.bg(theme.background)
|
||||
.bg(theme.colors().background)
|
||||
.size_full()
|
||||
.overflow_scroll()
|
||||
.children((0..10).map(|row| {
|
||||
|
||||
@@ -48,7 +48,7 @@ fn main() {
|
||||
let args = Args::parse();
|
||||
|
||||
let story_selector = args.story.clone();
|
||||
let theme_name = args.theme.unwrap_or("One Dark".to_string());
|
||||
let theme_name = args.theme.unwrap_or("Zed Pro Moonlight".to_string());
|
||||
|
||||
let asset_source = Arc::new(Assets);
|
||||
gpui2::App::production(asset_source).run(move |cx| {
|
||||
@@ -71,7 +71,6 @@ fn main() {
|
||||
theme_settings.active_theme = theme_registry.get(&theme_name).unwrap();
|
||||
ThemeSettings::override_global(theme_settings, cx);
|
||||
|
||||
cx.set_global(theme.clone());
|
||||
ui::settings::init(cx);
|
||||
|
||||
let window = cx.open_window(
|
||||
@@ -82,7 +81,12 @@ fn main() {
|
||||
}),
|
||||
..Default::default()
|
||||
},
|
||||
move |cx| cx.build_view(|cx| StoryWrapper::new(selector.story(cx))),
|
||||
move |cx| {
|
||||
let theme_settings = ThemeSettings::get_global(cx);
|
||||
cx.set_rem_size(theme_settings.ui_font_size);
|
||||
|
||||
cx.build_view(|cx| StoryWrapper::new(selector.story(cx)))
|
||||
},
|
||||
);
|
||||
|
||||
cx.activate(true);
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
[package]
|
||||
name = "text2"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
publish = false
|
||||
|
||||
[lib]
|
||||
path = "src/text2.rs"
|
||||
doctest = false
|
||||
|
||||
[features]
|
||||
test-support = ["rand"]
|
||||
|
||||
[dependencies]
|
||||
clock = { path = "../clock" }
|
||||
collections = { path = "../collections" }
|
||||
rope = { path = "../rope" }
|
||||
sum_tree = { path = "../sum_tree" }
|
||||
util = { path = "../util" }
|
||||
|
||||
anyhow.workspace = true
|
||||
digest = { version = "0.9", features = ["std"] }
|
||||
lazy_static.workspace = true
|
||||
log.workspace = true
|
||||
parking_lot.workspace = true
|
||||
postage.workspace = true
|
||||
rand = { workspace = true, optional = true }
|
||||
smallvec.workspace = true
|
||||
regex.workspace = true
|
||||
|
||||
[dev-dependencies]
|
||||
collections = { path = "../collections", features = ["test-support"] }
|
||||
gpui2 = { path = "../gpui2", features = ["test-support"] }
|
||||
util = { path = "../util", features = ["test-support"] }
|
||||
ctor.workspace = true
|
||||
env_logger.workspace = true
|
||||
rand.workspace = true
|
||||
@@ -0,0 +1,144 @@
|
||||
use crate::{
|
||||
locator::Locator, BufferSnapshot, Point, PointUtf16, TextDimension, ToOffset, ToPoint,
|
||||
ToPointUtf16,
|
||||
};
|
||||
use anyhow::Result;
|
||||
use std::{cmp::Ordering, fmt::Debug, ops::Range};
|
||||
use sum_tree::Bias;
|
||||
|
||||
#[derive(Copy, Clone, Eq, PartialEq, Debug, Hash, Default)]
|
||||
pub struct Anchor {
|
||||
pub timestamp: clock::Lamport,
|
||||
pub offset: usize,
|
||||
pub bias: Bias,
|
||||
pub buffer_id: Option<u64>,
|
||||
}
|
||||
|
||||
impl Anchor {
|
||||
pub const MIN: Self = Self {
|
||||
timestamp: clock::Lamport::MIN,
|
||||
offset: usize::MIN,
|
||||
bias: Bias::Left,
|
||||
buffer_id: None,
|
||||
};
|
||||
|
||||
pub const MAX: Self = Self {
|
||||
timestamp: clock::Lamport::MAX,
|
||||
offset: usize::MAX,
|
||||
bias: Bias::Right,
|
||||
buffer_id: None,
|
||||
};
|
||||
|
||||
pub fn cmp(&self, other: &Anchor, buffer: &BufferSnapshot) -> Ordering {
|
||||
let fragment_id_comparison = if self.timestamp == other.timestamp {
|
||||
Ordering::Equal
|
||||
} else {
|
||||
buffer
|
||||
.fragment_id_for_anchor(self)
|
||||
.cmp(buffer.fragment_id_for_anchor(other))
|
||||
};
|
||||
|
||||
fragment_id_comparison
|
||||
.then_with(|| self.offset.cmp(&other.offset))
|
||||
.then_with(|| self.bias.cmp(&other.bias))
|
||||
}
|
||||
|
||||
pub fn min(&self, other: &Self, buffer: &BufferSnapshot) -> Self {
|
||||
if self.cmp(other, buffer).is_le() {
|
||||
*self
|
||||
} else {
|
||||
*other
|
||||
}
|
||||
}
|
||||
|
||||
pub fn max(&self, other: &Self, buffer: &BufferSnapshot) -> Self {
|
||||
if self.cmp(other, buffer).is_ge() {
|
||||
*self
|
||||
} else {
|
||||
*other
|
||||
}
|
||||
}
|
||||
|
||||
pub fn bias(&self, bias: Bias, buffer: &BufferSnapshot) -> Anchor {
|
||||
if bias == Bias::Left {
|
||||
self.bias_left(buffer)
|
||||
} else {
|
||||
self.bias_right(buffer)
|
||||
}
|
||||
}
|
||||
|
||||
pub fn bias_left(&self, buffer: &BufferSnapshot) -> Anchor {
|
||||
if self.bias == Bias::Left {
|
||||
*self
|
||||
} else {
|
||||
buffer.anchor_before(self)
|
||||
}
|
||||
}
|
||||
|
||||
pub fn bias_right(&self, buffer: &BufferSnapshot) -> Anchor {
|
||||
if self.bias == Bias::Right {
|
||||
*self
|
||||
} else {
|
||||
buffer.anchor_after(self)
|
||||
}
|
||||
}
|
||||
|
||||
pub fn summary<D>(&self, content: &BufferSnapshot) -> D
|
||||
where
|
||||
D: TextDimension,
|
||||
{
|
||||
content.summary_for_anchor(self)
|
||||
}
|
||||
|
||||
/// Returns true when the [Anchor] is located inside a visible fragment.
|
||||
pub fn is_valid(&self, buffer: &BufferSnapshot) -> bool {
|
||||
if *self == Anchor::MIN || *self == Anchor::MAX {
|
||||
true
|
||||
} else {
|
||||
let fragment_id = buffer.fragment_id_for_anchor(self);
|
||||
let mut fragment_cursor = buffer.fragments.cursor::<(Option<&Locator>, usize)>();
|
||||
fragment_cursor.seek(&Some(fragment_id), Bias::Left, &None);
|
||||
fragment_cursor
|
||||
.item()
|
||||
.map_or(false, |fragment| fragment.visible)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub trait OffsetRangeExt {
|
||||
fn to_offset(&self, snapshot: &BufferSnapshot) -> Range<usize>;
|
||||
fn to_point(&self, snapshot: &BufferSnapshot) -> Range<Point>;
|
||||
fn to_point_utf16(&self, snapshot: &BufferSnapshot) -> Range<PointUtf16>;
|
||||
}
|
||||
|
||||
impl<T> OffsetRangeExt for Range<T>
|
||||
where
|
||||
T: ToOffset,
|
||||
{
|
||||
fn to_offset(&self, snapshot: &BufferSnapshot) -> Range<usize> {
|
||||
self.start.to_offset(snapshot)..self.end.to_offset(snapshot)
|
||||
}
|
||||
|
||||
fn to_point(&self, snapshot: &BufferSnapshot) -> Range<Point> {
|
||||
self.start.to_offset(snapshot).to_point(snapshot)
|
||||
..self.end.to_offset(snapshot).to_point(snapshot)
|
||||
}
|
||||
|
||||
fn to_point_utf16(&self, snapshot: &BufferSnapshot) -> Range<PointUtf16> {
|
||||
self.start.to_offset(snapshot).to_point_utf16(snapshot)
|
||||
..self.end.to_offset(snapshot).to_point_utf16(snapshot)
|
||||
}
|
||||
}
|
||||
|
||||
pub trait AnchorRangeExt {
|
||||
fn cmp(&self, b: &Range<Anchor>, buffer: &BufferSnapshot) -> Result<Ordering>;
|
||||
}
|
||||
|
||||
impl AnchorRangeExt for Range<Anchor> {
|
||||
fn cmp(&self, other: &Range<Anchor>, buffer: &BufferSnapshot) -> Result<Ordering> {
|
||||
Ok(match self.start.cmp(&other.start, buffer) {
|
||||
Ordering::Equal => other.end.cmp(&self.end, buffer),
|
||||
ord => ord,
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,125 @@
|
||||
use lazy_static::lazy_static;
|
||||
use smallvec::{smallvec, SmallVec};
|
||||
use std::iter;
|
||||
|
||||
lazy_static! {
|
||||
static ref MIN: Locator = Locator::min();
|
||||
static ref MAX: Locator = Locator::max();
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
||||
pub struct Locator(SmallVec<[u64; 4]>);
|
||||
|
||||
impl Locator {
|
||||
pub fn min() -> Self {
|
||||
Self(smallvec![u64::MIN])
|
||||
}
|
||||
|
||||
pub fn max() -> Self {
|
||||
Self(smallvec![u64::MAX])
|
||||
}
|
||||
|
||||
pub fn min_ref() -> &'static Self {
|
||||
&*MIN
|
||||
}
|
||||
|
||||
pub fn max_ref() -> &'static Self {
|
||||
&*MAX
|
||||
}
|
||||
|
||||
pub fn assign(&mut self, other: &Self) {
|
||||
self.0.resize(other.0.len(), 0);
|
||||
self.0.copy_from_slice(&other.0);
|
||||
}
|
||||
|
||||
pub fn between(lhs: &Self, rhs: &Self) -> Self {
|
||||
let lhs = lhs.0.iter().copied().chain(iter::repeat(u64::MIN));
|
||||
let rhs = rhs.0.iter().copied().chain(iter::repeat(u64::MAX));
|
||||
let mut location = SmallVec::new();
|
||||
for (lhs, rhs) in lhs.zip(rhs) {
|
||||
let mid = lhs + ((rhs.saturating_sub(lhs)) >> 48);
|
||||
location.push(mid);
|
||||
if mid > lhs {
|
||||
break;
|
||||
}
|
||||
}
|
||||
Self(location)
|
||||
}
|
||||
|
||||
pub fn len(&self) -> usize {
|
||||
self.0.len()
|
||||
}
|
||||
|
||||
pub fn is_empty(&self) -> bool {
|
||||
self.len() == 0
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for Locator {
|
||||
fn default() -> Self {
|
||||
Self::min()
|
||||
}
|
||||
}
|
||||
|
||||
impl sum_tree::Item for Locator {
|
||||
type Summary = Locator;
|
||||
|
||||
fn summary(&self) -> Self::Summary {
|
||||
self.clone()
|
||||
}
|
||||
}
|
||||
|
||||
impl sum_tree::KeyedItem for Locator {
|
||||
type Key = Locator;
|
||||
|
||||
fn key(&self) -> Self::Key {
|
||||
self.clone()
|
||||
}
|
||||
}
|
||||
|
||||
impl sum_tree::Summary for Locator {
|
||||
type Context = ();
|
||||
|
||||
fn add_summary(&mut self, summary: &Self, _: &()) {
|
||||
self.assign(summary);
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use rand::prelude::*;
|
||||
use std::mem;
|
||||
|
||||
#[gpui2::test(iterations = 100)]
|
||||
fn test_locators(mut rng: StdRng) {
|
||||
let mut lhs = Default::default();
|
||||
let mut rhs = Default::default();
|
||||
while lhs == rhs {
|
||||
lhs = Locator(
|
||||
(0..rng.gen_range(1..=5))
|
||||
.map(|_| rng.gen_range(0..=100))
|
||||
.collect(),
|
||||
);
|
||||
rhs = Locator(
|
||||
(0..rng.gen_range(1..=5))
|
||||
.map(|_| rng.gen_range(0..=100))
|
||||
.collect(),
|
||||
);
|
||||
}
|
||||
|
||||
if lhs > rhs {
|
||||
mem::swap(&mut lhs, &mut rhs);
|
||||
}
|
||||
|
||||
let middle = Locator::between(&lhs, &rhs);
|
||||
assert!(middle > lhs);
|
||||
assert!(middle < rhs);
|
||||
for ix in 0..middle.0.len() - 1 {
|
||||
assert!(
|
||||
middle.0[ix] == *lhs.0.get(ix).unwrap_or(&0)
|
||||
|| middle.0[ix] == *rhs.0.get(ix).unwrap_or(&0)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
use clock::ReplicaId;
|
||||
|
||||
pub struct Network<T: Clone, R: rand::Rng> {
|
||||
inboxes: std::collections::BTreeMap<ReplicaId, Vec<Envelope<T>>>,
|
||||
all_messages: Vec<T>,
|
||||
rng: R,
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
struct Envelope<T: Clone> {
|
||||
message: T,
|
||||
}
|
||||
|
||||
impl<T: Clone, R: rand::Rng> Network<T, R> {
|
||||
pub fn new(rng: R) -> Self {
|
||||
Network {
|
||||
inboxes: Default::default(),
|
||||
all_messages: Vec::new(),
|
||||
rng,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn add_peer(&mut self, id: ReplicaId) {
|
||||
self.inboxes.insert(id, Vec::new());
|
||||
}
|
||||
|
||||
pub fn replicate(&mut self, old_replica_id: ReplicaId, new_replica_id: ReplicaId) {
|
||||
self.inboxes
|
||||
.insert(new_replica_id, self.inboxes[&old_replica_id].clone());
|
||||
}
|
||||
|
||||
pub fn is_idle(&self) -> bool {
|
||||
self.inboxes.values().all(|i| i.is_empty())
|
||||
}
|
||||
|
||||
pub fn broadcast(&mut self, sender: ReplicaId, messages: Vec<T>) {
|
||||
for (replica, inbox) in self.inboxes.iter_mut() {
|
||||
if *replica != sender {
|
||||
for message in &messages {
|
||||
// Insert one or more duplicates of this message, potentially *before* the previous
|
||||
// message sent by this peer to simulate out-of-order delivery.
|
||||
for _ in 0..self.rng.gen_range(1..4) {
|
||||
let insertion_index = self.rng.gen_range(0..inbox.len() + 1);
|
||||
inbox.insert(
|
||||
insertion_index,
|
||||
Envelope {
|
||||
message: message.clone(),
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
self.all_messages.extend(messages);
|
||||
}
|
||||
|
||||
pub fn has_unreceived(&self, receiver: ReplicaId) -> bool {
|
||||
!self.inboxes[&receiver].is_empty()
|
||||
}
|
||||
|
||||
pub fn receive(&mut self, receiver: ReplicaId) -> Vec<T> {
|
||||
let inbox = self.inboxes.get_mut(&receiver).unwrap();
|
||||
let count = self.rng.gen_range(0..inbox.len() + 1);
|
||||
inbox
|
||||
.drain(0..count)
|
||||
.map(|envelope| envelope.message)
|
||||
.collect()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,153 @@
|
||||
use std::{fmt::Debug, ops::Add};
|
||||
use sum_tree::{Dimension, Edit, Item, KeyedItem, SumTree, Summary};
|
||||
|
||||
pub trait Operation: Clone + Debug {
|
||||
fn lamport_timestamp(&self) -> clock::Lamport;
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
struct OperationItem<T>(T);
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct OperationQueue<T: Operation>(SumTree<OperationItem<T>>);
|
||||
|
||||
#[derive(Clone, Copy, Debug, Default, Eq, Ord, PartialEq, PartialOrd)]
|
||||
pub struct OperationKey(clock::Lamport);
|
||||
|
||||
#[derive(Clone, Copy, Debug, Default, Eq, PartialEq)]
|
||||
pub struct OperationSummary {
|
||||
pub key: OperationKey,
|
||||
pub len: usize,
|
||||
}
|
||||
|
||||
impl OperationKey {
|
||||
pub fn new(timestamp: clock::Lamport) -> Self {
|
||||
Self(timestamp)
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: Operation> Default for OperationQueue<T> {
|
||||
fn default() -> Self {
|
||||
OperationQueue::new()
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: Operation> OperationQueue<T> {
|
||||
pub fn new() -> Self {
|
||||
OperationQueue(SumTree::new())
|
||||
}
|
||||
|
||||
pub fn len(&self) -> usize {
|
||||
self.0.summary().len
|
||||
}
|
||||
|
||||
pub fn is_empty(&self) -> bool {
|
||||
self.len() == 0
|
||||
}
|
||||
|
||||
pub fn insert(&mut self, mut ops: Vec<T>) {
|
||||
ops.sort_by_key(|op| op.lamport_timestamp());
|
||||
ops.dedup_by_key(|op| op.lamport_timestamp());
|
||||
self.0.edit(
|
||||
ops.into_iter()
|
||||
.map(|op| Edit::Insert(OperationItem(op)))
|
||||
.collect(),
|
||||
&(),
|
||||
);
|
||||
}
|
||||
|
||||
pub fn drain(&mut self) -> Self {
|
||||
let clone = self.clone();
|
||||
self.0 = SumTree::new();
|
||||
clone
|
||||
}
|
||||
|
||||
pub fn iter(&self) -> impl Iterator<Item = &T> {
|
||||
self.0.iter().map(|i| &i.0)
|
||||
}
|
||||
}
|
||||
|
||||
impl Summary for OperationSummary {
|
||||
type Context = ();
|
||||
|
||||
fn add_summary(&mut self, other: &Self, _: &()) {
|
||||
assert!(self.key < other.key);
|
||||
self.key = other.key;
|
||||
self.len += other.len;
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> Add<&'a Self> for OperationSummary {
|
||||
type Output = Self;
|
||||
|
||||
fn add(self, other: &Self) -> Self {
|
||||
assert!(self.key < other.key);
|
||||
OperationSummary {
|
||||
key: other.key,
|
||||
len: self.len + other.len,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> Dimension<'a, OperationSummary> for OperationKey {
|
||||
fn add_summary(&mut self, summary: &OperationSummary, _: &()) {
|
||||
assert!(*self <= summary.key);
|
||||
*self = summary.key;
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: Operation> Item for OperationItem<T> {
|
||||
type Summary = OperationSummary;
|
||||
|
||||
fn summary(&self) -> Self::Summary {
|
||||
OperationSummary {
|
||||
key: OperationKey::new(self.0.lamport_timestamp()),
|
||||
len: 1,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: Operation> KeyedItem for OperationItem<T> {
|
||||
type Key = OperationKey;
|
||||
|
||||
fn key(&self) -> Self::Key {
|
||||
OperationKey::new(self.0.lamport_timestamp())
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn test_len() {
|
||||
let mut clock = clock::Lamport::new(0);
|
||||
|
||||
let mut queue = OperationQueue::new();
|
||||
assert_eq!(queue.len(), 0);
|
||||
|
||||
queue.insert(vec![
|
||||
TestOperation(clock.tick()),
|
||||
TestOperation(clock.tick()),
|
||||
]);
|
||||
assert_eq!(queue.len(), 2);
|
||||
|
||||
queue.insert(vec![TestOperation(clock.tick())]);
|
||||
assert_eq!(queue.len(), 3);
|
||||
|
||||
drop(queue.drain());
|
||||
assert_eq!(queue.len(), 0);
|
||||
|
||||
queue.insert(vec![TestOperation(clock.tick())]);
|
||||
assert_eq!(queue.len(), 1);
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Eq, PartialEq)]
|
||||
struct TestOperation(clock::Lamport);
|
||||
|
||||
impl Operation for TestOperation {
|
||||
fn lamport_timestamp(&self) -> clock::Lamport {
|
||||
self.0
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,594 @@
|
||||
use crate::Edit;
|
||||
use std::{
|
||||
cmp, mem,
|
||||
ops::{Add, AddAssign, Sub},
|
||||
};
|
||||
|
||||
#[derive(Clone, Default, Debug, PartialEq, Eq)]
|
||||
pub struct Patch<T>(Vec<Edit<T>>);
|
||||
|
||||
impl<T> Patch<T>
|
||||
where
|
||||
T: 'static
|
||||
+ Clone
|
||||
+ Copy
|
||||
+ Ord
|
||||
+ Sub<T, Output = T>
|
||||
+ Add<T, Output = T>
|
||||
+ AddAssign
|
||||
+ Default
|
||||
+ PartialEq,
|
||||
{
|
||||
pub fn new(edits: Vec<Edit<T>>) -> Self {
|
||||
#[cfg(debug_assertions)]
|
||||
{
|
||||
let mut last_edit: Option<&Edit<T>> = None;
|
||||
for edit in &edits {
|
||||
if let Some(last_edit) = last_edit {
|
||||
assert!(edit.old.start > last_edit.old.end);
|
||||
assert!(edit.new.start > last_edit.new.end);
|
||||
}
|
||||
last_edit = Some(edit);
|
||||
}
|
||||
}
|
||||
Self(edits)
|
||||
}
|
||||
|
||||
pub fn edits(&self) -> &[Edit<T>] {
|
||||
&self.0
|
||||
}
|
||||
|
||||
pub fn into_inner(self) -> Vec<Edit<T>> {
|
||||
self.0
|
||||
}
|
||||
|
||||
pub fn compose(&self, new_edits_iter: impl IntoIterator<Item = Edit<T>>) -> Self {
|
||||
let mut old_edits_iter = self.0.iter().cloned().peekable();
|
||||
let mut new_edits_iter = new_edits_iter.into_iter().peekable();
|
||||
let mut composed = Patch(Vec::new());
|
||||
|
||||
let mut old_start = T::default();
|
||||
let mut new_start = T::default();
|
||||
loop {
|
||||
let old_edit = old_edits_iter.peek_mut();
|
||||
let new_edit = new_edits_iter.peek_mut();
|
||||
|
||||
// Push the old edit if its new end is before the new edit's old start.
|
||||
if let Some(old_edit) = old_edit.as_ref() {
|
||||
let new_edit = new_edit.as_ref();
|
||||
if new_edit.map_or(true, |new_edit| old_edit.new.end < new_edit.old.start) {
|
||||
let catchup = old_edit.old.start - old_start;
|
||||
old_start += catchup;
|
||||
new_start += catchup;
|
||||
|
||||
let old_end = old_start + old_edit.old_len();
|
||||
let new_end = new_start + old_edit.new_len();
|
||||
composed.push(Edit {
|
||||
old: old_start..old_end,
|
||||
new: new_start..new_end,
|
||||
});
|
||||
old_start = old_end;
|
||||
new_start = new_end;
|
||||
old_edits_iter.next();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
// Push the new edit if its old end is before the old edit's new start.
|
||||
if let Some(new_edit) = new_edit.as_ref() {
|
||||
let old_edit = old_edit.as_ref();
|
||||
if old_edit.map_or(true, |old_edit| new_edit.old.end < old_edit.new.start) {
|
||||
let catchup = new_edit.new.start - new_start;
|
||||
old_start += catchup;
|
||||
new_start += catchup;
|
||||
|
||||
let old_end = old_start + new_edit.old_len();
|
||||
let new_end = new_start + new_edit.new_len();
|
||||
composed.push(Edit {
|
||||
old: old_start..old_end,
|
||||
new: new_start..new_end,
|
||||
});
|
||||
old_start = old_end;
|
||||
new_start = new_end;
|
||||
new_edits_iter.next();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
// If we still have edits by this point then they must intersect, so we compose them.
|
||||
if let Some((old_edit, new_edit)) = old_edit.zip(new_edit) {
|
||||
if old_edit.new.start < new_edit.old.start {
|
||||
let catchup = old_edit.old.start - old_start;
|
||||
old_start += catchup;
|
||||
new_start += catchup;
|
||||
|
||||
let overshoot = new_edit.old.start - old_edit.new.start;
|
||||
let old_end = cmp::min(old_start + overshoot, old_edit.old.end);
|
||||
let new_end = new_start + overshoot;
|
||||
composed.push(Edit {
|
||||
old: old_start..old_end,
|
||||
new: new_start..new_end,
|
||||
});
|
||||
|
||||
old_edit.old.start = old_end;
|
||||
old_edit.new.start += overshoot;
|
||||
old_start = old_end;
|
||||
new_start = new_end;
|
||||
} else {
|
||||
let catchup = new_edit.new.start - new_start;
|
||||
old_start += catchup;
|
||||
new_start += catchup;
|
||||
|
||||
let overshoot = old_edit.new.start - new_edit.old.start;
|
||||
let old_end = old_start + overshoot;
|
||||
let new_end = cmp::min(new_start + overshoot, new_edit.new.end);
|
||||
composed.push(Edit {
|
||||
old: old_start..old_end,
|
||||
new: new_start..new_end,
|
||||
});
|
||||
|
||||
new_edit.old.start += overshoot;
|
||||
new_edit.new.start = new_end;
|
||||
old_start = old_end;
|
||||
new_start = new_end;
|
||||
}
|
||||
|
||||
if old_edit.new.end > new_edit.old.end {
|
||||
let old_end = old_start + cmp::min(old_edit.old_len(), new_edit.old_len());
|
||||
let new_end = new_start + new_edit.new_len();
|
||||
composed.push(Edit {
|
||||
old: old_start..old_end,
|
||||
new: new_start..new_end,
|
||||
});
|
||||
|
||||
old_edit.old.start = old_end;
|
||||
old_edit.new.start = new_edit.old.end;
|
||||
old_start = old_end;
|
||||
new_start = new_end;
|
||||
new_edits_iter.next();
|
||||
} else {
|
||||
let old_end = old_start + old_edit.old_len();
|
||||
let new_end = new_start + cmp::min(old_edit.new_len(), new_edit.new_len());
|
||||
composed.push(Edit {
|
||||
old: old_start..old_end,
|
||||
new: new_start..new_end,
|
||||
});
|
||||
|
||||
new_edit.old.start = old_edit.new.end;
|
||||
new_edit.new.start = new_end;
|
||||
old_start = old_end;
|
||||
new_start = new_end;
|
||||
old_edits_iter.next();
|
||||
}
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
composed
|
||||
}
|
||||
|
||||
pub fn invert(&mut self) -> &mut Self {
|
||||
for edit in &mut self.0 {
|
||||
mem::swap(&mut edit.old, &mut edit.new);
|
||||
}
|
||||
self
|
||||
}
|
||||
|
||||
pub fn clear(&mut self) {
|
||||
self.0.clear();
|
||||
}
|
||||
|
||||
pub fn is_empty(&self) -> bool {
|
||||
self.0.is_empty()
|
||||
}
|
||||
|
||||
pub fn push(&mut self, edit: Edit<T>) {
|
||||
if edit.is_empty() {
|
||||
return;
|
||||
}
|
||||
|
||||
if let Some(last) = self.0.last_mut() {
|
||||
if last.old.end >= edit.old.start {
|
||||
last.old.end = edit.old.end;
|
||||
last.new.end = edit.new.end;
|
||||
} else {
|
||||
self.0.push(edit);
|
||||
}
|
||||
} else {
|
||||
self.0.push(edit);
|
||||
}
|
||||
}
|
||||
|
||||
pub fn old_to_new(&self, old: T) -> T {
|
||||
let ix = match self.0.binary_search_by(|probe| probe.old.start.cmp(&old)) {
|
||||
Ok(ix) => ix,
|
||||
Err(ix) => {
|
||||
if ix == 0 {
|
||||
return old;
|
||||
} else {
|
||||
ix - 1
|
||||
}
|
||||
}
|
||||
};
|
||||
if let Some(edit) = self.0.get(ix) {
|
||||
if old >= edit.old.end {
|
||||
edit.new.end + (old - edit.old.end)
|
||||
} else {
|
||||
edit.new.start
|
||||
}
|
||||
} else {
|
||||
old
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: Clone> IntoIterator for Patch<T> {
|
||||
type Item = Edit<T>;
|
||||
type IntoIter = std::vec::IntoIter<Edit<T>>;
|
||||
|
||||
fn into_iter(self) -> Self::IntoIter {
|
||||
self.0.into_iter()
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, T: Clone> IntoIterator for &'a Patch<T> {
|
||||
type Item = Edit<T>;
|
||||
type IntoIter = std::iter::Cloned<std::slice::Iter<'a, Edit<T>>>;
|
||||
|
||||
fn into_iter(self) -> Self::IntoIter {
|
||||
self.0.iter().cloned()
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, T: Clone> IntoIterator for &'a mut Patch<T> {
|
||||
type Item = Edit<T>;
|
||||
type IntoIter = std::iter::Cloned<std::slice::Iter<'a, Edit<T>>>;
|
||||
|
||||
fn into_iter(self) -> Self::IntoIter {
|
||||
self.0.iter().cloned()
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use rand::prelude::*;
|
||||
use std::env;
|
||||
|
||||
#[gpui2::test]
|
||||
fn test_one_disjoint_edit() {
|
||||
assert_patch_composition(
|
||||
Patch(vec![Edit {
|
||||
old: 1..3,
|
||||
new: 1..4,
|
||||
}]),
|
||||
Patch(vec![Edit {
|
||||
old: 0..0,
|
||||
new: 0..4,
|
||||
}]),
|
||||
Patch(vec![
|
||||
Edit {
|
||||
old: 0..0,
|
||||
new: 0..4,
|
||||
},
|
||||
Edit {
|
||||
old: 1..3,
|
||||
new: 5..8,
|
||||
},
|
||||
]),
|
||||
);
|
||||
|
||||
assert_patch_composition(
|
||||
Patch(vec![Edit {
|
||||
old: 1..3,
|
||||
new: 1..4,
|
||||
}]),
|
||||
Patch(vec![Edit {
|
||||
old: 5..9,
|
||||
new: 5..7,
|
||||
}]),
|
||||
Patch(vec![
|
||||
Edit {
|
||||
old: 1..3,
|
||||
new: 1..4,
|
||||
},
|
||||
Edit {
|
||||
old: 4..8,
|
||||
new: 5..7,
|
||||
},
|
||||
]),
|
||||
);
|
||||
}
|
||||
|
||||
#[gpui2::test]
|
||||
fn test_one_overlapping_edit() {
|
||||
assert_patch_composition(
|
||||
Patch(vec![Edit {
|
||||
old: 1..3,
|
||||
new: 1..4,
|
||||
}]),
|
||||
Patch(vec![Edit {
|
||||
old: 3..5,
|
||||
new: 3..6,
|
||||
}]),
|
||||
Patch(vec![Edit {
|
||||
old: 1..4,
|
||||
new: 1..6,
|
||||
}]),
|
||||
);
|
||||
}
|
||||
|
||||
#[gpui2::test]
|
||||
fn test_two_disjoint_and_overlapping() {
|
||||
assert_patch_composition(
|
||||
Patch(vec![
|
||||
Edit {
|
||||
old: 1..3,
|
||||
new: 1..4,
|
||||
},
|
||||
Edit {
|
||||
old: 8..12,
|
||||
new: 9..11,
|
||||
},
|
||||
]),
|
||||
Patch(vec![
|
||||
Edit {
|
||||
old: 0..0,
|
||||
new: 0..4,
|
||||
},
|
||||
Edit {
|
||||
old: 3..10,
|
||||
new: 7..9,
|
||||
},
|
||||
]),
|
||||
Patch(vec![
|
||||
Edit {
|
||||
old: 0..0,
|
||||
new: 0..4,
|
||||
},
|
||||
Edit {
|
||||
old: 1..12,
|
||||
new: 5..10,
|
||||
},
|
||||
]),
|
||||
);
|
||||
}
|
||||
|
||||
#[gpui2::test]
|
||||
fn test_two_new_edits_overlapping_one_old_edit() {
|
||||
assert_patch_composition(
|
||||
Patch(vec![Edit {
|
||||
old: 0..0,
|
||||
new: 0..3,
|
||||
}]),
|
||||
Patch(vec![
|
||||
Edit {
|
||||
old: 0..0,
|
||||
new: 0..1,
|
||||
},
|
||||
Edit {
|
||||
old: 1..2,
|
||||
new: 2..2,
|
||||
},
|
||||
]),
|
||||
Patch(vec![Edit {
|
||||
old: 0..0,
|
||||
new: 0..3,
|
||||
}]),
|
||||
);
|
||||
|
||||
assert_patch_composition(
|
||||
Patch(vec![Edit {
|
||||
old: 2..3,
|
||||
new: 2..4,
|
||||
}]),
|
||||
Patch(vec![
|
||||
Edit {
|
||||
old: 0..2,
|
||||
new: 0..1,
|
||||
},
|
||||
Edit {
|
||||
old: 3..3,
|
||||
new: 2..5,
|
||||
},
|
||||
]),
|
||||
Patch(vec![Edit {
|
||||
old: 0..3,
|
||||
new: 0..6,
|
||||
}]),
|
||||
);
|
||||
|
||||
assert_patch_composition(
|
||||
Patch(vec![Edit {
|
||||
old: 0..0,
|
||||
new: 0..2,
|
||||
}]),
|
||||
Patch(vec![
|
||||
Edit {
|
||||
old: 0..0,
|
||||
new: 0..2,
|
||||
},
|
||||
Edit {
|
||||
old: 2..5,
|
||||
new: 4..4,
|
||||
},
|
||||
]),
|
||||
Patch(vec![Edit {
|
||||
old: 0..3,
|
||||
new: 0..4,
|
||||
}]),
|
||||
);
|
||||
}
|
||||
|
||||
#[gpui2::test]
|
||||
fn test_two_new_edits_touching_one_old_edit() {
|
||||
assert_patch_composition(
|
||||
Patch(vec![
|
||||
Edit {
|
||||
old: 2..3,
|
||||
new: 2..4,
|
||||
},
|
||||
Edit {
|
||||
old: 7..7,
|
||||
new: 8..11,
|
||||
},
|
||||
]),
|
||||
Patch(vec![
|
||||
Edit {
|
||||
old: 2..3,
|
||||
new: 2..2,
|
||||
},
|
||||
Edit {
|
||||
old: 4..4,
|
||||
new: 3..4,
|
||||
},
|
||||
]),
|
||||
Patch(vec![
|
||||
Edit {
|
||||
old: 2..3,
|
||||
new: 2..4,
|
||||
},
|
||||
Edit {
|
||||
old: 7..7,
|
||||
new: 8..11,
|
||||
},
|
||||
]),
|
||||
);
|
||||
}
|
||||
|
||||
#[gpui2::test]
|
||||
fn test_old_to_new() {
|
||||
let patch = Patch(vec![
|
||||
Edit {
|
||||
old: 2..4,
|
||||
new: 2..4,
|
||||
},
|
||||
Edit {
|
||||
old: 7..8,
|
||||
new: 7..11,
|
||||
},
|
||||
]);
|
||||
assert_eq!(patch.old_to_new(0), 0);
|
||||
assert_eq!(patch.old_to_new(1), 1);
|
||||
assert_eq!(patch.old_to_new(2), 2);
|
||||
assert_eq!(patch.old_to_new(3), 2);
|
||||
assert_eq!(patch.old_to_new(4), 4);
|
||||
assert_eq!(patch.old_to_new(5), 5);
|
||||
assert_eq!(patch.old_to_new(6), 6);
|
||||
assert_eq!(patch.old_to_new(7), 7);
|
||||
assert_eq!(patch.old_to_new(8), 11);
|
||||
assert_eq!(patch.old_to_new(9), 12);
|
||||
}
|
||||
|
||||
#[gpui2::test(iterations = 100)]
|
||||
fn test_random_patch_compositions(mut rng: StdRng) {
|
||||
let operations = env::var("OPERATIONS")
|
||||
.map(|i| i.parse().expect("invalid `OPERATIONS` variable"))
|
||||
.unwrap_or(20);
|
||||
|
||||
let initial_chars = (0..rng.gen_range(0..=100))
|
||||
.map(|_| rng.gen_range(b'a'..=b'z') as char)
|
||||
.collect::<Vec<_>>();
|
||||
log::info!("initial chars: {:?}", initial_chars);
|
||||
|
||||
// Generate two sequential patches
|
||||
let mut patches = Vec::new();
|
||||
let mut expected_chars = initial_chars.clone();
|
||||
for i in 0..2 {
|
||||
log::info!("patch {}:", i);
|
||||
|
||||
let mut delta = 0i32;
|
||||
let mut last_edit_end = 0;
|
||||
let mut edits = Vec::new();
|
||||
|
||||
for _ in 0..operations {
|
||||
if last_edit_end >= expected_chars.len() {
|
||||
break;
|
||||
}
|
||||
|
||||
let end = rng.gen_range(last_edit_end..=expected_chars.len());
|
||||
let start = rng.gen_range(last_edit_end..=end);
|
||||
let old_len = end - start;
|
||||
|
||||
let mut new_len = rng.gen_range(0..=3);
|
||||
if start == end && new_len == 0 {
|
||||
new_len += 1;
|
||||
}
|
||||
|
||||
last_edit_end = start + new_len + 1;
|
||||
|
||||
let new_chars = (0..new_len)
|
||||
.map(|_| rng.gen_range(b'A'..=b'Z') as char)
|
||||
.collect::<Vec<_>>();
|
||||
log::info!(
|
||||
" editing {:?}: {:?}",
|
||||
start..end,
|
||||
new_chars.iter().collect::<String>()
|
||||
);
|
||||
edits.push(Edit {
|
||||
old: (start as i32 - delta) as u32..(end as i32 - delta) as u32,
|
||||
new: start as u32..(start + new_len) as u32,
|
||||
});
|
||||
expected_chars.splice(start..end, new_chars);
|
||||
|
||||
delta += new_len as i32 - old_len as i32;
|
||||
}
|
||||
|
||||
patches.push(Patch(edits));
|
||||
}
|
||||
|
||||
log::info!("old patch: {:?}", &patches[0]);
|
||||
log::info!("new patch: {:?}", &patches[1]);
|
||||
log::info!("initial chars: {:?}", initial_chars);
|
||||
log::info!("final chars: {:?}", expected_chars);
|
||||
|
||||
// Compose the patches, and verify that it has the same effect as applying the
|
||||
// two patches separately.
|
||||
let composed = patches[0].compose(&patches[1]);
|
||||
log::info!("composed patch: {:?}", &composed);
|
||||
|
||||
let mut actual_chars = initial_chars;
|
||||
for edit in composed.0 {
|
||||
actual_chars.splice(
|
||||
edit.new.start as usize..edit.new.start as usize + edit.old.len(),
|
||||
expected_chars[edit.new.start as usize..edit.new.end as usize]
|
||||
.iter()
|
||||
.copied(),
|
||||
);
|
||||
}
|
||||
|
||||
assert_eq!(actual_chars, expected_chars);
|
||||
}
|
||||
|
||||
#[track_caller]
|
||||
fn assert_patch_composition(old: Patch<u32>, new: Patch<u32>, composed: Patch<u32>) {
|
||||
let original = ('a'..'z').collect::<Vec<_>>();
|
||||
let inserted = ('A'..'Z').collect::<Vec<_>>();
|
||||
|
||||
let mut expected = original.clone();
|
||||
apply_patch(&mut expected, &old, &inserted);
|
||||
apply_patch(&mut expected, &new, &inserted);
|
||||
|
||||
let mut actual = original;
|
||||
apply_patch(&mut actual, &composed, &expected);
|
||||
assert_eq!(
|
||||
actual.into_iter().collect::<String>(),
|
||||
expected.into_iter().collect::<String>(),
|
||||
"expected patch is incorrect"
|
||||
);
|
||||
|
||||
assert_eq!(old.compose(&new), composed);
|
||||
}
|
||||
|
||||
fn apply_patch(text: &mut Vec<char>, patch: &Patch<u32>, new_text: &[char]) {
|
||||
for edit in patch.0.iter().rev() {
|
||||
text.splice(
|
||||
edit.old.start as usize..edit.old.end as usize,
|
||||
new_text[edit.new.start as usize..edit.new.end as usize]
|
||||
.iter()
|
||||
.copied(),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,123 @@
|
||||
use crate::{Anchor, BufferSnapshot, TextDimension};
|
||||
use std::cmp::Ordering;
|
||||
use std::ops::Range;
|
||||
|
||||
#[derive(Copy, Clone, Debug, PartialEq)]
|
||||
pub enum SelectionGoal {
|
||||
None,
|
||||
HorizontalPosition(f32),
|
||||
HorizontalRange { start: f32, end: f32 },
|
||||
WrappedHorizontalPosition((u32, f32)),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq)]
|
||||
pub struct Selection<T> {
|
||||
pub id: usize,
|
||||
pub start: T,
|
||||
pub end: T,
|
||||
pub reversed: bool,
|
||||
pub goal: SelectionGoal,
|
||||
}
|
||||
|
||||
impl Default for SelectionGoal {
|
||||
fn default() -> Self {
|
||||
Self::None
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: Clone> Selection<T> {
|
||||
pub fn head(&self) -> T {
|
||||
if self.reversed {
|
||||
self.start.clone()
|
||||
} else {
|
||||
self.end.clone()
|
||||
}
|
||||
}
|
||||
|
||||
pub fn tail(&self) -> T {
|
||||
if self.reversed {
|
||||
self.end.clone()
|
||||
} else {
|
||||
self.start.clone()
|
||||
}
|
||||
}
|
||||
|
||||
pub fn map<F, S>(&self, f: F) -> Selection<S>
|
||||
where
|
||||
F: Fn(T) -> S,
|
||||
{
|
||||
Selection::<S> {
|
||||
id: self.id,
|
||||
start: f(self.start.clone()),
|
||||
end: f(self.end.clone()),
|
||||
reversed: self.reversed,
|
||||
goal: self.goal,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn collapse_to(&mut self, point: T, new_goal: SelectionGoal) {
|
||||
self.start = point.clone();
|
||||
self.end = point;
|
||||
self.goal = new_goal;
|
||||
self.reversed = false;
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: Copy + Ord> Selection<T> {
|
||||
pub fn is_empty(&self) -> bool {
|
||||
self.start == self.end
|
||||
}
|
||||
|
||||
pub fn set_head(&mut self, head: T, new_goal: SelectionGoal) {
|
||||
if head.cmp(&self.tail()) < Ordering::Equal {
|
||||
if !self.reversed {
|
||||
self.end = self.start;
|
||||
self.reversed = true;
|
||||
}
|
||||
self.start = head;
|
||||
} else {
|
||||
if self.reversed {
|
||||
self.start = self.end;
|
||||
self.reversed = false;
|
||||
}
|
||||
self.end = head;
|
||||
}
|
||||
self.goal = new_goal;
|
||||
}
|
||||
|
||||
pub fn range(&self) -> Range<T> {
|
||||
self.start..self.end
|
||||
}
|
||||
}
|
||||
|
||||
impl Selection<usize> {
|
||||
#[cfg(feature = "test-support")]
|
||||
pub fn from_offset(offset: usize) -> Self {
|
||||
Selection {
|
||||
id: 0,
|
||||
start: offset,
|
||||
end: offset,
|
||||
goal: SelectionGoal::None,
|
||||
reversed: false,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn equals(&self, offset_range: &Range<usize>) -> bool {
|
||||
self.start == offset_range.start && self.end == offset_range.end
|
||||
}
|
||||
}
|
||||
|
||||
impl Selection<Anchor> {
|
||||
pub fn resolve<'a, D: 'a + TextDimension>(
|
||||
&'a self,
|
||||
snapshot: &'a BufferSnapshot,
|
||||
) -> Selection<D> {
|
||||
Selection {
|
||||
id: self.id,
|
||||
start: snapshot.summary_for_anchor(&self.start),
|
||||
end: snapshot.summary_for_anchor(&self.end),
|
||||
reversed: self.reversed,
|
||||
goal: self.goal,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
use crate::{Edit, Patch};
|
||||
use parking_lot::Mutex;
|
||||
use std::{
|
||||
mem,
|
||||
sync::{Arc, Weak},
|
||||
};
|
||||
|
||||
#[derive(Default)]
|
||||
pub struct Topic(Mutex<Vec<Weak<Mutex<Patch<usize>>>>>);
|
||||
|
||||
pub struct Subscription(Arc<Mutex<Patch<usize>>>);
|
||||
|
||||
impl Topic {
|
||||
pub fn subscribe(&mut self) -> Subscription {
|
||||
let subscription = Subscription(Default::default());
|
||||
self.0.get_mut().push(Arc::downgrade(&subscription.0));
|
||||
subscription
|
||||
}
|
||||
|
||||
pub fn publish(&self, edits: impl Clone + IntoIterator<Item = Edit<usize>>) {
|
||||
publish(&mut *self.0.lock(), edits);
|
||||
}
|
||||
|
||||
pub fn publish_mut(&mut self, edits: impl Clone + IntoIterator<Item = Edit<usize>>) {
|
||||
publish(self.0.get_mut(), edits);
|
||||
}
|
||||
}
|
||||
|
||||
impl Subscription {
|
||||
pub fn consume(&self) -> Patch<usize> {
|
||||
mem::take(&mut *self.0.lock())
|
||||
}
|
||||
}
|
||||
|
||||
fn publish(
|
||||
subscriptions: &mut Vec<Weak<Mutex<Patch<usize>>>>,
|
||||
edits: impl Clone + IntoIterator<Item = Edit<usize>>,
|
||||
) {
|
||||
subscriptions.retain(|subscription| {
|
||||
if let Some(subscription) = subscription.upgrade() {
|
||||
let mut patch = subscription.lock();
|
||||
*patch = patch.compose(edits.clone());
|
||||
true
|
||||
} else {
|
||||
false
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,764 @@
|
||||
use super::{network::Network, *};
|
||||
use clock::ReplicaId;
|
||||
use rand::prelude::*;
|
||||
use std::{
|
||||
cmp::Ordering,
|
||||
env,
|
||||
iter::Iterator,
|
||||
time::{Duration, Instant},
|
||||
};
|
||||
|
||||
#[cfg(test)]
|
||||
#[ctor::ctor]
|
||||
fn init_logger() {
|
||||
if std::env::var("RUST_LOG").is_ok() {
|
||||
env_logger::init();
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_edit() {
|
||||
let mut buffer = Buffer::new(0, 0, "abc".into());
|
||||
assert_eq!(buffer.text(), "abc");
|
||||
buffer.edit([(3..3, "def")]);
|
||||
assert_eq!(buffer.text(), "abcdef");
|
||||
buffer.edit([(0..0, "ghi")]);
|
||||
assert_eq!(buffer.text(), "ghiabcdef");
|
||||
buffer.edit([(5..5, "jkl")]);
|
||||
assert_eq!(buffer.text(), "ghiabjklcdef");
|
||||
buffer.edit([(6..7, "")]);
|
||||
assert_eq!(buffer.text(), "ghiabjlcdef");
|
||||
buffer.edit([(4..9, "mno")]);
|
||||
assert_eq!(buffer.text(), "ghiamnoef");
|
||||
}
|
||||
|
||||
#[gpui2::test(iterations = 100)]
|
||||
fn test_random_edits(mut rng: StdRng) {
|
||||
let operations = env::var("OPERATIONS")
|
||||
.map(|i| i.parse().expect("invalid `OPERATIONS` variable"))
|
||||
.unwrap_or(10);
|
||||
|
||||
let reference_string_len = rng.gen_range(0..3);
|
||||
let mut reference_string = RandomCharIter::new(&mut rng)
|
||||
.take(reference_string_len)
|
||||
.collect::<String>();
|
||||
let mut buffer = Buffer::new(0, 0, reference_string.clone());
|
||||
LineEnding::normalize(&mut reference_string);
|
||||
|
||||
buffer.set_group_interval(Duration::from_millis(rng.gen_range(0..=200)));
|
||||
let mut buffer_versions = Vec::new();
|
||||
log::info!(
|
||||
"buffer text {:?}, version: {:?}",
|
||||
buffer.text(),
|
||||
buffer.version()
|
||||
);
|
||||
|
||||
for _i in 0..operations {
|
||||
let (edits, _) = buffer.randomly_edit(&mut rng, 5);
|
||||
for (old_range, new_text) in edits.iter().rev() {
|
||||
reference_string.replace_range(old_range.clone(), new_text);
|
||||
}
|
||||
|
||||
assert_eq!(buffer.text(), reference_string);
|
||||
log::info!(
|
||||
"buffer text {:?}, version: {:?}",
|
||||
buffer.text(),
|
||||
buffer.version()
|
||||
);
|
||||
|
||||
if rng.gen_bool(0.25) {
|
||||
buffer.randomly_undo_redo(&mut rng);
|
||||
reference_string = buffer.text();
|
||||
log::info!(
|
||||
"buffer text {:?}, version: {:?}",
|
||||
buffer.text(),
|
||||
buffer.version()
|
||||
);
|
||||
}
|
||||
|
||||
let range = buffer.random_byte_range(0, &mut rng);
|
||||
assert_eq!(
|
||||
buffer.text_summary_for_range::<TextSummary, _>(range.clone()),
|
||||
TextSummary::from(&reference_string[range])
|
||||
);
|
||||
|
||||
buffer.check_invariants();
|
||||
|
||||
if rng.gen_bool(0.3) {
|
||||
buffer_versions.push((buffer.clone(), buffer.subscribe()));
|
||||
}
|
||||
}
|
||||
|
||||
for (old_buffer, subscription) in buffer_versions {
|
||||
let edits = buffer
|
||||
.edits_since::<usize>(&old_buffer.version)
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
log::info!(
|
||||
"applying edits since version {:?} to old text: {:?}: {:?}",
|
||||
old_buffer.version(),
|
||||
old_buffer.text(),
|
||||
edits,
|
||||
);
|
||||
|
||||
let mut text = old_buffer.visible_text.clone();
|
||||
for edit in edits {
|
||||
let new_text: String = buffer.text_for_range(edit.new.clone()).collect();
|
||||
text.replace(edit.new.start..edit.new.start + edit.old.len(), &new_text);
|
||||
}
|
||||
assert_eq!(text.to_string(), buffer.text());
|
||||
|
||||
for _ in 0..5 {
|
||||
let end_ix = old_buffer.clip_offset(rng.gen_range(0..=old_buffer.len()), Bias::Right);
|
||||
let start_ix = old_buffer.clip_offset(rng.gen_range(0..=end_ix), Bias::Left);
|
||||
let range = old_buffer.anchor_before(start_ix)..old_buffer.anchor_after(end_ix);
|
||||
let mut old_text = old_buffer.text_for_range(range.clone()).collect::<String>();
|
||||
let edits = buffer
|
||||
.edits_since_in_range::<usize>(&old_buffer.version, range.clone())
|
||||
.collect::<Vec<_>>();
|
||||
log::info!(
|
||||
"applying edits since version {:?} to old text in range {:?}: {:?}: {:?}",
|
||||
old_buffer.version(),
|
||||
start_ix..end_ix,
|
||||
old_text,
|
||||
edits,
|
||||
);
|
||||
|
||||
let new_text = buffer.text_for_range(range).collect::<String>();
|
||||
for edit in edits {
|
||||
old_text.replace_range(
|
||||
edit.new.start..edit.new.start + edit.old_len(),
|
||||
&new_text[edit.new],
|
||||
);
|
||||
}
|
||||
assert_eq!(old_text, new_text);
|
||||
}
|
||||
|
||||
let subscription_edits = subscription.consume();
|
||||
log::info!(
|
||||
"applying subscription edits since version {:?} to old text: {:?}: {:?}",
|
||||
old_buffer.version(),
|
||||
old_buffer.text(),
|
||||
subscription_edits,
|
||||
);
|
||||
|
||||
let mut text = old_buffer.visible_text.clone();
|
||||
for edit in subscription_edits.into_inner() {
|
||||
let new_text: String = buffer.text_for_range(edit.new.clone()).collect();
|
||||
text.replace(edit.new.start..edit.new.start + edit.old.len(), &new_text);
|
||||
}
|
||||
assert_eq!(text.to_string(), buffer.text());
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_line_endings() {
|
||||
assert_eq!(LineEnding::detect(&"🍐✅\n".repeat(1000)), LineEnding::Unix);
|
||||
assert_eq!(LineEnding::detect(&"abcd\n".repeat(1000)), LineEnding::Unix);
|
||||
assert_eq!(
|
||||
LineEnding::detect(&"🍐✅\r\n".repeat(1000)),
|
||||
LineEnding::Windows
|
||||
);
|
||||
assert_eq!(
|
||||
LineEnding::detect(&"abcd\r\n".repeat(1000)),
|
||||
LineEnding::Windows
|
||||
);
|
||||
|
||||
let mut buffer = Buffer::new(0, 0, "one\r\ntwo\rthree".into());
|
||||
assert_eq!(buffer.text(), "one\ntwo\nthree");
|
||||
assert_eq!(buffer.line_ending(), LineEnding::Windows);
|
||||
buffer.check_invariants();
|
||||
|
||||
buffer.edit([(buffer.len()..buffer.len(), "\r\nfour")]);
|
||||
buffer.edit([(0..0, "zero\r\n")]);
|
||||
assert_eq!(buffer.text(), "zero\none\ntwo\nthree\nfour");
|
||||
assert_eq!(buffer.line_ending(), LineEnding::Windows);
|
||||
buffer.check_invariants();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_line_len() {
|
||||
let mut buffer = Buffer::new(0, 0, "".into());
|
||||
buffer.edit([(0..0, "abcd\nefg\nhij")]);
|
||||
buffer.edit([(12..12, "kl\nmno")]);
|
||||
buffer.edit([(18..18, "\npqrs\n")]);
|
||||
buffer.edit([(18..21, "\nPQ")]);
|
||||
|
||||
assert_eq!(buffer.line_len(0), 4);
|
||||
assert_eq!(buffer.line_len(1), 3);
|
||||
assert_eq!(buffer.line_len(2), 5);
|
||||
assert_eq!(buffer.line_len(3), 3);
|
||||
assert_eq!(buffer.line_len(4), 4);
|
||||
assert_eq!(buffer.line_len(5), 0);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_common_prefix_at_position() {
|
||||
let text = "a = str; b = δα";
|
||||
let buffer = Buffer::new(0, 0, text.into());
|
||||
|
||||
let offset1 = offset_after(text, "str");
|
||||
let offset2 = offset_after(text, "δα");
|
||||
|
||||
// the preceding word is a prefix of the suggestion
|
||||
assert_eq!(
|
||||
buffer.common_prefix_at(offset1, "string"),
|
||||
range_of(text, "str"),
|
||||
);
|
||||
// a suffix of the preceding word is a prefix of the suggestion
|
||||
assert_eq!(
|
||||
buffer.common_prefix_at(offset1, "tree"),
|
||||
range_of(text, "tr"),
|
||||
);
|
||||
// the preceding word is a substring of the suggestion, but not a prefix
|
||||
assert_eq!(
|
||||
buffer.common_prefix_at(offset1, "astro"),
|
||||
empty_range_after(text, "str"),
|
||||
);
|
||||
|
||||
// prefix matching is case insensitive.
|
||||
assert_eq!(
|
||||
buffer.common_prefix_at(offset1, "Strαngε"),
|
||||
range_of(text, "str"),
|
||||
);
|
||||
assert_eq!(
|
||||
buffer.common_prefix_at(offset2, "ΔΑΜΝ"),
|
||||
range_of(text, "δα"),
|
||||
);
|
||||
|
||||
fn offset_after(text: &str, part: &str) -> usize {
|
||||
text.find(part).unwrap() + part.len()
|
||||
}
|
||||
|
||||
fn empty_range_after(text: &str, part: &str) -> Range<usize> {
|
||||
let offset = offset_after(text, part);
|
||||
offset..offset
|
||||
}
|
||||
|
||||
fn range_of(text: &str, part: &str) -> Range<usize> {
|
||||
let start = text.find(part).unwrap();
|
||||
start..start + part.len()
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_text_summary_for_range() {
|
||||
let buffer = Buffer::new(0, 0, "ab\nefg\nhklm\nnopqrs\ntuvwxyz".into());
|
||||
assert_eq!(
|
||||
buffer.text_summary_for_range::<TextSummary, _>(1..3),
|
||||
TextSummary {
|
||||
len: 2,
|
||||
len_utf16: OffsetUtf16(2),
|
||||
lines: Point::new(1, 0),
|
||||
first_line_chars: 1,
|
||||
last_line_chars: 0,
|
||||
last_line_len_utf16: 0,
|
||||
longest_row: 0,
|
||||
longest_row_chars: 1,
|
||||
}
|
||||
);
|
||||
assert_eq!(
|
||||
buffer.text_summary_for_range::<TextSummary, _>(1..12),
|
||||
TextSummary {
|
||||
len: 11,
|
||||
len_utf16: OffsetUtf16(11),
|
||||
lines: Point::new(3, 0),
|
||||
first_line_chars: 1,
|
||||
last_line_chars: 0,
|
||||
last_line_len_utf16: 0,
|
||||
longest_row: 2,
|
||||
longest_row_chars: 4,
|
||||
}
|
||||
);
|
||||
assert_eq!(
|
||||
buffer.text_summary_for_range::<TextSummary, _>(0..20),
|
||||
TextSummary {
|
||||
len: 20,
|
||||
len_utf16: OffsetUtf16(20),
|
||||
lines: Point::new(4, 1),
|
||||
first_line_chars: 2,
|
||||
last_line_chars: 1,
|
||||
last_line_len_utf16: 1,
|
||||
longest_row: 3,
|
||||
longest_row_chars: 6,
|
||||
}
|
||||
);
|
||||
assert_eq!(
|
||||
buffer.text_summary_for_range::<TextSummary, _>(0..22),
|
||||
TextSummary {
|
||||
len: 22,
|
||||
len_utf16: OffsetUtf16(22),
|
||||
lines: Point::new(4, 3),
|
||||
first_line_chars: 2,
|
||||
last_line_chars: 3,
|
||||
last_line_len_utf16: 3,
|
||||
longest_row: 3,
|
||||
longest_row_chars: 6,
|
||||
}
|
||||
);
|
||||
assert_eq!(
|
||||
buffer.text_summary_for_range::<TextSummary, _>(7..22),
|
||||
TextSummary {
|
||||
len: 15,
|
||||
len_utf16: OffsetUtf16(15),
|
||||
lines: Point::new(2, 3),
|
||||
first_line_chars: 4,
|
||||
last_line_chars: 3,
|
||||
last_line_len_utf16: 3,
|
||||
longest_row: 1,
|
||||
longest_row_chars: 6,
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_chars_at() {
|
||||
let mut buffer = Buffer::new(0, 0, "".into());
|
||||
buffer.edit([(0..0, "abcd\nefgh\nij")]);
|
||||
buffer.edit([(12..12, "kl\nmno")]);
|
||||
buffer.edit([(18..18, "\npqrs")]);
|
||||
buffer.edit([(18..21, "\nPQ")]);
|
||||
|
||||
let chars = buffer.chars_at(Point::new(0, 0));
|
||||
assert_eq!(chars.collect::<String>(), "abcd\nefgh\nijkl\nmno\nPQrs");
|
||||
|
||||
let chars = buffer.chars_at(Point::new(1, 0));
|
||||
assert_eq!(chars.collect::<String>(), "efgh\nijkl\nmno\nPQrs");
|
||||
|
||||
let chars = buffer.chars_at(Point::new(2, 0));
|
||||
assert_eq!(chars.collect::<String>(), "ijkl\nmno\nPQrs");
|
||||
|
||||
let chars = buffer.chars_at(Point::new(3, 0));
|
||||
assert_eq!(chars.collect::<String>(), "mno\nPQrs");
|
||||
|
||||
let chars = buffer.chars_at(Point::new(4, 0));
|
||||
assert_eq!(chars.collect::<String>(), "PQrs");
|
||||
|
||||
// Regression test:
|
||||
let mut buffer = Buffer::new(0, 0, "".into());
|
||||
buffer.edit([(0..0, "[workspace]\nmembers = [\n \"xray_core\",\n \"xray_server\",\n \"xray_cli\",\n \"xray_wasm\",\n]\n")]);
|
||||
buffer.edit([(60..60, "\n")]);
|
||||
|
||||
let chars = buffer.chars_at(Point::new(6, 0));
|
||||
assert_eq!(chars.collect::<String>(), " \"xray_wasm\",\n]\n");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_anchors() {
|
||||
let mut buffer = Buffer::new(0, 0, "".into());
|
||||
buffer.edit([(0..0, "abc")]);
|
||||
let left_anchor = buffer.anchor_before(2);
|
||||
let right_anchor = buffer.anchor_after(2);
|
||||
|
||||
buffer.edit([(1..1, "def\n")]);
|
||||
assert_eq!(buffer.text(), "adef\nbc");
|
||||
assert_eq!(left_anchor.to_offset(&buffer), 6);
|
||||
assert_eq!(right_anchor.to_offset(&buffer), 6);
|
||||
assert_eq!(left_anchor.to_point(&buffer), Point { row: 1, column: 1 });
|
||||
assert_eq!(right_anchor.to_point(&buffer), Point { row: 1, column: 1 });
|
||||
|
||||
buffer.edit([(2..3, "")]);
|
||||
assert_eq!(buffer.text(), "adf\nbc");
|
||||
assert_eq!(left_anchor.to_offset(&buffer), 5);
|
||||
assert_eq!(right_anchor.to_offset(&buffer), 5);
|
||||
assert_eq!(left_anchor.to_point(&buffer), Point { row: 1, column: 1 });
|
||||
assert_eq!(right_anchor.to_point(&buffer), Point { row: 1, column: 1 });
|
||||
|
||||
buffer.edit([(5..5, "ghi\n")]);
|
||||
assert_eq!(buffer.text(), "adf\nbghi\nc");
|
||||
assert_eq!(left_anchor.to_offset(&buffer), 5);
|
||||
assert_eq!(right_anchor.to_offset(&buffer), 9);
|
||||
assert_eq!(left_anchor.to_point(&buffer), Point { row: 1, column: 1 });
|
||||
assert_eq!(right_anchor.to_point(&buffer), Point { row: 2, column: 0 });
|
||||
|
||||
buffer.edit([(7..9, "")]);
|
||||
assert_eq!(buffer.text(), "adf\nbghc");
|
||||
assert_eq!(left_anchor.to_offset(&buffer), 5);
|
||||
assert_eq!(right_anchor.to_offset(&buffer), 7);
|
||||
assert_eq!(left_anchor.to_point(&buffer), Point { row: 1, column: 1 },);
|
||||
assert_eq!(right_anchor.to_point(&buffer), Point { row: 1, column: 3 });
|
||||
|
||||
// Ensure anchoring to a point is equivalent to anchoring to an offset.
|
||||
assert_eq!(
|
||||
buffer.anchor_before(Point { row: 0, column: 0 }),
|
||||
buffer.anchor_before(0)
|
||||
);
|
||||
assert_eq!(
|
||||
buffer.anchor_before(Point { row: 0, column: 1 }),
|
||||
buffer.anchor_before(1)
|
||||
);
|
||||
assert_eq!(
|
||||
buffer.anchor_before(Point { row: 0, column: 2 }),
|
||||
buffer.anchor_before(2)
|
||||
);
|
||||
assert_eq!(
|
||||
buffer.anchor_before(Point { row: 0, column: 3 }),
|
||||
buffer.anchor_before(3)
|
||||
);
|
||||
assert_eq!(
|
||||
buffer.anchor_before(Point { row: 1, column: 0 }),
|
||||
buffer.anchor_before(4)
|
||||
);
|
||||
assert_eq!(
|
||||
buffer.anchor_before(Point { row: 1, column: 1 }),
|
||||
buffer.anchor_before(5)
|
||||
);
|
||||
assert_eq!(
|
||||
buffer.anchor_before(Point { row: 1, column: 2 }),
|
||||
buffer.anchor_before(6)
|
||||
);
|
||||
assert_eq!(
|
||||
buffer.anchor_before(Point { row: 1, column: 3 }),
|
||||
buffer.anchor_before(7)
|
||||
);
|
||||
assert_eq!(
|
||||
buffer.anchor_before(Point { row: 1, column: 4 }),
|
||||
buffer.anchor_before(8)
|
||||
);
|
||||
|
||||
// Comparison between anchors.
|
||||
let anchor_at_offset_0 = buffer.anchor_before(0);
|
||||
let anchor_at_offset_1 = buffer.anchor_before(1);
|
||||
let anchor_at_offset_2 = buffer.anchor_before(2);
|
||||
|
||||
assert_eq!(
|
||||
anchor_at_offset_0.cmp(&anchor_at_offset_0, &buffer),
|
||||
Ordering::Equal
|
||||
);
|
||||
assert_eq!(
|
||||
anchor_at_offset_1.cmp(&anchor_at_offset_1, &buffer),
|
||||
Ordering::Equal
|
||||
);
|
||||
assert_eq!(
|
||||
anchor_at_offset_2.cmp(&anchor_at_offset_2, &buffer),
|
||||
Ordering::Equal
|
||||
);
|
||||
|
||||
assert_eq!(
|
||||
anchor_at_offset_0.cmp(&anchor_at_offset_1, &buffer),
|
||||
Ordering::Less
|
||||
);
|
||||
assert_eq!(
|
||||
anchor_at_offset_1.cmp(&anchor_at_offset_2, &buffer),
|
||||
Ordering::Less
|
||||
);
|
||||
assert_eq!(
|
||||
anchor_at_offset_0.cmp(&anchor_at_offset_2, &buffer),
|
||||
Ordering::Less
|
||||
);
|
||||
|
||||
assert_eq!(
|
||||
anchor_at_offset_1.cmp(&anchor_at_offset_0, &buffer),
|
||||
Ordering::Greater
|
||||
);
|
||||
assert_eq!(
|
||||
anchor_at_offset_2.cmp(&anchor_at_offset_1, &buffer),
|
||||
Ordering::Greater
|
||||
);
|
||||
assert_eq!(
|
||||
anchor_at_offset_2.cmp(&anchor_at_offset_0, &buffer),
|
||||
Ordering::Greater
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_anchors_at_start_and_end() {
|
||||
let mut buffer = Buffer::new(0, 0, "".into());
|
||||
let before_start_anchor = buffer.anchor_before(0);
|
||||
let after_end_anchor = buffer.anchor_after(0);
|
||||
|
||||
buffer.edit([(0..0, "abc")]);
|
||||
assert_eq!(buffer.text(), "abc");
|
||||
assert_eq!(before_start_anchor.to_offset(&buffer), 0);
|
||||
assert_eq!(after_end_anchor.to_offset(&buffer), 3);
|
||||
|
||||
let after_start_anchor = buffer.anchor_after(0);
|
||||
let before_end_anchor = buffer.anchor_before(3);
|
||||
|
||||
buffer.edit([(3..3, "def")]);
|
||||
buffer.edit([(0..0, "ghi")]);
|
||||
assert_eq!(buffer.text(), "ghiabcdef");
|
||||
assert_eq!(before_start_anchor.to_offset(&buffer), 0);
|
||||
assert_eq!(after_start_anchor.to_offset(&buffer), 3);
|
||||
assert_eq!(before_end_anchor.to_offset(&buffer), 6);
|
||||
assert_eq!(after_end_anchor.to_offset(&buffer), 9);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_undo_redo() {
|
||||
let mut buffer = Buffer::new(0, 0, "1234".into());
|
||||
// Set group interval to zero so as to not group edits in the undo stack.
|
||||
buffer.set_group_interval(Duration::from_secs(0));
|
||||
|
||||
buffer.edit([(1..1, "abx")]);
|
||||
buffer.edit([(3..4, "yzef")]);
|
||||
buffer.edit([(3..5, "cd")]);
|
||||
assert_eq!(buffer.text(), "1abcdef234");
|
||||
|
||||
let entries = buffer.history.undo_stack.clone();
|
||||
assert_eq!(entries.len(), 3);
|
||||
|
||||
buffer.undo_or_redo(entries[0].transaction.clone()).unwrap();
|
||||
assert_eq!(buffer.text(), "1cdef234");
|
||||
buffer.undo_or_redo(entries[0].transaction.clone()).unwrap();
|
||||
assert_eq!(buffer.text(), "1abcdef234");
|
||||
|
||||
buffer.undo_or_redo(entries[1].transaction.clone()).unwrap();
|
||||
assert_eq!(buffer.text(), "1abcdx234");
|
||||
buffer.undo_or_redo(entries[2].transaction.clone()).unwrap();
|
||||
assert_eq!(buffer.text(), "1abx234");
|
||||
buffer.undo_or_redo(entries[1].transaction.clone()).unwrap();
|
||||
assert_eq!(buffer.text(), "1abyzef234");
|
||||
buffer.undo_or_redo(entries[2].transaction.clone()).unwrap();
|
||||
assert_eq!(buffer.text(), "1abcdef234");
|
||||
|
||||
buffer.undo_or_redo(entries[2].transaction.clone()).unwrap();
|
||||
assert_eq!(buffer.text(), "1abyzef234");
|
||||
buffer.undo_or_redo(entries[0].transaction.clone()).unwrap();
|
||||
assert_eq!(buffer.text(), "1yzef234");
|
||||
buffer.undo_or_redo(entries[1].transaction.clone()).unwrap();
|
||||
assert_eq!(buffer.text(), "1234");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_history() {
|
||||
let mut now = Instant::now();
|
||||
let mut buffer = Buffer::new(0, 0, "123456".into());
|
||||
buffer.set_group_interval(Duration::from_millis(300));
|
||||
|
||||
let transaction_1 = buffer.start_transaction_at(now).unwrap();
|
||||
buffer.edit([(2..4, "cd")]);
|
||||
buffer.end_transaction_at(now);
|
||||
assert_eq!(buffer.text(), "12cd56");
|
||||
|
||||
buffer.start_transaction_at(now);
|
||||
buffer.edit([(4..5, "e")]);
|
||||
buffer.end_transaction_at(now).unwrap();
|
||||
assert_eq!(buffer.text(), "12cde6");
|
||||
|
||||
now += buffer.transaction_group_interval() + Duration::from_millis(1);
|
||||
buffer.start_transaction_at(now);
|
||||
buffer.edit([(0..1, "a")]);
|
||||
buffer.edit([(1..1, "b")]);
|
||||
buffer.end_transaction_at(now).unwrap();
|
||||
assert_eq!(buffer.text(), "ab2cde6");
|
||||
|
||||
// Last transaction happened past the group interval, undo it on its own.
|
||||
buffer.undo();
|
||||
assert_eq!(buffer.text(), "12cde6");
|
||||
|
||||
// First two transactions happened within the group interval, undo them together.
|
||||
buffer.undo();
|
||||
assert_eq!(buffer.text(), "123456");
|
||||
|
||||
// Redo the first two transactions together.
|
||||
buffer.redo();
|
||||
assert_eq!(buffer.text(), "12cde6");
|
||||
|
||||
// Redo the last transaction on its own.
|
||||
buffer.redo();
|
||||
assert_eq!(buffer.text(), "ab2cde6");
|
||||
|
||||
buffer.start_transaction_at(now);
|
||||
assert!(buffer.end_transaction_at(now).is_none());
|
||||
buffer.undo();
|
||||
assert_eq!(buffer.text(), "12cde6");
|
||||
|
||||
// Redo stack gets cleared after performing an edit.
|
||||
buffer.start_transaction_at(now);
|
||||
buffer.edit([(0..0, "X")]);
|
||||
buffer.end_transaction_at(now);
|
||||
assert_eq!(buffer.text(), "X12cde6");
|
||||
buffer.redo();
|
||||
assert_eq!(buffer.text(), "X12cde6");
|
||||
buffer.undo();
|
||||
assert_eq!(buffer.text(), "12cde6");
|
||||
buffer.undo();
|
||||
assert_eq!(buffer.text(), "123456");
|
||||
|
||||
// Transactions can be grouped manually.
|
||||
buffer.redo();
|
||||
buffer.redo();
|
||||
assert_eq!(buffer.text(), "X12cde6");
|
||||
buffer.group_until_transaction(transaction_1);
|
||||
buffer.undo();
|
||||
assert_eq!(buffer.text(), "123456");
|
||||
buffer.redo();
|
||||
assert_eq!(buffer.text(), "X12cde6");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_finalize_last_transaction() {
|
||||
let now = Instant::now();
|
||||
let mut buffer = Buffer::new(0, 0, "123456".into());
|
||||
|
||||
buffer.start_transaction_at(now);
|
||||
buffer.edit([(2..4, "cd")]);
|
||||
buffer.end_transaction_at(now);
|
||||
assert_eq!(buffer.text(), "12cd56");
|
||||
|
||||
buffer.finalize_last_transaction();
|
||||
buffer.start_transaction_at(now);
|
||||
buffer.edit([(4..5, "e")]);
|
||||
buffer.end_transaction_at(now).unwrap();
|
||||
assert_eq!(buffer.text(), "12cde6");
|
||||
|
||||
buffer.start_transaction_at(now);
|
||||
buffer.edit([(0..1, "a")]);
|
||||
buffer.edit([(1..1, "b")]);
|
||||
buffer.end_transaction_at(now).unwrap();
|
||||
assert_eq!(buffer.text(), "ab2cde6");
|
||||
|
||||
buffer.undo();
|
||||
assert_eq!(buffer.text(), "12cd56");
|
||||
|
||||
buffer.undo();
|
||||
assert_eq!(buffer.text(), "123456");
|
||||
|
||||
buffer.redo();
|
||||
assert_eq!(buffer.text(), "12cd56");
|
||||
|
||||
buffer.redo();
|
||||
assert_eq!(buffer.text(), "ab2cde6");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_edited_ranges_for_transaction() {
|
||||
let now = Instant::now();
|
||||
let mut buffer = Buffer::new(0, 0, "1234567".into());
|
||||
|
||||
buffer.start_transaction_at(now);
|
||||
buffer.edit([(2..4, "cd")]);
|
||||
buffer.edit([(6..6, "efg")]);
|
||||
buffer.end_transaction_at(now);
|
||||
assert_eq!(buffer.text(), "12cd56efg7");
|
||||
|
||||
let tx = buffer.finalize_last_transaction().unwrap().clone();
|
||||
assert_eq!(
|
||||
buffer
|
||||
.edited_ranges_for_transaction::<usize>(&tx)
|
||||
.collect::<Vec<_>>(),
|
||||
[2..4, 6..9]
|
||||
);
|
||||
|
||||
buffer.edit([(5..5, "hijk")]);
|
||||
assert_eq!(buffer.text(), "12cd5hijk6efg7");
|
||||
assert_eq!(
|
||||
buffer
|
||||
.edited_ranges_for_transaction::<usize>(&tx)
|
||||
.collect::<Vec<_>>(),
|
||||
[2..4, 10..13]
|
||||
);
|
||||
|
||||
buffer.edit([(4..4, "l")]);
|
||||
assert_eq!(buffer.text(), "12cdl5hijk6efg7");
|
||||
assert_eq!(
|
||||
buffer
|
||||
.edited_ranges_for_transaction::<usize>(&tx)
|
||||
.collect::<Vec<_>>(),
|
||||
[2..4, 11..14]
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_concurrent_edits() {
|
||||
let text = "abcdef";
|
||||
|
||||
let mut buffer1 = Buffer::new(1, 0, text.into());
|
||||
let mut buffer2 = Buffer::new(2, 0, text.into());
|
||||
let mut buffer3 = Buffer::new(3, 0, text.into());
|
||||
|
||||
let buf1_op = buffer1.edit([(1..2, "12")]);
|
||||
assert_eq!(buffer1.text(), "a12cdef");
|
||||
let buf2_op = buffer2.edit([(3..4, "34")]);
|
||||
assert_eq!(buffer2.text(), "abc34ef");
|
||||
let buf3_op = buffer3.edit([(5..6, "56")]);
|
||||
assert_eq!(buffer3.text(), "abcde56");
|
||||
|
||||
buffer1.apply_op(buf2_op.clone()).unwrap();
|
||||
buffer1.apply_op(buf3_op.clone()).unwrap();
|
||||
buffer2.apply_op(buf1_op.clone()).unwrap();
|
||||
buffer2.apply_op(buf3_op).unwrap();
|
||||
buffer3.apply_op(buf1_op).unwrap();
|
||||
buffer3.apply_op(buf2_op).unwrap();
|
||||
|
||||
assert_eq!(buffer1.text(), "a12c34e56");
|
||||
assert_eq!(buffer2.text(), "a12c34e56");
|
||||
assert_eq!(buffer3.text(), "a12c34e56");
|
||||
}
|
||||
|
||||
#[gpui2::test(iterations = 100)]
|
||||
fn test_random_concurrent_edits(mut rng: StdRng) {
|
||||
let peers = env::var("PEERS")
|
||||
.map(|i| i.parse().expect("invalid `PEERS` variable"))
|
||||
.unwrap_or(5);
|
||||
let operations = env::var("OPERATIONS")
|
||||
.map(|i| i.parse().expect("invalid `OPERATIONS` variable"))
|
||||
.unwrap_or(10);
|
||||
|
||||
let base_text_len = rng.gen_range(0..10);
|
||||
let base_text = RandomCharIter::new(&mut rng)
|
||||
.take(base_text_len)
|
||||
.collect::<String>();
|
||||
let mut replica_ids = Vec::new();
|
||||
let mut buffers = Vec::new();
|
||||
let mut network = Network::new(rng.clone());
|
||||
|
||||
for i in 0..peers {
|
||||
let mut buffer = Buffer::new(i as ReplicaId, 0, base_text.clone());
|
||||
buffer.history.group_interval = Duration::from_millis(rng.gen_range(0..=200));
|
||||
buffers.push(buffer);
|
||||
replica_ids.push(i as u16);
|
||||
network.add_peer(i as u16);
|
||||
}
|
||||
|
||||
log::info!("initial text: {:?}", base_text);
|
||||
|
||||
let mut mutation_count = operations;
|
||||
loop {
|
||||
let replica_index = rng.gen_range(0..peers);
|
||||
let replica_id = replica_ids[replica_index];
|
||||
let buffer = &mut buffers[replica_index];
|
||||
match rng.gen_range(0..=100) {
|
||||
0..=50 if mutation_count != 0 => {
|
||||
let op = buffer.randomly_edit(&mut rng, 5).1;
|
||||
network.broadcast(buffer.replica_id, vec![op]);
|
||||
log::info!("buffer {} text: {:?}", buffer.replica_id, buffer.text());
|
||||
mutation_count -= 1;
|
||||
}
|
||||
51..=70 if mutation_count != 0 => {
|
||||
let ops = buffer.randomly_undo_redo(&mut rng);
|
||||
network.broadcast(buffer.replica_id, ops);
|
||||
mutation_count -= 1;
|
||||
}
|
||||
71..=100 if network.has_unreceived(replica_id) => {
|
||||
let ops = network.receive(replica_id);
|
||||
if !ops.is_empty() {
|
||||
log::info!(
|
||||
"peer {} applying {} ops from the network.",
|
||||
replica_id,
|
||||
ops.len()
|
||||
);
|
||||
buffer.apply_ops(ops).unwrap();
|
||||
}
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
buffer.check_invariants();
|
||||
|
||||
if mutation_count == 0 && network.is_idle() {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
let first_buffer = &buffers[0];
|
||||
for buffer in &buffers[1..] {
|
||||
assert_eq!(
|
||||
buffer.text(),
|
||||
first_buffer.text(),
|
||||
"Replica {} text != Replica 0 text",
|
||||
buffer.replica_id
|
||||
);
|
||||
buffer.check_invariants();
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,112 @@
|
||||
use crate::UndoOperation;
|
||||
use std::cmp;
|
||||
use sum_tree::{Bias, SumTree};
|
||||
|
||||
#[derive(Copy, Clone, Debug)]
|
||||
struct UndoMapEntry {
|
||||
key: UndoMapKey,
|
||||
undo_count: u32,
|
||||
}
|
||||
|
||||
impl sum_tree::Item for UndoMapEntry {
|
||||
type Summary = UndoMapKey;
|
||||
|
||||
fn summary(&self) -> Self::Summary {
|
||||
self.key
|
||||
}
|
||||
}
|
||||
|
||||
impl sum_tree::KeyedItem for UndoMapEntry {
|
||||
type Key = UndoMapKey;
|
||||
|
||||
fn key(&self) -> Self::Key {
|
||||
self.key
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Debug, Default, PartialEq, Eq, PartialOrd, Ord)]
|
||||
struct UndoMapKey {
|
||||
edit_id: clock::Lamport,
|
||||
undo_id: clock::Lamport,
|
||||
}
|
||||
|
||||
impl sum_tree::Summary for UndoMapKey {
|
||||
type Context = ();
|
||||
|
||||
fn add_summary(&mut self, summary: &Self, _: &Self::Context) {
|
||||
*self = cmp::max(*self, *summary);
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Default)]
|
||||
pub struct UndoMap(SumTree<UndoMapEntry>);
|
||||
|
||||
impl UndoMap {
|
||||
pub fn insert(&mut self, undo: &UndoOperation) {
|
||||
let edits = undo
|
||||
.counts
|
||||
.iter()
|
||||
.map(|(edit_id, count)| {
|
||||
sum_tree::Edit::Insert(UndoMapEntry {
|
||||
key: UndoMapKey {
|
||||
edit_id: *edit_id,
|
||||
undo_id: undo.timestamp,
|
||||
},
|
||||
undo_count: *count,
|
||||
})
|
||||
})
|
||||
.collect::<Vec<_>>();
|
||||
self.0.edit(edits, &());
|
||||
}
|
||||
|
||||
pub fn is_undone(&self, edit_id: clock::Lamport) -> bool {
|
||||
self.undo_count(edit_id) % 2 == 1
|
||||
}
|
||||
|
||||
pub fn was_undone(&self, edit_id: clock::Lamport, version: &clock::Global) -> bool {
|
||||
let mut cursor = self.0.cursor::<UndoMapKey>();
|
||||
cursor.seek(
|
||||
&UndoMapKey {
|
||||
edit_id,
|
||||
undo_id: Default::default(),
|
||||
},
|
||||
Bias::Left,
|
||||
&(),
|
||||
);
|
||||
|
||||
let mut undo_count = 0;
|
||||
for entry in cursor {
|
||||
if entry.key.edit_id != edit_id {
|
||||
break;
|
||||
}
|
||||
|
||||
if version.observed(entry.key.undo_id) {
|
||||
undo_count = cmp::max(undo_count, entry.undo_count);
|
||||
}
|
||||
}
|
||||
|
||||
undo_count % 2 == 1
|
||||
}
|
||||
|
||||
pub fn undo_count(&self, edit_id: clock::Lamport) -> u32 {
|
||||
let mut cursor = self.0.cursor::<UndoMapKey>();
|
||||
cursor.seek(
|
||||
&UndoMapKey {
|
||||
edit_id,
|
||||
undo_id: Default::default(),
|
||||
},
|
||||
Bias::Left,
|
||||
&(),
|
||||
);
|
||||
|
||||
let mut undo_count = 0;
|
||||
for entry in cursor {
|
||||
if entry.key.edit_id != edit_id {
|
||||
break;
|
||||
}
|
||||
|
||||
undo_count = cmp::max(undo_count, entry.undo_count);
|
||||
}
|
||||
undo_count
|
||||
}
|
||||
}
|
||||
@@ -16,19 +16,19 @@ path = "src/theme2.rs"
|
||||
doctest = false
|
||||
|
||||
[dependencies]
|
||||
gpui2 = { path = "../gpui2" }
|
||||
fs = { path = "../fs" }
|
||||
schemars.workspace = true
|
||||
settings2 = { path = "../settings2" }
|
||||
util = { path = "../util" }
|
||||
|
||||
anyhow.workspace = true
|
||||
fs = { path = "../fs" }
|
||||
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
|
||||
settings2 = { path = "../settings2" }
|
||||
toml.workspace = true
|
||||
util = { path = "../util" }
|
||||
|
||||
[dev-dependencies]
|
||||
gpui2 = { path = "../gpui2", features = ["test-support"] }
|
||||
|
||||
@@ -0,0 +1,144 @@
|
||||
use gpui2::Hsla;
|
||||
use refineable::Refineable;
|
||||
|
||||
use crate::SyntaxTheme;
|
||||
|
||||
#[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,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy)]
|
||||
pub struct PlayerColor {
|
||||
pub cursor: Hsla,
|
||||
pub background: Hsla,
|
||||
pub selection: Hsla,
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct PlayerColors(pub Vec<PlayerColor>);
|
||||
|
||||
#[derive(Refineable, Clone, Debug)]
|
||||
#[refineable(debug)]
|
||||
pub struct StatusColors {
|
||||
pub conflict: Hsla,
|
||||
pub created: Hsla,
|
||||
pub deleted: Hsla,
|
||||
pub error: Hsla,
|
||||
pub hidden: Hsla,
|
||||
pub ignored: Hsla,
|
||||
pub info: Hsla,
|
||||
pub modified: Hsla,
|
||||
pub renamed: Hsla,
|
||||
pub success: Hsla,
|
||||
pub warning: Hsla,
|
||||
}
|
||||
|
||||
#[derive(Refineable, Clone, Debug)]
|
||||
#[refineable(debug)]
|
||||
pub struct GitStatusColors {
|
||||
pub conflict: Hsla,
|
||||
pub created: Hsla,
|
||||
pub deleted: Hsla,
|
||||
pub ignored: Hsla,
|
||||
pub modified: Hsla,
|
||||
pub renamed: Hsla,
|
||||
}
|
||||
|
||||
#[derive(Refineable, Clone, Debug, Default)]
|
||||
#[refineable(debug)]
|
||||
pub struct ThemeColors {
|
||||
pub border: Hsla,
|
||||
pub border_variant: Hsla,
|
||||
pub border_focused: Hsla,
|
||||
pub border_transparent: Hsla,
|
||||
pub elevated_surface: Hsla,
|
||||
pub surface: Hsla,
|
||||
pub background: Hsla,
|
||||
pub element: Hsla,
|
||||
pub element_hover: Hsla,
|
||||
pub element_active: Hsla,
|
||||
pub element_selected: Hsla,
|
||||
pub element_disabled: Hsla,
|
||||
pub element_placeholder: Hsla,
|
||||
pub ghost_element: Hsla,
|
||||
pub ghost_element_hover: Hsla,
|
||||
pub ghost_element_active: Hsla,
|
||||
pub ghost_element_selected: Hsla,
|
||||
pub ghost_element_disabled: Hsla,
|
||||
pub text: Hsla,
|
||||
pub text_muted: Hsla,
|
||||
pub text_placeholder: Hsla,
|
||||
pub text_disabled: Hsla,
|
||||
pub text_accent: Hsla,
|
||||
pub icon: Hsla,
|
||||
pub icon_muted: Hsla,
|
||||
pub icon_disabled: Hsla,
|
||||
pub icon_placeholder: Hsla,
|
||||
pub icon_accent: Hsla,
|
||||
pub status_bar: Hsla,
|
||||
pub title_bar: Hsla,
|
||||
pub toolbar: Hsla,
|
||||
pub tab_bar: Hsla,
|
||||
pub editor: Hsla,
|
||||
pub editor_subheader: Hsla,
|
||||
pub editor_active_line: Hsla,
|
||||
}
|
||||
|
||||
#[derive(Refineable, Clone)]
|
||||
pub struct ThemeStyles {
|
||||
pub system: SystemColors,
|
||||
pub colors: ThemeColors,
|
||||
pub status: StatusColors,
|
||||
pub git: GitStatusColors,
|
||||
pub player: PlayerColors,
|
||||
pub syntax: SyntaxTheme,
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn override_a_single_theme_color() {
|
||||
let mut colors = ThemeColors::default_light();
|
||||
|
||||
let magenta: Hsla = gpui2::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::default_light();
|
||||
|
||||
let magenta: Hsla = gpui2::rgb(0xff00ff);
|
||||
let green: Hsla = gpui2::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);
|
||||
}
|
||||
}
|
||||
@@ -1,79 +1,350 @@
|
||||
use gpui2::Rgba;
|
||||
use indexmap::IndexMap;
|
||||
use std::num::ParseIntError;
|
||||
|
||||
use crate::scale::{ColorScaleName, ColorScaleSet, ColorScales};
|
||||
use gpui2::{hsla, Hsla, Rgba};
|
||||
|
||||
struct DefaultColorScaleSet {
|
||||
scale: ColorScaleName,
|
||||
light: [&'static str; 12],
|
||||
light_alpha: [&'static str; 12],
|
||||
dark: [&'static str; 12],
|
||||
dark_alpha: [&'static str; 12],
|
||||
use crate::{
|
||||
colors::{GitStatusColors, PlayerColor, PlayerColors, StatusColors, SystemColors, ThemeColors},
|
||||
scale::{ColorScaleSet, ColorScales},
|
||||
syntax::SyntaxTheme,
|
||||
ColorScale,
|
||||
};
|
||||
|
||||
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),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<DefaultColorScaleSet> for ColorScaleSet {
|
||||
fn from(default: DefaultColorScaleSet) -> Self {
|
||||
Self::new(
|
||||
default.scale,
|
||||
default
|
||||
.light
|
||||
.map(|color| Rgba::try_from(color).unwrap().into()),
|
||||
default
|
||||
.light_alpha
|
||||
.map(|color| Rgba::try_from(color).unwrap().into()),
|
||||
default
|
||||
.dark
|
||||
.map(|color| Rgba::try_from(color).unwrap().into()),
|
||||
default
|
||||
.dark_alpha
|
||||
.map(|color| Rgba::try_from(color).unwrap().into()),
|
||||
)
|
||||
impl Default for StatusColors {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
conflict: red().dark().step_11(),
|
||||
created: gpui2::black(),
|
||||
deleted: gpui2::black(),
|
||||
error: gpui2::black(),
|
||||
hidden: gpui2::black(),
|
||||
ignored: gpui2::black(),
|
||||
info: gpui2::black(),
|
||||
modified: gpui2::black(),
|
||||
renamed: gpui2::black(),
|
||||
success: gpui2::black(),
|
||||
warning: gpui2::black(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for GitStatusColors {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
conflict: gpui2::rgba(0xdec184ff).into(),
|
||||
created: gpui2::rgba(0xa1c181ff).into(),
|
||||
deleted: gpui2::rgba(0xd07277ff).into(),
|
||||
ignored: gpui2::rgba(0x555a63ff).into(),
|
||||
modified: gpui2::rgba(0x74ade8ff).into(),
|
||||
renamed: gpui2::rgba(0xdec184ff).into(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for PlayerColors {
|
||||
fn default() -> Self {
|
||||
Self(vec![
|
||||
PlayerColor {
|
||||
cursor: hsla(0.0, 0.0, 0.0, 0.0),
|
||||
background: hsla(0.0, 0.0, 0.0, 0.0),
|
||||
selection: hsla(0.0, 0.0, 0.0, 0.0),
|
||||
},
|
||||
PlayerColor {
|
||||
cursor: hsla(0.0, 0.0, 0.0, 0.0),
|
||||
background: hsla(0.0, 0.0, 0.0, 0.0),
|
||||
selection: hsla(0.0, 0.0, 0.0, 0.0),
|
||||
},
|
||||
PlayerColor {
|
||||
cursor: hsla(0.0, 0.0, 0.0, 0.0),
|
||||
background: hsla(0.0, 0.0, 0.0, 0.0),
|
||||
selection: hsla(0.0, 0.0, 0.0, 0.0),
|
||||
},
|
||||
PlayerColor {
|
||||
cursor: hsla(0.0, 0.0, 0.0, 0.0),
|
||||
background: hsla(0.0, 0.0, 0.0, 0.0),
|
||||
selection: hsla(0.0, 0.0, 0.0, 0.0),
|
||||
},
|
||||
])
|
||||
}
|
||||
}
|
||||
|
||||
impl SyntaxTheme {
|
||||
pub fn default_light() -> Self {
|
||||
Self {
|
||||
highlights: vec![
|
||||
(
|
||||
"string.special.symbol".into(),
|
||||
gpui2::rgba(0xad6e26ff).into(),
|
||||
),
|
||||
("hint".into(), gpui2::rgba(0x9294beff).into()),
|
||||
("link_uri".into(), gpui2::rgba(0x3882b7ff).into()),
|
||||
("type".into(), gpui2::rgba(0x3882b7ff).into()),
|
||||
("string.regex".into(), gpui2::rgba(0xad6e26ff).into()),
|
||||
("constant".into(), gpui2::rgba(0x669f59ff).into()),
|
||||
("function".into(), gpui2::rgba(0x5b79e3ff).into()),
|
||||
("string.special".into(), gpui2::rgba(0xad6e26ff).into()),
|
||||
("punctuation.bracket".into(), gpui2::rgba(0x4d4f52ff).into()),
|
||||
("variable".into(), gpui2::rgba(0x383a41ff).into()),
|
||||
("punctuation".into(), gpui2::rgba(0x383a41ff).into()),
|
||||
("property".into(), gpui2::rgba(0xd3604fff).into()),
|
||||
("string".into(), gpui2::rgba(0x649f57ff).into()),
|
||||
("predictive".into(), gpui2::rgba(0x9b9ec6ff).into()),
|
||||
("attribute".into(), gpui2::rgba(0x5c78e2ff).into()),
|
||||
("number".into(), gpui2::rgba(0xad6e25ff).into()),
|
||||
("constructor".into(), gpui2::rgba(0x5c78e2ff).into()),
|
||||
("embedded".into(), gpui2::rgba(0x383a41ff).into()),
|
||||
("title".into(), gpui2::rgba(0xd3604fff).into()),
|
||||
("tag".into(), gpui2::rgba(0x5c78e2ff).into()),
|
||||
("boolean".into(), gpui2::rgba(0xad6e25ff).into()),
|
||||
(
|
||||
"punctuation.list_marker".into(),
|
||||
gpui2::rgba(0xd3604fff).into(),
|
||||
),
|
||||
("variant".into(), gpui2::rgba(0x5b79e3ff).into()),
|
||||
("emphasis".into(), gpui2::rgba(0x5c78e2ff).into()),
|
||||
("link_text".into(), gpui2::rgba(0x5b79e3ff).into()),
|
||||
("comment".into(), gpui2::rgba(0xa2a3a7ff).into()),
|
||||
("punctuation.special".into(), gpui2::rgba(0xb92b46ff).into()),
|
||||
("emphasis.strong".into(), gpui2::rgba(0xad6e25ff).into()),
|
||||
("primary".into(), gpui2::rgba(0x383a41ff).into()),
|
||||
(
|
||||
"punctuation.delimiter".into(),
|
||||
gpui2::rgba(0x4d4f52ff).into(),
|
||||
),
|
||||
("label".into(), gpui2::rgba(0x5c78e2ff).into()),
|
||||
("keyword".into(), gpui2::rgba(0xa449abff).into()),
|
||||
("string.escape".into(), gpui2::rgba(0x7c7e86ff).into()),
|
||||
("text.literal".into(), gpui2::rgba(0x649f57ff).into()),
|
||||
("variable.special".into(), gpui2::rgba(0xad6e25ff).into()),
|
||||
("comment.doc".into(), gpui2::rgba(0x7c7e86ff).into()),
|
||||
("enum".into(), gpui2::rgba(0xd3604fff).into()),
|
||||
("operator".into(), gpui2::rgba(0x3882b7ff).into()),
|
||||
("preproc".into(), gpui2::rgba(0x383a41ff).into()),
|
||||
],
|
||||
}
|
||||
}
|
||||
|
||||
pub fn default_dark() -> Self {
|
||||
Self {
|
||||
highlights: vec![
|
||||
("keyword".into(), gpui2::rgba(0xb477cfff).into()),
|
||||
("comment.doc".into(), gpui2::rgba(0x878e98ff).into()),
|
||||
("variant".into(), gpui2::rgba(0x73ade9ff).into()),
|
||||
("property".into(), gpui2::rgba(0xd07277ff).into()),
|
||||
("function".into(), gpui2::rgba(0x73ade9ff).into()),
|
||||
("type".into(), gpui2::rgba(0x6eb4bfff).into()),
|
||||
("tag".into(), gpui2::rgba(0x74ade8ff).into()),
|
||||
("string.escape".into(), gpui2::rgba(0x878e98ff).into()),
|
||||
("punctuation.bracket".into(), gpui2::rgba(0xb2b9c6ff).into()),
|
||||
("hint".into(), gpui2::rgba(0x5a6f89ff).into()),
|
||||
("punctuation".into(), gpui2::rgba(0xacb2beff).into()),
|
||||
("comment".into(), gpui2::rgba(0x5d636fff).into()),
|
||||
("emphasis".into(), gpui2::rgba(0x74ade8ff).into()),
|
||||
("punctuation.special".into(), gpui2::rgba(0xb1574bff).into()),
|
||||
("link_uri".into(), gpui2::rgba(0x6eb4bfff).into()),
|
||||
("string.regex".into(), gpui2::rgba(0xbf956aff).into()),
|
||||
("constructor".into(), gpui2::rgba(0x73ade9ff).into()),
|
||||
("operator".into(), gpui2::rgba(0x6eb4bfff).into()),
|
||||
("constant".into(), gpui2::rgba(0xdfc184ff).into()),
|
||||
("string.special".into(), gpui2::rgba(0xbf956aff).into()),
|
||||
("emphasis.strong".into(), gpui2::rgba(0xbf956aff).into()),
|
||||
(
|
||||
"string.special.symbol".into(),
|
||||
gpui2::rgba(0xbf956aff).into(),
|
||||
),
|
||||
("primary".into(), gpui2::rgba(0xacb2beff).into()),
|
||||
("preproc".into(), gpui2::rgba(0xc8ccd4ff).into()),
|
||||
("string".into(), gpui2::rgba(0xa1c181ff).into()),
|
||||
(
|
||||
"punctuation.delimiter".into(),
|
||||
gpui2::rgba(0xb2b9c6ff).into(),
|
||||
),
|
||||
("embedded".into(), gpui2::rgba(0xc8ccd4ff).into()),
|
||||
("enum".into(), gpui2::rgba(0xd07277ff).into()),
|
||||
("variable.special".into(), gpui2::rgba(0xbf956aff).into()),
|
||||
("text.literal".into(), gpui2::rgba(0xa1c181ff).into()),
|
||||
("attribute".into(), gpui2::rgba(0x74ade8ff).into()),
|
||||
("link_text".into(), gpui2::rgba(0x73ade9ff).into()),
|
||||
("title".into(), gpui2::rgba(0xd07277ff).into()),
|
||||
("predictive".into(), gpui2::rgba(0x5a6a87ff).into()),
|
||||
("number".into(), gpui2::rgba(0xbf956aff).into()),
|
||||
("label".into(), gpui2::rgba(0x74ade8ff).into()),
|
||||
("variable".into(), gpui2::rgba(0xc8ccd4ff).into()),
|
||||
("boolean".into(), gpui2::rgba(0xbf956aff).into()),
|
||||
(
|
||||
"punctuation.list_marker".into(),
|
||||
gpui2::rgba(0xd07277ff).into(),
|
||||
),
|
||||
],
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl ThemeColors {
|
||||
pub fn default_light() -> Self {
|
||||
Self {
|
||||
border: gpui2::white(),
|
||||
border_variant: gpui2::white(),
|
||||
border_focused: gpui2::white(),
|
||||
border_transparent: gpui2::white(),
|
||||
elevated_surface: gpui2::white(),
|
||||
surface: gpui2::white(),
|
||||
background: gpui2::white(),
|
||||
element: gpui2::white(),
|
||||
element_hover: gpui2::white(),
|
||||
element_active: gpui2::white(),
|
||||
element_selected: gpui2::white(),
|
||||
element_disabled: gpui2::white(),
|
||||
element_placeholder: gpui2::white(),
|
||||
ghost_element: gpui2::white(),
|
||||
ghost_element_hover: gpui2::white(),
|
||||
ghost_element_active: gpui2::white(),
|
||||
ghost_element_selected: gpui2::white(),
|
||||
ghost_element_disabled: gpui2::white(),
|
||||
text: gpui2::white(),
|
||||
text_muted: gpui2::white(),
|
||||
text_placeholder: gpui2::white(),
|
||||
text_disabled: gpui2::white(),
|
||||
text_accent: gpui2::white(),
|
||||
icon: gpui2::white(),
|
||||
icon_muted: gpui2::white(),
|
||||
icon_disabled: gpui2::white(),
|
||||
icon_placeholder: gpui2::white(),
|
||||
icon_accent: gpui2::white(),
|
||||
status_bar: gpui2::white(),
|
||||
title_bar: gpui2::white(),
|
||||
toolbar: gpui2::white(),
|
||||
tab_bar: gpui2::white(),
|
||||
editor: gpui2::white(),
|
||||
editor_subheader: gpui2::white(),
|
||||
editor_active_line: gpui2::white(),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn default_dark() -> Self {
|
||||
Self {
|
||||
border: gpui2::rgba(0x464b57ff).into(),
|
||||
border_variant: gpui2::rgba(0x464b57ff).into(),
|
||||
border_focused: gpui2::rgba(0x293b5bff).into(),
|
||||
border_transparent: gpui2::rgba(0x00000000).into(),
|
||||
elevated_surface: gpui2::rgba(0x3b414dff).into(),
|
||||
surface: gpui2::rgba(0x2f343eff).into(),
|
||||
background: gpui2::rgba(0x3b414dff).into(),
|
||||
element: gpui2::rgba(0x3b414dff).into(),
|
||||
element_hover: gpui2::rgba(0xffffff1e).into(),
|
||||
element_active: gpui2::rgba(0xffffff28).into(),
|
||||
element_selected: gpui2::rgba(0x18243dff).into(),
|
||||
element_disabled: gpui2::rgba(0x00000000).into(),
|
||||
element_placeholder: gpui2::black(),
|
||||
ghost_element: gpui2::rgba(0x00000000).into(),
|
||||
ghost_element_hover: gpui2::rgba(0xffffff14).into(),
|
||||
ghost_element_active: gpui2::rgba(0xffffff1e).into(),
|
||||
ghost_element_selected: gpui2::rgba(0x18243dff).into(),
|
||||
ghost_element_disabled: gpui2::rgba(0x00000000).into(),
|
||||
text: gpui2::rgba(0xc8ccd4ff).into(),
|
||||
text_muted: gpui2::rgba(0x838994ff).into(),
|
||||
text_placeholder: gpui2::rgba(0xd07277ff).into(),
|
||||
text_disabled: gpui2::rgba(0x555a63ff).into(),
|
||||
text_accent: gpui2::rgba(0x74ade8ff).into(),
|
||||
icon: gpui2::black(),
|
||||
icon_muted: gpui2::rgba(0x838994ff).into(),
|
||||
icon_disabled: gpui2::black(),
|
||||
icon_placeholder: gpui2::black(),
|
||||
icon_accent: gpui2::black(),
|
||||
status_bar: gpui2::rgba(0x3b414dff).into(),
|
||||
title_bar: gpui2::rgba(0x3b414dff).into(),
|
||||
toolbar: gpui2::rgba(0x282c33ff).into(),
|
||||
tab_bar: gpui2::rgba(0x2f343eff).into(),
|
||||
editor: gpui2::rgba(0x282c33ff).into(),
|
||||
editor_subheader: gpui2::rgba(0x2f343eff).into(),
|
||||
editor_active_line: gpui2::rgba(0x2f343eff).into(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
type StaticColorScale = [&'static str; 12];
|
||||
|
||||
struct StaticColorScaleSet {
|
||||
scale: &'static str,
|
||||
light: StaticColorScale,
|
||||
light_alpha: StaticColorScale,
|
||||
dark: StaticColorScale,
|
||||
dark_alpha: StaticColorScale,
|
||||
}
|
||||
|
||||
impl TryFrom<StaticColorScaleSet> for ColorScaleSet {
|
||||
type Error = ParseIntError;
|
||||
|
||||
fn try_from(value: StaticColorScaleSet) -> Result<Self, Self::Error> {
|
||||
fn to_color_scale(scale: StaticColorScale) -> Result<ColorScale, ParseIntError> {
|
||||
scale
|
||||
.into_iter()
|
||||
.map(|color| Rgba::try_from(color).map(Hsla::from))
|
||||
.collect::<Result<Vec<_>, _>>()
|
||||
.map(ColorScale::from_iter)
|
||||
}
|
||||
|
||||
Ok(Self::new(
|
||||
value.scale,
|
||||
to_color_scale(value.light)?,
|
||||
to_color_scale(value.light_alpha)?,
|
||||
to_color_scale(value.dark)?,
|
||||
to_color_scale(value.dark_alpha)?,
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
pub fn default_color_scales() -> ColorScales {
|
||||
use ColorScaleName::*;
|
||||
|
||||
IndexMap::from_iter([
|
||||
(Gray, gray().into()),
|
||||
(Mauve, mauve().into()),
|
||||
(Slate, slate().into()),
|
||||
(Sage, sage().into()),
|
||||
(Olive, olive().into()),
|
||||
(Sand, sand().into()),
|
||||
(Gold, gold().into()),
|
||||
(Bronze, bronze().into()),
|
||||
(Brown, brown().into()),
|
||||
(Yellow, yellow().into()),
|
||||
(Amber, amber().into()),
|
||||
(Orange, orange().into()),
|
||||
(Tomato, tomato().into()),
|
||||
(Red, red().into()),
|
||||
(Ruby, ruby().into()),
|
||||
(Crimson, crimson().into()),
|
||||
(Pink, pink().into()),
|
||||
(Plum, plum().into()),
|
||||
(Purple, purple().into()),
|
||||
(Violet, violet().into()),
|
||||
(Iris, iris().into()),
|
||||
(Indigo, indigo().into()),
|
||||
(Blue, blue().into()),
|
||||
(Cyan, cyan().into()),
|
||||
(Teal, teal().into()),
|
||||
(Jade, jade().into()),
|
||||
(Green, green().into()),
|
||||
(Grass, grass().into()),
|
||||
(Lime, lime().into()),
|
||||
(Mint, mint().into()),
|
||||
(Sky, sky().into()),
|
||||
(Black, black().into()),
|
||||
(White, white().into()),
|
||||
])
|
||||
ColorScales {
|
||||
gray: gray(),
|
||||
mauve: mauve(),
|
||||
slate: slate(),
|
||||
sage: sage(),
|
||||
olive: olive(),
|
||||
sand: sand(),
|
||||
gold: gold(),
|
||||
bronze: bronze(),
|
||||
brown: brown(),
|
||||
yellow: yellow(),
|
||||
amber: amber(),
|
||||
orange: orange(),
|
||||
tomato: tomato(),
|
||||
red: red(),
|
||||
ruby: ruby(),
|
||||
crimson: crimson(),
|
||||
pink: pink(),
|
||||
plum: plum(),
|
||||
purple: purple(),
|
||||
violet: violet(),
|
||||
iris: iris(),
|
||||
indigo: indigo(),
|
||||
blue: blue(),
|
||||
cyan: cyan(),
|
||||
teal: teal(),
|
||||
jade: jade(),
|
||||
green: green(),
|
||||
grass: grass(),
|
||||
lime: lime(),
|
||||
mint: mint(),
|
||||
sky: sky(),
|
||||
black: black(),
|
||||
white: white(),
|
||||
}
|
||||
}
|
||||
|
||||
fn gray() -> DefaultColorScaleSet {
|
||||
DefaultColorScaleSet {
|
||||
scale: ColorScaleName::Gray,
|
||||
fn gray() -> ColorScaleSet {
|
||||
StaticColorScaleSet {
|
||||
scale: "Gray",
|
||||
light: [
|
||||
"#fcfcfcff",
|
||||
"#f9f9f9ff",
|
||||
@@ -131,11 +402,13 @@ fn gray() -> DefaultColorScaleSet {
|
||||
"#ffffffed",
|
||||
],
|
||||
}
|
||||
.try_into()
|
||||
.unwrap()
|
||||
}
|
||||
|
||||
fn mauve() -> DefaultColorScaleSet {
|
||||
DefaultColorScaleSet {
|
||||
scale: ColorScaleName::Mauve,
|
||||
fn mauve() -> ColorScaleSet {
|
||||
StaticColorScaleSet {
|
||||
scale: "Mauve",
|
||||
light: [
|
||||
"#fdfcfdff",
|
||||
"#faf9fbff",
|
||||
@@ -193,11 +466,13 @@ fn mauve() -> DefaultColorScaleSet {
|
||||
"#fdfdffef",
|
||||
],
|
||||
}
|
||||
.try_into()
|
||||
.unwrap()
|
||||
}
|
||||
|
||||
fn slate() -> DefaultColorScaleSet {
|
||||
DefaultColorScaleSet {
|
||||
scale: ColorScaleName::Slate,
|
||||
fn slate() -> ColorScaleSet {
|
||||
StaticColorScaleSet {
|
||||
scale: "Slate",
|
||||
light: [
|
||||
"#fcfcfdff",
|
||||
"#f9f9fbff",
|
||||
@@ -255,11 +530,13 @@ fn slate() -> DefaultColorScaleSet {
|
||||
"#fcfdffef",
|
||||
],
|
||||
}
|
||||
.try_into()
|
||||
.unwrap()
|
||||
}
|
||||
|
||||
fn sage() -> DefaultColorScaleSet {
|
||||
DefaultColorScaleSet {
|
||||
scale: ColorScaleName::Sage,
|
||||
fn sage() -> ColorScaleSet {
|
||||
StaticColorScaleSet {
|
||||
scale: "Sage",
|
||||
light: [
|
||||
"#fbfdfcff",
|
||||
"#f7f9f8ff",
|
||||
@@ -317,11 +594,13 @@ fn sage() -> DefaultColorScaleSet {
|
||||
"#fdfffeed",
|
||||
],
|
||||
}
|
||||
.try_into()
|
||||
.unwrap()
|
||||
}
|
||||
|
||||
fn olive() -> DefaultColorScaleSet {
|
||||
DefaultColorScaleSet {
|
||||
scale: ColorScaleName::Olive,
|
||||
fn olive() -> ColorScaleSet {
|
||||
StaticColorScaleSet {
|
||||
scale: "Olive",
|
||||
light: [
|
||||
"#fcfdfcff",
|
||||
"#f8faf8ff",
|
||||
@@ -379,11 +658,13 @@ fn olive() -> DefaultColorScaleSet {
|
||||
"#fdfffded",
|
||||
],
|
||||
}
|
||||
.try_into()
|
||||
.unwrap()
|
||||
}
|
||||
|
||||
fn sand() -> DefaultColorScaleSet {
|
||||
DefaultColorScaleSet {
|
||||
scale: ColorScaleName::Sand,
|
||||
fn sand() -> ColorScaleSet {
|
||||
StaticColorScaleSet {
|
||||
scale: "Sand",
|
||||
light: [
|
||||
"#fdfdfcff",
|
||||
"#f9f9f8ff",
|
||||
@@ -441,11 +722,13 @@ fn sand() -> DefaultColorScaleSet {
|
||||
"#fffffded",
|
||||
],
|
||||
}
|
||||
.try_into()
|
||||
.unwrap()
|
||||
}
|
||||
|
||||
fn gold() -> DefaultColorScaleSet {
|
||||
DefaultColorScaleSet {
|
||||
scale: ColorScaleName::Gold,
|
||||
fn gold() -> ColorScaleSet {
|
||||
StaticColorScaleSet {
|
||||
scale: "Gold",
|
||||
light: [
|
||||
"#fdfdfcff",
|
||||
"#faf9f2ff",
|
||||
@@ -503,11 +786,13 @@ fn gold() -> DefaultColorScaleSet {
|
||||
"#fef7ede7",
|
||||
],
|
||||
}
|
||||
.try_into()
|
||||
.unwrap()
|
||||
}
|
||||
|
||||
fn bronze() -> DefaultColorScaleSet {
|
||||
DefaultColorScaleSet {
|
||||
scale: ColorScaleName::Bronze,
|
||||
fn bronze() -> ColorScaleSet {
|
||||
StaticColorScaleSet {
|
||||
scale: "Bronze",
|
||||
light: [
|
||||
"#fdfcfcff",
|
||||
"#fdf7f5ff",
|
||||
@@ -565,11 +850,13 @@ fn bronze() -> DefaultColorScaleSet {
|
||||
"#fff1e9ec",
|
||||
],
|
||||
}
|
||||
.try_into()
|
||||
.unwrap()
|
||||
}
|
||||
|
||||
fn brown() -> DefaultColorScaleSet {
|
||||
DefaultColorScaleSet {
|
||||
scale: ColorScaleName::Brown,
|
||||
fn brown() -> ColorScaleSet {
|
||||
StaticColorScaleSet {
|
||||
scale: "Brown",
|
||||
light: [
|
||||
"#fefdfcff",
|
||||
"#fcf9f6ff",
|
||||
@@ -627,11 +914,13 @@ fn brown() -> DefaultColorScaleSet {
|
||||
"#feecd4f2",
|
||||
],
|
||||
}
|
||||
.try_into()
|
||||
.unwrap()
|
||||
}
|
||||
|
||||
fn yellow() -> DefaultColorScaleSet {
|
||||
DefaultColorScaleSet {
|
||||
scale: ColorScaleName::Yellow,
|
||||
fn yellow() -> ColorScaleSet {
|
||||
StaticColorScaleSet {
|
||||
scale: "Yellow",
|
||||
light: [
|
||||
"#fdfdf9ff",
|
||||
"#fefce9ff",
|
||||
@@ -689,11 +978,13 @@ fn yellow() -> DefaultColorScaleSet {
|
||||
"#fef6baf6",
|
||||
],
|
||||
}
|
||||
.try_into()
|
||||
.unwrap()
|
||||
}
|
||||
|
||||
fn amber() -> DefaultColorScaleSet {
|
||||
DefaultColorScaleSet {
|
||||
scale: ColorScaleName::Amber,
|
||||
fn amber() -> ColorScaleSet {
|
||||
StaticColorScaleSet {
|
||||
scale: "Amber",
|
||||
light: [
|
||||
"#fefdfbff",
|
||||
"#fefbe9ff",
|
||||
@@ -751,11 +1042,13 @@ fn amber() -> DefaultColorScaleSet {
|
||||
"#ffe7b3ff",
|
||||
],
|
||||
}
|
||||
.try_into()
|
||||
.unwrap()
|
||||
}
|
||||
|
||||
fn orange() -> DefaultColorScaleSet {
|
||||
DefaultColorScaleSet {
|
||||
scale: ColorScaleName::Orange,
|
||||
fn orange() -> ColorScaleSet {
|
||||
StaticColorScaleSet {
|
||||
scale: "Orange",
|
||||
light: [
|
||||
"#fefcfbff",
|
||||
"#fff7edff",
|
||||
@@ -813,11 +1106,13 @@ fn orange() -> DefaultColorScaleSet {
|
||||
"#ffe0c2ff",
|
||||
],
|
||||
}
|
||||
.try_into()
|
||||
.unwrap()
|
||||
}
|
||||
|
||||
fn tomato() -> DefaultColorScaleSet {
|
||||
DefaultColorScaleSet {
|
||||
scale: ColorScaleName::Tomato,
|
||||
fn tomato() -> ColorScaleSet {
|
||||
StaticColorScaleSet {
|
||||
scale: "Tomato",
|
||||
light: [
|
||||
"#fffcfcff",
|
||||
"#fff8f7ff",
|
||||
@@ -875,11 +1170,13 @@ fn tomato() -> DefaultColorScaleSet {
|
||||
"#ffd6cefb",
|
||||
],
|
||||
}
|
||||
.try_into()
|
||||
.unwrap()
|
||||
}
|
||||
|
||||
fn red() -> DefaultColorScaleSet {
|
||||
DefaultColorScaleSet {
|
||||
scale: ColorScaleName::Red,
|
||||
fn red() -> ColorScaleSet {
|
||||
StaticColorScaleSet {
|
||||
scale: "Red",
|
||||
light: [
|
||||
"#fffcfcff",
|
||||
"#fff7f7ff",
|
||||
@@ -937,11 +1234,13 @@ fn red() -> DefaultColorScaleSet {
|
||||
"#ffd1d9ff",
|
||||
],
|
||||
}
|
||||
.try_into()
|
||||
.unwrap()
|
||||
}
|
||||
|
||||
fn ruby() -> DefaultColorScaleSet {
|
||||
DefaultColorScaleSet {
|
||||
scale: ColorScaleName::Ruby,
|
||||
fn ruby() -> ColorScaleSet {
|
||||
StaticColorScaleSet {
|
||||
scale: "Ruby",
|
||||
light: [
|
||||
"#fffcfdff",
|
||||
"#fff7f8ff",
|
||||
@@ -999,11 +1298,13 @@ fn ruby() -> DefaultColorScaleSet {
|
||||
"#ffd3e2fe",
|
||||
],
|
||||
}
|
||||
.try_into()
|
||||
.unwrap()
|
||||
}
|
||||
|
||||
fn crimson() -> DefaultColorScaleSet {
|
||||
DefaultColorScaleSet {
|
||||
scale: ColorScaleName::Crimson,
|
||||
fn crimson() -> ColorScaleSet {
|
||||
StaticColorScaleSet {
|
||||
scale: "Crimson",
|
||||
light: [
|
||||
"#fffcfdff",
|
||||
"#fef7f9ff",
|
||||
@@ -1061,11 +1362,13 @@ fn crimson() -> DefaultColorScaleSet {
|
||||
"#ffd5eafd",
|
||||
],
|
||||
}
|
||||
.try_into()
|
||||
.unwrap()
|
||||
}
|
||||
|
||||
fn pink() -> DefaultColorScaleSet {
|
||||
DefaultColorScaleSet {
|
||||
scale: ColorScaleName::Pink,
|
||||
fn pink() -> ColorScaleSet {
|
||||
StaticColorScaleSet {
|
||||
scale: "Pink",
|
||||
light: [
|
||||
"#fffcfeff",
|
||||
"#fef7fbff",
|
||||
@@ -1123,11 +1426,13 @@ fn pink() -> DefaultColorScaleSet {
|
||||
"#ffd3ecfd",
|
||||
],
|
||||
}
|
||||
.try_into()
|
||||
.unwrap()
|
||||
}
|
||||
|
||||
fn plum() -> DefaultColorScaleSet {
|
||||
DefaultColorScaleSet {
|
||||
scale: ColorScaleName::Plum,
|
||||
fn plum() -> ColorScaleSet {
|
||||
StaticColorScaleSet {
|
||||
scale: "Plum",
|
||||
light: [
|
||||
"#fefcffff",
|
||||
"#fdf7fdff",
|
||||
@@ -1185,11 +1490,13 @@ fn plum() -> DefaultColorScaleSet {
|
||||
"#feddfef4",
|
||||
],
|
||||
}
|
||||
.try_into()
|
||||
.unwrap()
|
||||
}
|
||||
|
||||
fn purple() -> DefaultColorScaleSet {
|
||||
DefaultColorScaleSet {
|
||||
scale: ColorScaleName::Purple,
|
||||
fn purple() -> ColorScaleSet {
|
||||
StaticColorScaleSet {
|
||||
scale: "Purple",
|
||||
light: [
|
||||
"#fefcfeff",
|
||||
"#fbf7feff",
|
||||
@@ -1247,11 +1554,13 @@ fn purple() -> DefaultColorScaleSet {
|
||||
"#f1ddfffa",
|
||||
],
|
||||
}
|
||||
.try_into()
|
||||
.unwrap()
|
||||
}
|
||||
|
||||
fn violet() -> DefaultColorScaleSet {
|
||||
DefaultColorScaleSet {
|
||||
scale: ColorScaleName::Violet,
|
||||
fn violet() -> ColorScaleSet {
|
||||
StaticColorScaleSet {
|
||||
scale: "Violet",
|
||||
light: [
|
||||
"#fdfcfeff",
|
||||
"#faf8ffff",
|
||||
@@ -1309,11 +1618,13 @@ fn violet() -> DefaultColorScaleSet {
|
||||
"#e3defffe",
|
||||
],
|
||||
}
|
||||
.try_into()
|
||||
.unwrap()
|
||||
}
|
||||
|
||||
fn iris() -> DefaultColorScaleSet {
|
||||
DefaultColorScaleSet {
|
||||
scale: ColorScaleName::Iris,
|
||||
fn iris() -> ColorScaleSet {
|
||||
StaticColorScaleSet {
|
||||
scale: "Iris",
|
||||
light: [
|
||||
"#fdfdffff",
|
||||
"#f8f8ffff",
|
||||
@@ -1371,11 +1682,13 @@ fn iris() -> DefaultColorScaleSet {
|
||||
"#e1e0fffe",
|
||||
],
|
||||
}
|
||||
.try_into()
|
||||
.unwrap()
|
||||
}
|
||||
|
||||
fn indigo() -> DefaultColorScaleSet {
|
||||
DefaultColorScaleSet {
|
||||
scale: ColorScaleName::Indigo,
|
||||
fn indigo() -> ColorScaleSet {
|
||||
StaticColorScaleSet {
|
||||
scale: "Indigo",
|
||||
light: [
|
||||
"#fdfdfeff",
|
||||
"#f7f9ffff",
|
||||
@@ -1433,11 +1746,13 @@ fn indigo() -> DefaultColorScaleSet {
|
||||
"#d6e1ffff",
|
||||
],
|
||||
}
|
||||
.try_into()
|
||||
.unwrap()
|
||||
}
|
||||
|
||||
fn blue() -> DefaultColorScaleSet {
|
||||
DefaultColorScaleSet {
|
||||
scale: ColorScaleName::Blue,
|
||||
fn blue() -> ColorScaleSet {
|
||||
StaticColorScaleSet {
|
||||
scale: "Blue",
|
||||
light: [
|
||||
"#fbfdffff",
|
||||
"#f4faffff",
|
||||
@@ -1495,11 +1810,13 @@ fn blue() -> DefaultColorScaleSet {
|
||||
"#c2e6ffff",
|
||||
],
|
||||
}
|
||||
.try_into()
|
||||
.unwrap()
|
||||
}
|
||||
|
||||
fn cyan() -> DefaultColorScaleSet {
|
||||
DefaultColorScaleSet {
|
||||
scale: ColorScaleName::Cyan,
|
||||
fn cyan() -> ColorScaleSet {
|
||||
StaticColorScaleSet {
|
||||
scale: "Cyan",
|
||||
light: [
|
||||
"#fafdfeff",
|
||||
"#f2fafbff",
|
||||
@@ -1557,11 +1874,13 @@ fn cyan() -> DefaultColorScaleSet {
|
||||
"#bbf3fef7",
|
||||
],
|
||||
}
|
||||
.try_into()
|
||||
.unwrap()
|
||||
}
|
||||
|
||||
fn teal() -> DefaultColorScaleSet {
|
||||
DefaultColorScaleSet {
|
||||
scale: ColorScaleName::Teal,
|
||||
fn teal() -> ColorScaleSet {
|
||||
StaticColorScaleSet {
|
||||
scale: "Teal",
|
||||
light: [
|
||||
"#fafefdff",
|
||||
"#f3fbf9ff",
|
||||
@@ -1619,11 +1938,13 @@ fn teal() -> DefaultColorScaleSet {
|
||||
"#b8ffebef",
|
||||
],
|
||||
}
|
||||
.try_into()
|
||||
.unwrap()
|
||||
}
|
||||
|
||||
fn jade() -> DefaultColorScaleSet {
|
||||
DefaultColorScaleSet {
|
||||
scale: ColorScaleName::Jade,
|
||||
fn jade() -> ColorScaleSet {
|
||||
StaticColorScaleSet {
|
||||
scale: "Jade",
|
||||
light: [
|
||||
"#fbfefdff",
|
||||
"#f4fbf7ff",
|
||||
@@ -1681,11 +2002,13 @@ fn jade() -> DefaultColorScaleSet {
|
||||
"#b8ffe1ef",
|
||||
],
|
||||
}
|
||||
.try_into()
|
||||
.unwrap()
|
||||
}
|
||||
|
||||
fn green() -> DefaultColorScaleSet {
|
||||
DefaultColorScaleSet {
|
||||
scale: ColorScaleName::Green,
|
||||
fn green() -> ColorScaleSet {
|
||||
StaticColorScaleSet {
|
||||
scale: "Green",
|
||||
light: [
|
||||
"#fbfefcff",
|
||||
"#f4fbf6ff",
|
||||
@@ -1743,11 +2066,13 @@ fn green() -> DefaultColorScaleSet {
|
||||
"#bbffd7f0",
|
||||
],
|
||||
}
|
||||
.try_into()
|
||||
.unwrap()
|
||||
}
|
||||
|
||||
fn grass() -> DefaultColorScaleSet {
|
||||
DefaultColorScaleSet {
|
||||
scale: ColorScaleName::Grass,
|
||||
fn grass() -> ColorScaleSet {
|
||||
StaticColorScaleSet {
|
||||
scale: "Grass",
|
||||
light: [
|
||||
"#fbfefbff",
|
||||
"#f5fbf5ff",
|
||||
@@ -1805,11 +2130,13 @@ fn grass() -> DefaultColorScaleSet {
|
||||
"#ceffceef",
|
||||
],
|
||||
}
|
||||
.try_into()
|
||||
.unwrap()
|
||||
}
|
||||
|
||||
fn lime() -> DefaultColorScaleSet {
|
||||
DefaultColorScaleSet {
|
||||
scale: ColorScaleName::Lime,
|
||||
fn lime() -> ColorScaleSet {
|
||||
StaticColorScaleSet {
|
||||
scale: "Lime",
|
||||
light: [
|
||||
"#fcfdfaff",
|
||||
"#f8faf3ff",
|
||||
@@ -1867,11 +2194,13 @@ fn lime() -> DefaultColorScaleSet {
|
||||
"#e9febff7",
|
||||
],
|
||||
}
|
||||
.try_into()
|
||||
.unwrap()
|
||||
}
|
||||
|
||||
fn mint() -> DefaultColorScaleSet {
|
||||
DefaultColorScaleSet {
|
||||
scale: ColorScaleName::Mint,
|
||||
fn mint() -> ColorScaleSet {
|
||||
StaticColorScaleSet {
|
||||
scale: "Mint",
|
||||
light: [
|
||||
"#f9fefdff",
|
||||
"#f2fbf9ff",
|
||||
@@ -1929,11 +2258,13 @@ fn mint() -> DefaultColorScaleSet {
|
||||
"#cbfee9f5",
|
||||
],
|
||||
}
|
||||
.try_into()
|
||||
.unwrap()
|
||||
}
|
||||
|
||||
fn sky() -> DefaultColorScaleSet {
|
||||
DefaultColorScaleSet {
|
||||
scale: ColorScaleName::Sky,
|
||||
fn sky() -> ColorScaleSet {
|
||||
StaticColorScaleSet {
|
||||
scale: "Sky",
|
||||
light: [
|
||||
"#f9feffff",
|
||||
"#f1fafdff",
|
||||
@@ -1991,11 +2322,13 @@ fn sky() -> DefaultColorScaleSet {
|
||||
"#c2f3ffff",
|
||||
],
|
||||
}
|
||||
.try_into()
|
||||
.unwrap()
|
||||
}
|
||||
|
||||
fn black() -> DefaultColorScaleSet {
|
||||
DefaultColorScaleSet {
|
||||
scale: ColorScaleName::Black,
|
||||
fn black() -> ColorScaleSet {
|
||||
StaticColorScaleSet {
|
||||
scale: "Black",
|
||||
light: [
|
||||
"#0000000d",
|
||||
"#0000001a",
|
||||
@@ -2053,11 +2386,13 @@ fn black() -> DefaultColorScaleSet {
|
||||
"#000000f2",
|
||||
],
|
||||
}
|
||||
.try_into()
|
||||
.unwrap()
|
||||
}
|
||||
|
||||
fn white() -> DefaultColorScaleSet {
|
||||
DefaultColorScaleSet {
|
||||
scale: ColorScaleName::White,
|
||||
fn white() -> ColorScaleSet {
|
||||
StaticColorScaleSet {
|
||||
scale: "White",
|
||||
light: [
|
||||
"#ffffff0d",
|
||||
"#ffffff1a",
|
||||
@@ -2115,4 +2450,6 @@ fn white() -> DefaultColorScaleSet {
|
||||
"#fffffff2",
|
||||
],
|
||||
}
|
||||
.try_into()
|
||||
.unwrap()
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
use crate::{
|
||||
colors::{GitStatusColors, PlayerColors, StatusColors, SystemColors, ThemeColors, ThemeStyles},
|
||||
default_color_scales, Appearance, SyntaxTheme, ThemeFamily, ThemeVariant,
|
||||
};
|
||||
|
||||
fn zed_pro_daylight() -> ThemeVariant {
|
||||
ThemeVariant {
|
||||
id: "zed_pro_daylight".to_string(),
|
||||
name: "Zed Pro Daylight".into(),
|
||||
appearance: Appearance::Light,
|
||||
styles: ThemeStyles {
|
||||
system: SystemColors::default(),
|
||||
colors: ThemeColors::default_light(),
|
||||
status: StatusColors::default(),
|
||||
git: GitStatusColors::default(),
|
||||
player: PlayerColors::default(),
|
||||
syntax: SyntaxTheme::default_light(),
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn zed_pro_moonlight() -> ThemeVariant {
|
||||
ThemeVariant {
|
||||
id: "zed_pro_moonlight".to_string(),
|
||||
name: "Zed Pro Moonlight".into(),
|
||||
appearance: Appearance::Dark,
|
||||
styles: ThemeStyles {
|
||||
system: SystemColors::default(),
|
||||
colors: ThemeColors::default_dark(),
|
||||
status: StatusColors::default(),
|
||||
git: GitStatusColors::default(),
|
||||
player: PlayerColors::default(),
|
||||
syntax: SyntaxTheme::default_dark(),
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
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 {
|
||||
zed_pro_family()
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for ThemeVariant {
|
||||
fn default() -> Self {
|
||||
zed_pro_daylight()
|
||||
}
|
||||
}
|
||||
@@ -1,17 +1,22 @@
|
||||
use crate::{themes, Theme, ThemeMetadata};
|
||||
use crate::{zed_pro_family, ThemeFamily, ThemeVariant};
|
||||
use anyhow::{anyhow, Result};
|
||||
use gpui2::SharedString;
|
||||
use std::{collections::HashMap, sync::Arc};
|
||||
|
||||
pub struct ThemeRegistry {
|
||||
themes: HashMap<SharedString, Arc<Theme>>,
|
||||
themes: HashMap<SharedString, Arc<ThemeVariant>>,
|
||||
}
|
||||
|
||||
impl ThemeRegistry {
|
||||
fn insert_themes(&mut self, themes: impl IntoIterator<Item = Theme>) {
|
||||
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 = ThemeVariant>) {
|
||||
for theme in themes.into_iter() {
|
||||
self.themes
|
||||
.insert(theme.metadata.name.clone(), Arc::new(theme));
|
||||
self.themes.insert(theme.name.clone(), Arc::new(theme));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,11 +24,11 @@ impl ThemeRegistry {
|
||||
self.themes.keys().cloned()
|
||||
}
|
||||
|
||||
pub fn list(&self, _staff: bool) -> impl Iterator<Item = ThemeMetadata> + '_ {
|
||||
self.themes.values().map(|theme| theme.metadata.clone())
|
||||
pub fn list(&self, _staff: bool) -> impl Iterator<Item = SharedString> + '_ {
|
||||
self.themes.values().map(|theme| theme.name.clone())
|
||||
}
|
||||
|
||||
pub fn get(&self, name: &str) -> Result<Arc<Theme>> {
|
||||
pub fn get(&self, name: &str) -> Result<Arc<ThemeVariant>> {
|
||||
self.themes
|
||||
.get(name)
|
||||
.ok_or_else(|| anyhow!("theme not found: {}", name))
|
||||
@@ -37,47 +42,7 @@ impl Default for ThemeRegistry {
|
||||
themes: HashMap::default(),
|
||||
};
|
||||
|
||||
this.insert_themes([
|
||||
themes::andromeda(),
|
||||
themes::atelier_cave_dark(),
|
||||
themes::atelier_cave_light(),
|
||||
themes::atelier_dune_dark(),
|
||||
themes::atelier_dune_light(),
|
||||
themes::atelier_estuary_dark(),
|
||||
themes::atelier_estuary_light(),
|
||||
themes::atelier_forest_dark(),
|
||||
themes::atelier_forest_light(),
|
||||
themes::atelier_heath_dark(),
|
||||
themes::atelier_heath_light(),
|
||||
themes::atelier_lakeside_dark(),
|
||||
themes::atelier_lakeside_light(),
|
||||
themes::atelier_plateau_dark(),
|
||||
themes::atelier_plateau_light(),
|
||||
themes::atelier_savanna_dark(),
|
||||
themes::atelier_savanna_light(),
|
||||
themes::atelier_seaside_dark(),
|
||||
themes::atelier_seaside_light(),
|
||||
themes::atelier_sulphurpool_dark(),
|
||||
themes::atelier_sulphurpool_light(),
|
||||
themes::ayu_dark(),
|
||||
themes::ayu_light(),
|
||||
themes::ayu_mirage(),
|
||||
themes::gruvbox_dark(),
|
||||
themes::gruvbox_dark_hard(),
|
||||
themes::gruvbox_dark_soft(),
|
||||
themes::gruvbox_light(),
|
||||
themes::gruvbox_light_hard(),
|
||||
themes::gruvbox_light_soft(),
|
||||
themes::one_dark(),
|
||||
themes::one_light(),
|
||||
themes::rose_pine(),
|
||||
themes::rose_pine_dawn(),
|
||||
themes::rose_pine_moon(),
|
||||
themes::sandcastle(),
|
||||
themes::solarized_dark(),
|
||||
themes::solarized_light(),
|
||||
themes::summercamp(),
|
||||
]);
|
||||
this.insert_theme_families([zed_pro_family()]);
|
||||
|
||||
this
|
||||
}
|
||||
|
||||
+241
-114
@@ -1,98 +1,237 @@
|
||||
use gpui2::{AppContext, Hsla};
|
||||
use indexmap::IndexMap;
|
||||
use gpui2::{AppContext, Hsla, SharedString};
|
||||
|
||||
use crate::{theme, Appearance};
|
||||
use crate::{ActiveTheme, Appearance};
|
||||
|
||||
#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
||||
pub enum ColorScaleName {
|
||||
Gray,
|
||||
Mauve,
|
||||
Slate,
|
||||
Sage,
|
||||
Olive,
|
||||
Sand,
|
||||
Gold,
|
||||
Bronze,
|
||||
Brown,
|
||||
Yellow,
|
||||
Amber,
|
||||
Orange,
|
||||
Tomato,
|
||||
Red,
|
||||
Ruby,
|
||||
Crimson,
|
||||
Pink,
|
||||
Plum,
|
||||
Purple,
|
||||
Violet,
|
||||
Iris,
|
||||
Indigo,
|
||||
Blue,
|
||||
Cyan,
|
||||
Teal,
|
||||
Jade,
|
||||
Green,
|
||||
Grass,
|
||||
Lime,
|
||||
Mint,
|
||||
Sky,
|
||||
Black,
|
||||
White,
|
||||
/// A one-based step in a [`ColorScale`].
|
||||
#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Clone, Copy)]
|
||||
pub struct ColorScaleStep(usize);
|
||||
|
||||
impl ColorScaleStep {
|
||||
/// The first step in a [`ColorScale`].
|
||||
pub const ONE: Self = Self(1);
|
||||
|
||||
/// The second step in a [`ColorScale`].
|
||||
pub const TWO: Self = Self(2);
|
||||
|
||||
/// The third step in a [`ColorScale`].
|
||||
pub const THREE: Self = Self(3);
|
||||
|
||||
/// The fourth step in a [`ColorScale`].
|
||||
pub const FOUR: Self = Self(4);
|
||||
|
||||
/// The fifth step in a [`ColorScale`].
|
||||
pub const FIVE: Self = Self(5);
|
||||
|
||||
/// The sixth step in a [`ColorScale`].
|
||||
pub const SIX: Self = Self(6);
|
||||
|
||||
/// The seventh step in a [`ColorScale`].
|
||||
pub const SEVEN: Self = Self(7);
|
||||
|
||||
/// The eighth step in a [`ColorScale`].
|
||||
pub const EIGHT: Self = Self(8);
|
||||
|
||||
/// The ninth step in a [`ColorScale`].
|
||||
pub const NINE: Self = Self(9);
|
||||
|
||||
/// The tenth step in a [`ColorScale`].
|
||||
pub const TEN: Self = Self(10);
|
||||
|
||||
/// The eleventh step in a [`ColorScale`].
|
||||
pub const ELEVEN: Self = Self(11);
|
||||
|
||||
/// The twelfth step in a [`ColorScale`].
|
||||
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,
|
||||
];
|
||||
}
|
||||
|
||||
impl std::fmt::Display for ColorScaleName {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
write!(
|
||||
f,
|
||||
"{}",
|
||||
match self {
|
||||
Self::Gray => "Gray",
|
||||
Self::Mauve => "Mauve",
|
||||
Self::Slate => "Slate",
|
||||
Self::Sage => "Sage",
|
||||
Self::Olive => "Olive",
|
||||
Self::Sand => "Sand",
|
||||
Self::Gold => "Gold",
|
||||
Self::Bronze => "Bronze",
|
||||
Self::Brown => "Brown",
|
||||
Self::Yellow => "Yellow",
|
||||
Self::Amber => "Amber",
|
||||
Self::Orange => "Orange",
|
||||
Self::Tomato => "Tomato",
|
||||
Self::Red => "Red",
|
||||
Self::Ruby => "Ruby",
|
||||
Self::Crimson => "Crimson",
|
||||
Self::Pink => "Pink",
|
||||
Self::Plum => "Plum",
|
||||
Self::Purple => "Purple",
|
||||
Self::Violet => "Violet",
|
||||
Self::Iris => "Iris",
|
||||
Self::Indigo => "Indigo",
|
||||
Self::Blue => "Blue",
|
||||
Self::Cyan => "Cyan",
|
||||
Self::Teal => "Teal",
|
||||
Self::Jade => "Jade",
|
||||
Self::Green => "Green",
|
||||
Self::Grass => "Grass",
|
||||
Self::Lime => "Lime",
|
||||
Self::Mint => "Mint",
|
||||
Self::Sky => "Sky",
|
||||
Self::Black => "Black",
|
||||
Self::White => "White",
|
||||
}
|
||||
)
|
||||
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))
|
||||
}
|
||||
}
|
||||
|
||||
pub type ColorScale = [Hsla; 12];
|
||||
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]
|
||||
}
|
||||
|
||||
pub type ColorScales = IndexMap<ColorScaleName, ColorScaleSet>;
|
||||
/// Returns the first step in the [`ColorScale`].
|
||||
#[inline]
|
||||
pub fn step_1(&self) -> Hsla {
|
||||
self.step(ColorScaleStep::ONE)
|
||||
}
|
||||
|
||||
/// A one-based step in a [`ColorScale`].
|
||||
pub type ColorScaleStep = usize;
|
||||
/// Returns the second step in the [`ColorScale`].
|
||||
#[inline]
|
||||
pub fn step_2(&self) -> Hsla {
|
||||
self.step(ColorScaleStep::TWO)
|
||||
}
|
||||
|
||||
/// Returns the third step in the [`ColorScale`].
|
||||
#[inline]
|
||||
pub fn step_3(&self) -> Hsla {
|
||||
self.step(ColorScaleStep::THREE)
|
||||
}
|
||||
|
||||
/// Returns the fourth step in the [`ColorScale`].
|
||||
#[inline]
|
||||
pub fn step_4(&self) -> Hsla {
|
||||
self.step(ColorScaleStep::FOUR)
|
||||
}
|
||||
|
||||
/// Returns the fifth step in the [`ColorScale`].
|
||||
#[inline]
|
||||
pub fn step_5(&self) -> Hsla {
|
||||
self.step(ColorScaleStep::FIVE)
|
||||
}
|
||||
|
||||
/// Returns the sixth step in the [`ColorScale`].
|
||||
#[inline]
|
||||
pub fn step_6(&self) -> Hsla {
|
||||
self.step(ColorScaleStep::SIX)
|
||||
}
|
||||
|
||||
/// Returns the seventh step in the [`ColorScale`].
|
||||
#[inline]
|
||||
pub fn step_7(&self) -> Hsla {
|
||||
self.step(ColorScaleStep::SEVEN)
|
||||
}
|
||||
|
||||
/// Returns the eighth step in the [`ColorScale`].
|
||||
#[inline]
|
||||
pub fn step_8(&self) -> Hsla {
|
||||
self.step(ColorScaleStep::EIGHT)
|
||||
}
|
||||
|
||||
/// Returns the ninth step in the [`ColorScale`].
|
||||
#[inline]
|
||||
pub fn step_9(&self) -> Hsla {
|
||||
self.step(ColorScaleStep::NINE)
|
||||
}
|
||||
|
||||
/// Returns the tenth step in the [`ColorScale`].
|
||||
#[inline]
|
||||
pub fn step_10(&self) -> Hsla {
|
||||
self.step(ColorScaleStep::TEN)
|
||||
}
|
||||
|
||||
/// Returns the eleventh step in the [`ColorScale`].
|
||||
#[inline]
|
||||
pub fn step_11(&self) -> Hsla {
|
||||
self.step(ColorScaleStep::ELEVEN)
|
||||
}
|
||||
|
||||
/// Returns the twelfth step in the [`ColorScale`].
|
||||
#[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: ColorScaleName,
|
||||
name: SharedString,
|
||||
light: ColorScale,
|
||||
dark: ColorScale,
|
||||
light_alpha: ColorScale,
|
||||
@@ -101,14 +240,14 @@ pub struct ColorScaleSet {
|
||||
|
||||
impl ColorScaleSet {
|
||||
pub fn new(
|
||||
name: ColorScaleName,
|
||||
name: impl Into<SharedString>,
|
||||
light: ColorScale,
|
||||
light_alpha: ColorScale,
|
||||
dark: ColorScale,
|
||||
dark_alpha: ColorScale,
|
||||
) -> Self {
|
||||
Self {
|
||||
name,
|
||||
name: name.into(),
|
||||
light,
|
||||
light_alpha,
|
||||
dark,
|
||||
@@ -116,49 +255,37 @@ impl ColorScaleSet {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn name(&self) -> String {
|
||||
self.name.to_string()
|
||||
pub fn name(&self) -> &SharedString {
|
||||
&self.name
|
||||
}
|
||||
|
||||
pub fn light(&self, step: ColorScaleStep) -> Hsla {
|
||||
self.light[step - 1]
|
||||
pub fn light(&self) -> &ColorScale {
|
||||
&self.light
|
||||
}
|
||||
|
||||
pub fn light_alpha(&self, step: ColorScaleStep) -> Hsla {
|
||||
self.light_alpha[step - 1]
|
||||
pub fn light_alpha(&self) -> &ColorScale {
|
||||
&self.light_alpha
|
||||
}
|
||||
|
||||
pub fn dark(&self, step: ColorScaleStep) -> Hsla {
|
||||
self.dark[step - 1]
|
||||
pub fn dark(&self) -> &ColorScale {
|
||||
&self.dark
|
||||
}
|
||||
|
||||
pub fn dark_alpha(&self, step: ColorScaleStep) -> Hsla {
|
||||
self.dark_alpha[step - 1]
|
||||
}
|
||||
|
||||
fn current_appearance(cx: &AppContext) -> Appearance {
|
||||
let theme = theme(cx);
|
||||
if theme.metadata.is_light {
|
||||
Appearance::Light
|
||||
} else {
|
||||
Appearance::Dark
|
||||
}
|
||||
pub fn dark_alpha(&self) -> &ColorScale {
|
||||
&self.dark_alpha
|
||||
}
|
||||
|
||||
pub fn step(&self, cx: &AppContext, step: ColorScaleStep) -> Hsla {
|
||||
let appearance = Self::current_appearance(cx);
|
||||
|
||||
match appearance {
|
||||
Appearance::Light => self.light(step),
|
||||
Appearance::Dark => self.dark(step),
|
||||
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 {
|
||||
let appearance = Self::current_appearance(cx);
|
||||
match appearance {
|
||||
Appearance::Light => self.light_alpha(step),
|
||||
Appearance::Dark => self.dark_alpha(step),
|
||||
match cx.theme().appearance {
|
||||
Appearance::Light => self.light_alpha.step(step),
|
||||
Appearance::Dark => self.dark_alpha.step(step),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use crate::{Theme, ThemeRegistry};
|
||||
use crate::{ThemeRegistry, ThemeVariant};
|
||||
use anyhow::Result;
|
||||
use gpui2::{px, AppContext, Font, FontFeatures, FontStyle, FontWeight, Pixels};
|
||||
use schemars::{
|
||||
@@ -17,10 +17,11 @@ const MIN_LINE_HEIGHT: f32 = 1.0;
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct ThemeSettings {
|
||||
pub ui_font_size: Pixels,
|
||||
pub buffer_font: Font,
|
||||
pub buffer_font_size: Pixels,
|
||||
pub buffer_line_height: BufferLineHeight,
|
||||
pub active_theme: Arc<Theme>,
|
||||
pub active_theme: Arc<ThemeVariant>,
|
||||
}
|
||||
|
||||
#[derive(Default)]
|
||||
@@ -28,6 +29,8 @@ pub struct AdjustedBufferFontSize(Option<Pixels>);
|
||||
|
||||
#[derive(Clone, Debug, Default, Serialize, Deserialize, JsonSchema)]
|
||||
pub struct ThemeSettingsContent {
|
||||
#[serde(default)]
|
||||
pub ui_font_size: Option<f32>,
|
||||
#[serde(default)]
|
||||
pub buffer_font_family: Option<String>,
|
||||
#[serde(default)]
|
||||
@@ -115,6 +118,7 @@ impl settings2::Settings for ThemeSettings {
|
||||
let themes = cx.default_global::<Arc<ThemeRegistry>>();
|
||||
|
||||
let mut this = Self {
|
||||
ui_font_size: defaults.ui_font_size.unwrap_or(16.).into(),
|
||||
buffer_font: Font {
|
||||
family: defaults.buffer_font_family.clone().unwrap().into(),
|
||||
features: defaults.buffer_font_features.clone().unwrap(),
|
||||
@@ -123,7 +127,10 @@ impl settings2::Settings for ThemeSettings {
|
||||
},
|
||||
buffer_font_size: defaults.buffer_font_size.unwrap().into(),
|
||||
buffer_line_height: defaults.buffer_line_height.unwrap(),
|
||||
active_theme: themes.get(defaults.theme.as_ref().unwrap()).unwrap(),
|
||||
active_theme: themes
|
||||
.get(defaults.theme.as_ref().unwrap())
|
||||
.or(themes.get("Zed Pro Moonlight"))
|
||||
.unwrap(),
|
||||
};
|
||||
|
||||
for value in user_values.into_iter().copied().cloned() {
|
||||
@@ -140,6 +147,7 @@ impl settings2::Settings for ThemeSettings {
|
||||
}
|
||||
}
|
||||
|
||||
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),
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
use gpui2::{HighlightStyle, Hsla};
|
||||
|
||||
#[derive(Clone, Default)]
|
||||
pub struct SyntaxTheme {
|
||||
pub highlights: Vec<(String, HighlightStyle)>,
|
||||
}
|
||||
|
||||
impl SyntaxTheme {
|
||||
// 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()
|
||||
}
|
||||
}
|
||||
+48
-125
@@ -1,17 +1,21 @@
|
||||
mod default;
|
||||
mod colors;
|
||||
mod default_colors;
|
||||
mod default_theme;
|
||||
mod registry;
|
||||
mod scale;
|
||||
mod settings;
|
||||
mod themes;
|
||||
mod syntax;
|
||||
|
||||
pub use default::*;
|
||||
pub use colors::*;
|
||||
pub use default_colors::*;
|
||||
pub use default_theme::*;
|
||||
pub use registry::*;
|
||||
pub use scale::*;
|
||||
pub use settings::*;
|
||||
pub use syntax::*;
|
||||
|
||||
use gpui2::{AppContext, HighlightStyle, Hsla, SharedString};
|
||||
use gpui2::{AppContext, Hsla, SharedString};
|
||||
use settings2::Settings;
|
||||
use std::sync::Arc;
|
||||
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
pub enum Appearance {
|
||||
@@ -24,132 +28,51 @@ pub fn init(cx: &mut AppContext) {
|
||||
ThemeSettings::register(cx);
|
||||
}
|
||||
|
||||
pub fn active_theme<'a>(cx: &'a AppContext) -> &'a Arc<Theme> {
|
||||
&ThemeSettings::get_global(cx).active_theme
|
||||
pub trait ActiveTheme {
|
||||
fn theme(&self) -> &ThemeVariant;
|
||||
}
|
||||
|
||||
pub fn theme(cx: &AppContext) -> Arc<Theme> {
|
||||
active_theme(cx).clone()
|
||||
}
|
||||
|
||||
pub struct Theme {
|
||||
pub metadata: ThemeMetadata,
|
||||
|
||||
pub transparent: Hsla,
|
||||
pub mac_os_traffic_light_red: Hsla,
|
||||
pub mac_os_traffic_light_yellow: Hsla,
|
||||
pub mac_os_traffic_light_green: Hsla,
|
||||
pub border: Hsla,
|
||||
pub border_variant: Hsla,
|
||||
pub border_focused: Hsla,
|
||||
pub border_transparent: Hsla,
|
||||
/// The background color of an elevated surface, like a modal, tooltip or toast.
|
||||
pub elevated_surface: Hsla,
|
||||
pub surface: Hsla,
|
||||
/// Window background color of the base app
|
||||
pub background: Hsla,
|
||||
/// Default background for elements like filled buttons,
|
||||
/// text fields, checkboxes, radio buttons, etc.
|
||||
/// - TODO: Map to step 3.
|
||||
pub filled_element: Hsla,
|
||||
/// The background color of a hovered element, like a button being hovered
|
||||
/// with a mouse, or hovered on a touch screen.
|
||||
/// - TODO: Map to step 4.
|
||||
pub filled_element_hover: Hsla,
|
||||
/// The background color of an active element, like a button being pressed,
|
||||
/// or tapped on a touch screen.
|
||||
/// - TODO: Map to step 5.
|
||||
pub filled_element_active: Hsla,
|
||||
/// The background color of a selected element, like a selected tab,
|
||||
/// a button toggled on, or a checkbox that is checked.
|
||||
pub filled_element_selected: Hsla,
|
||||
pub filled_element_disabled: Hsla,
|
||||
pub ghost_element: Hsla,
|
||||
/// The background color of a hovered element with no default background,
|
||||
/// like a ghost-style button or an interactable list item.
|
||||
/// - TODO: Map to step 3.
|
||||
pub ghost_element_hover: Hsla,
|
||||
/// - TODO: Map to step 4.
|
||||
pub ghost_element_active: Hsla,
|
||||
pub ghost_element_selected: Hsla,
|
||||
pub ghost_element_disabled: Hsla,
|
||||
pub text: Hsla,
|
||||
pub text_muted: Hsla,
|
||||
pub text_placeholder: Hsla,
|
||||
pub text_disabled: Hsla,
|
||||
pub text_accent: Hsla,
|
||||
pub icon_muted: Hsla,
|
||||
pub syntax: SyntaxTheme,
|
||||
|
||||
pub status_bar: Hsla,
|
||||
pub title_bar: Hsla,
|
||||
pub toolbar: Hsla,
|
||||
pub tab_bar: Hsla,
|
||||
/// The background of the editor
|
||||
pub editor: Hsla,
|
||||
pub editor_subheader: Hsla,
|
||||
pub editor_active_line: Hsla,
|
||||
pub terminal: Hsla,
|
||||
pub image_fallback_background: Hsla,
|
||||
|
||||
pub git_created: Hsla,
|
||||
pub git_modified: Hsla,
|
||||
pub git_deleted: Hsla,
|
||||
pub git_conflict: Hsla,
|
||||
pub git_ignored: Hsla,
|
||||
pub git_renamed: Hsla,
|
||||
|
||||
pub players: [PlayerTheme; 8],
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct SyntaxTheme {
|
||||
pub highlights: Vec<(String, HighlightStyle)>,
|
||||
}
|
||||
|
||||
impl SyntaxTheme {
|
||||
// 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()
|
||||
impl ActiveTheme for AppContext {
|
||||
fn theme(&self) -> &ThemeVariant {
|
||||
&ThemeSettings::get_global(self).active_theme
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy)]
|
||||
pub struct PlayerTheme {
|
||||
pub cursor: Hsla,
|
||||
pub selection: Hsla,
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct ThemeMetadata {
|
||||
pub struct ThemeFamily {
|
||||
#[allow(dead_code)]
|
||||
pub(crate) id: String,
|
||||
pub name: SharedString,
|
||||
pub is_light: bool,
|
||||
pub author: SharedString,
|
||||
pub themes: Vec<ThemeVariant>,
|
||||
pub scales: ColorScales,
|
||||
}
|
||||
|
||||
pub struct Editor {
|
||||
pub syntax: Arc<SyntaxTheme>,
|
||||
impl ThemeFamily {}
|
||||
|
||||
pub struct ThemeVariant {
|
||||
#[allow(dead_code)]
|
||||
pub(crate) id: String,
|
||||
pub name: SharedString,
|
||||
pub appearance: Appearance,
|
||||
pub styles: ThemeStyles,
|
||||
}
|
||||
|
||||
impl ThemeVariant {
|
||||
/// Returns the [`ThemeColors`] for the theme.
|
||||
#[inline(always)]
|
||||
pub fn colors(&self) -> &ThemeColors {
|
||||
&self.styles.colors
|
||||
}
|
||||
|
||||
/// Returns the [`SyntaxTheme`] for the theme.
|
||||
#[inline(always)]
|
||||
pub fn syntax(&self) -> &SyntaxTheme {
|
||||
&self.styles.syntax
|
||||
}
|
||||
|
||||
/// Returns the color for the syntax node with the given name.
|
||||
#[inline(always)]
|
||||
pub fn syntax_color(&self, name: &str) -> Hsla {
|
||||
self.syntax().color(name)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,130 +0,0 @@
|
||||
use gpui2::rgba;
|
||||
|
||||
use crate::{PlayerTheme, SyntaxTheme, Theme, ThemeMetadata};
|
||||
|
||||
pub fn andromeda() -> Theme {
|
||||
Theme {
|
||||
metadata: ThemeMetadata {
|
||||
name: "Andromeda".into(),
|
||||
is_light: false,
|
||||
},
|
||||
transparent: rgba(0x00000000).into(),
|
||||
mac_os_traffic_light_red: rgba(0xec695eff).into(),
|
||||
mac_os_traffic_light_yellow: rgba(0xf4bf4eff).into(),
|
||||
mac_os_traffic_light_green: rgba(0x61c553ff).into(),
|
||||
border: rgba(0x2b2f38ff).into(),
|
||||
border_variant: rgba(0x2b2f38ff).into(),
|
||||
border_focused: rgba(0x183934ff).into(),
|
||||
border_transparent: rgba(0x00000000).into(),
|
||||
elevated_surface: rgba(0x262933ff).into(),
|
||||
surface: rgba(0x21242bff).into(),
|
||||
background: rgba(0x262933ff).into(),
|
||||
filled_element: rgba(0x262933ff).into(),
|
||||
filled_element_hover: rgba(0xffffff1e).into(),
|
||||
filled_element_active: rgba(0xffffff28).into(),
|
||||
filled_element_selected: rgba(0x12231fff).into(),
|
||||
filled_element_disabled: rgba(0x00000000).into(),
|
||||
ghost_element: rgba(0x00000000).into(),
|
||||
ghost_element_hover: rgba(0xffffff14).into(),
|
||||
ghost_element_active: rgba(0xffffff1e).into(),
|
||||
ghost_element_selected: rgba(0x12231fff).into(),
|
||||
ghost_element_disabled: rgba(0x00000000).into(),
|
||||
text: rgba(0xf7f7f8ff).into(),
|
||||
text_muted: rgba(0xaca8aeff).into(),
|
||||
text_placeholder: rgba(0xf82871ff).into(),
|
||||
text_disabled: rgba(0x6b6b73ff).into(),
|
||||
text_accent: rgba(0x10a793ff).into(),
|
||||
icon_muted: rgba(0xaca8aeff).into(),
|
||||
syntax: SyntaxTheme {
|
||||
highlights: vec![
|
||||
("emphasis".into(), rgba(0x10a793ff).into()),
|
||||
("punctuation.bracket".into(), rgba(0xd8d5dbff).into()),
|
||||
("attribute".into(), rgba(0x10a793ff).into()),
|
||||
("variable".into(), rgba(0xf7f7f8ff).into()),
|
||||
("predictive".into(), rgba(0x315f70ff).into()),
|
||||
("property".into(), rgba(0x10a793ff).into()),
|
||||
("variant".into(), rgba(0x10a793ff).into()),
|
||||
("embedded".into(), rgba(0xf7f7f8ff).into()),
|
||||
("string.special".into(), rgba(0xf29c14ff).into()),
|
||||
("keyword".into(), rgba(0x10a793ff).into()),
|
||||
("tag".into(), rgba(0x10a793ff).into()),
|
||||
("enum".into(), rgba(0xf29c14ff).into()),
|
||||
("link_text".into(), rgba(0xf29c14ff).into()),
|
||||
("primary".into(), rgba(0xf7f7f8ff).into()),
|
||||
("punctuation".into(), rgba(0xd8d5dbff).into()),
|
||||
("punctuation.special".into(), rgba(0xd8d5dbff).into()),
|
||||
("function".into(), rgba(0xfee56cff).into()),
|
||||
("number".into(), rgba(0x96df71ff).into()),
|
||||
("preproc".into(), rgba(0xf7f7f8ff).into()),
|
||||
("operator".into(), rgba(0xf29c14ff).into()),
|
||||
("constructor".into(), rgba(0x10a793ff).into()),
|
||||
("string.escape".into(), rgba(0xafabb1ff).into()),
|
||||
("string.special.symbol".into(), rgba(0xf29c14ff).into()),
|
||||
("string".into(), rgba(0xf29c14ff).into()),
|
||||
("comment".into(), rgba(0xafabb1ff).into()),
|
||||
("hint".into(), rgba(0x618399ff).into()),
|
||||
("type".into(), rgba(0x08e7c5ff).into()),
|
||||
("label".into(), rgba(0x10a793ff).into()),
|
||||
("comment.doc".into(), rgba(0xafabb1ff).into()),
|
||||
("text.literal".into(), rgba(0xf29c14ff).into()),
|
||||
("constant".into(), rgba(0x96df71ff).into()),
|
||||
("string.regex".into(), rgba(0xf29c14ff).into()),
|
||||
("emphasis.strong".into(), rgba(0x10a793ff).into()),
|
||||
("title".into(), rgba(0xf7f7f8ff).into()),
|
||||
("punctuation.delimiter".into(), rgba(0xd8d5dbff).into()),
|
||||
("link_uri".into(), rgba(0x96df71ff).into()),
|
||||
("boolean".into(), rgba(0x96df71ff).into()),
|
||||
("punctuation.list_marker".into(), rgba(0xd8d5dbff).into()),
|
||||
],
|
||||
},
|
||||
status_bar: rgba(0x262933ff).into(),
|
||||
title_bar: rgba(0x262933ff).into(),
|
||||
toolbar: rgba(0x1e2025ff).into(),
|
||||
tab_bar: rgba(0x21242bff).into(),
|
||||
editor: rgba(0x1e2025ff).into(),
|
||||
editor_subheader: rgba(0x21242bff).into(),
|
||||
editor_active_line: rgba(0x21242bff).into(),
|
||||
terminal: rgba(0x1e2025ff).into(),
|
||||
image_fallback_background: rgba(0x262933ff).into(),
|
||||
git_created: rgba(0x96df71ff).into(),
|
||||
git_modified: rgba(0x10a793ff).into(),
|
||||
git_deleted: rgba(0xf82871ff).into(),
|
||||
git_conflict: rgba(0xfee56cff).into(),
|
||||
git_ignored: rgba(0x6b6b73ff).into(),
|
||||
git_renamed: rgba(0xfee56cff).into(),
|
||||
players: [
|
||||
PlayerTheme {
|
||||
cursor: rgba(0x10a793ff).into(),
|
||||
selection: rgba(0x10a7933d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0x96df71ff).into(),
|
||||
selection: rgba(0x96df713d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0xc74cecff).into(),
|
||||
selection: rgba(0xc74cec3d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0xf29c14ff).into(),
|
||||
selection: rgba(0xf29c143d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0x893ea6ff).into(),
|
||||
selection: rgba(0x893ea63d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0x08e7c5ff).into(),
|
||||
selection: rgba(0x08e7c53d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0xf82871ff).into(),
|
||||
selection: rgba(0xf828713d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0xfee56cff).into(),
|
||||
selection: rgba(0xfee56c3d).into(),
|
||||
},
|
||||
],
|
||||
}
|
||||
}
|
||||
@@ -1,136 +0,0 @@
|
||||
use gpui2::rgba;
|
||||
|
||||
use crate::{PlayerTheme, SyntaxTheme, Theme, ThemeMetadata};
|
||||
|
||||
pub fn atelier_cave_dark() -> Theme {
|
||||
Theme {
|
||||
metadata: ThemeMetadata {
|
||||
name: "Atelier Cave Dark".into(),
|
||||
is_light: false,
|
||||
},
|
||||
transparent: rgba(0x00000000).into(),
|
||||
mac_os_traffic_light_red: rgba(0xec695eff).into(),
|
||||
mac_os_traffic_light_yellow: rgba(0xf4bf4eff).into(),
|
||||
mac_os_traffic_light_green: rgba(0x61c553ff).into(),
|
||||
border: rgba(0x56505eff).into(),
|
||||
border_variant: rgba(0x56505eff).into(),
|
||||
border_focused: rgba(0x222953ff).into(),
|
||||
border_transparent: rgba(0x00000000).into(),
|
||||
elevated_surface: rgba(0x3a353fff).into(),
|
||||
surface: rgba(0x221f26ff).into(),
|
||||
background: rgba(0x3a353fff).into(),
|
||||
filled_element: rgba(0x3a353fff).into(),
|
||||
filled_element_hover: rgba(0xffffff1e).into(),
|
||||
filled_element_active: rgba(0xffffff28).into(),
|
||||
filled_element_selected: rgba(0x161a35ff).into(),
|
||||
filled_element_disabled: rgba(0x00000000).into(),
|
||||
ghost_element: rgba(0x00000000).into(),
|
||||
ghost_element_hover: rgba(0xffffff14).into(),
|
||||
ghost_element_active: rgba(0xffffff1e).into(),
|
||||
ghost_element_selected: rgba(0x161a35ff).into(),
|
||||
ghost_element_disabled: rgba(0x00000000).into(),
|
||||
text: rgba(0xefecf4ff).into(),
|
||||
text_muted: rgba(0x898591ff).into(),
|
||||
text_placeholder: rgba(0xbe4677ff).into(),
|
||||
text_disabled: rgba(0x756f7eff).into(),
|
||||
text_accent: rgba(0x566ddaff).into(),
|
||||
icon_muted: rgba(0x898591ff).into(),
|
||||
syntax: SyntaxTheme {
|
||||
highlights: vec![
|
||||
("comment.doc".into(), rgba(0x8b8792ff).into()),
|
||||
("tag".into(), rgba(0x566ddaff).into()),
|
||||
("link_text".into(), rgba(0xaa563bff).into()),
|
||||
("constructor".into(), rgba(0x566ddaff).into()),
|
||||
("punctuation".into(), rgba(0xe2dfe7ff).into()),
|
||||
("punctuation.special".into(), rgba(0xbf3fbfff).into()),
|
||||
("string.special.symbol".into(), rgba(0x299292ff).into()),
|
||||
("string.escape".into(), rgba(0x8b8792ff).into()),
|
||||
("emphasis".into(), rgba(0x566ddaff).into()),
|
||||
("type".into(), rgba(0xa06d3aff).into()),
|
||||
("punctuation.delimiter".into(), rgba(0x8b8792ff).into()),
|
||||
("variant".into(), rgba(0xa06d3aff).into()),
|
||||
("variable.special".into(), rgba(0x9559e7ff).into()),
|
||||
("text.literal".into(), rgba(0xaa563bff).into()),
|
||||
("punctuation.list_marker".into(), rgba(0xe2dfe7ff).into()),
|
||||
("comment".into(), rgba(0x655f6dff).into()),
|
||||
("function.method".into(), rgba(0x576cdbff).into()),
|
||||
("property".into(), rgba(0xbe4677ff).into()),
|
||||
("operator".into(), rgba(0x8b8792ff).into()),
|
||||
("emphasis.strong".into(), rgba(0x566ddaff).into()),
|
||||
("label".into(), rgba(0x566ddaff).into()),
|
||||
("enum".into(), rgba(0xaa563bff).into()),
|
||||
("number".into(), rgba(0xaa563bff).into()),
|
||||
("primary".into(), rgba(0xe2dfe7ff).into()),
|
||||
("keyword".into(), rgba(0x9559e7ff).into()),
|
||||
(
|
||||
"function.special.definition".into(),
|
||||
rgba(0xa06d3aff).into(),
|
||||
),
|
||||
("punctuation.bracket".into(), rgba(0x8b8792ff).into()),
|
||||
("constant".into(), rgba(0x2b9292ff).into()),
|
||||
("string.special".into(), rgba(0xbf3fbfff).into()),
|
||||
("title".into(), rgba(0xefecf4ff).into()),
|
||||
("preproc".into(), rgba(0xefecf4ff).into()),
|
||||
("link_uri".into(), rgba(0x2b9292ff).into()),
|
||||
("string".into(), rgba(0x299292ff).into()),
|
||||
("embedded".into(), rgba(0xefecf4ff).into()),
|
||||
("hint".into(), rgba(0x706897ff).into()),
|
||||
("boolean".into(), rgba(0x2b9292ff).into()),
|
||||
("variable".into(), rgba(0xe2dfe7ff).into()),
|
||||
("predictive".into(), rgba(0x615787ff).into()),
|
||||
("string.regex".into(), rgba(0x388bc6ff).into()),
|
||||
("function".into(), rgba(0x576cdbff).into()),
|
||||
("attribute".into(), rgba(0x566ddaff).into()),
|
||||
],
|
||||
},
|
||||
status_bar: rgba(0x3a353fff).into(),
|
||||
title_bar: rgba(0x3a353fff).into(),
|
||||
toolbar: rgba(0x19171cff).into(),
|
||||
tab_bar: rgba(0x221f26ff).into(),
|
||||
editor: rgba(0x19171cff).into(),
|
||||
editor_subheader: rgba(0x221f26ff).into(),
|
||||
editor_active_line: rgba(0x221f26ff).into(),
|
||||
terminal: rgba(0x19171cff).into(),
|
||||
image_fallback_background: rgba(0x3a353fff).into(),
|
||||
git_created: rgba(0x2b9292ff).into(),
|
||||
git_modified: rgba(0x566ddaff).into(),
|
||||
git_deleted: rgba(0xbe4677ff).into(),
|
||||
git_conflict: rgba(0xa06d3aff).into(),
|
||||
git_ignored: rgba(0x756f7eff).into(),
|
||||
git_renamed: rgba(0xa06d3aff).into(),
|
||||
players: [
|
||||
PlayerTheme {
|
||||
cursor: rgba(0x566ddaff).into(),
|
||||
selection: rgba(0x566dda3d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0x2b9292ff).into(),
|
||||
selection: rgba(0x2b92923d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0xbf41bfff).into(),
|
||||
selection: rgba(0xbf41bf3d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0xaa563bff).into(),
|
||||
selection: rgba(0xaa563b3d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0x955ae6ff).into(),
|
||||
selection: rgba(0x955ae63d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0x3a8bc6ff).into(),
|
||||
selection: rgba(0x3a8bc63d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0xbe4677ff).into(),
|
||||
selection: rgba(0xbe46773d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0xa06d3aff).into(),
|
||||
selection: rgba(0xa06d3a3d).into(),
|
||||
},
|
||||
],
|
||||
}
|
||||
}
|
||||
@@ -1,136 +0,0 @@
|
||||
use gpui2::rgba;
|
||||
|
||||
use crate::{PlayerTheme, SyntaxTheme, Theme, ThemeMetadata};
|
||||
|
||||
pub fn atelier_cave_light() -> Theme {
|
||||
Theme {
|
||||
metadata: ThemeMetadata {
|
||||
name: "Atelier Cave Light".into(),
|
||||
is_light: true,
|
||||
},
|
||||
transparent: rgba(0x00000000).into(),
|
||||
mac_os_traffic_light_red: rgba(0xec695eff).into(),
|
||||
mac_os_traffic_light_yellow: rgba(0xf4bf4eff).into(),
|
||||
mac_os_traffic_light_green: rgba(0x61c553ff).into(),
|
||||
border: rgba(0x8f8b96ff).into(),
|
||||
border_variant: rgba(0x8f8b96ff).into(),
|
||||
border_focused: rgba(0xc8c7f2ff).into(),
|
||||
border_transparent: rgba(0x00000000).into(),
|
||||
elevated_surface: rgba(0xbfbcc5ff).into(),
|
||||
surface: rgba(0xe6e3ebff).into(),
|
||||
background: rgba(0xbfbcc5ff).into(),
|
||||
filled_element: rgba(0xbfbcc5ff).into(),
|
||||
filled_element_hover: rgba(0xffffff1e).into(),
|
||||
filled_element_active: rgba(0xffffff28).into(),
|
||||
filled_element_selected: rgba(0xe1e0f9ff).into(),
|
||||
filled_element_disabled: rgba(0x00000000).into(),
|
||||
ghost_element: rgba(0x00000000).into(),
|
||||
ghost_element_hover: rgba(0xffffff14).into(),
|
||||
ghost_element_active: rgba(0xffffff1e).into(),
|
||||
ghost_element_selected: rgba(0xe1e0f9ff).into(),
|
||||
ghost_element_disabled: rgba(0x00000000).into(),
|
||||
text: rgba(0x19171cff).into(),
|
||||
text_muted: rgba(0x5a5462ff).into(),
|
||||
text_placeholder: rgba(0xbd4677ff).into(),
|
||||
text_disabled: rgba(0x6e6876ff).into(),
|
||||
text_accent: rgba(0x586cdaff).into(),
|
||||
icon_muted: rgba(0x5a5462ff).into(),
|
||||
syntax: SyntaxTheme {
|
||||
highlights: vec![
|
||||
("link_text".into(), rgba(0xaa573cff).into()),
|
||||
("string".into(), rgba(0x299292ff).into()),
|
||||
("emphasis".into(), rgba(0x586cdaff).into()),
|
||||
("label".into(), rgba(0x586cdaff).into()),
|
||||
("property".into(), rgba(0xbe4677ff).into()),
|
||||
("emphasis.strong".into(), rgba(0x586cdaff).into()),
|
||||
("constant".into(), rgba(0x2b9292ff).into()),
|
||||
(
|
||||
"function.special.definition".into(),
|
||||
rgba(0xa06d3aff).into(),
|
||||
),
|
||||
("embedded".into(), rgba(0x19171cff).into()),
|
||||
("punctuation.special".into(), rgba(0xbf3fbfff).into()),
|
||||
("function".into(), rgba(0x576cdbff).into()),
|
||||
("tag".into(), rgba(0x586cdaff).into()),
|
||||
("number".into(), rgba(0xaa563bff).into()),
|
||||
("primary".into(), rgba(0x26232aff).into()),
|
||||
("text.literal".into(), rgba(0xaa573cff).into()),
|
||||
("variant".into(), rgba(0xa06d3aff).into()),
|
||||
("type".into(), rgba(0xa06d3aff).into()),
|
||||
("punctuation".into(), rgba(0x26232aff).into()),
|
||||
("string.escape".into(), rgba(0x585260ff).into()),
|
||||
("keyword".into(), rgba(0x9559e7ff).into()),
|
||||
("title".into(), rgba(0x19171cff).into()),
|
||||
("constructor".into(), rgba(0x586cdaff).into()),
|
||||
("punctuation.list_marker".into(), rgba(0x26232aff).into()),
|
||||
("string.special".into(), rgba(0xbf3fbfff).into()),
|
||||
("operator".into(), rgba(0x585260ff).into()),
|
||||
("function.method".into(), rgba(0x576cdbff).into()),
|
||||
("link_uri".into(), rgba(0x2b9292ff).into()),
|
||||
("variable.special".into(), rgba(0x9559e7ff).into()),
|
||||
("hint".into(), rgba(0x776d9dff).into()),
|
||||
("punctuation.bracket".into(), rgba(0x585260ff).into()),
|
||||
("string.special.symbol".into(), rgba(0x299292ff).into()),
|
||||
("predictive".into(), rgba(0x887fafff).into()),
|
||||
("attribute".into(), rgba(0x586cdaff).into()),
|
||||
("enum".into(), rgba(0xaa573cff).into()),
|
||||
("preproc".into(), rgba(0x19171cff).into()),
|
||||
("boolean".into(), rgba(0x2b9292ff).into()),
|
||||
("variable".into(), rgba(0x26232aff).into()),
|
||||
("comment.doc".into(), rgba(0x585260ff).into()),
|
||||
("string.regex".into(), rgba(0x388bc6ff).into()),
|
||||
("punctuation.delimiter".into(), rgba(0x585260ff).into()),
|
||||
("comment".into(), rgba(0x7d7787ff).into()),
|
||||
],
|
||||
},
|
||||
status_bar: rgba(0xbfbcc5ff).into(),
|
||||
title_bar: rgba(0xbfbcc5ff).into(),
|
||||
toolbar: rgba(0xefecf4ff).into(),
|
||||
tab_bar: rgba(0xe6e3ebff).into(),
|
||||
editor: rgba(0xefecf4ff).into(),
|
||||
editor_subheader: rgba(0xe6e3ebff).into(),
|
||||
editor_active_line: rgba(0xe6e3ebff).into(),
|
||||
terminal: rgba(0xefecf4ff).into(),
|
||||
image_fallback_background: rgba(0xbfbcc5ff).into(),
|
||||
git_created: rgba(0x2b9292ff).into(),
|
||||
git_modified: rgba(0x586cdaff).into(),
|
||||
git_deleted: rgba(0xbd4677ff).into(),
|
||||
git_conflict: rgba(0xa06e3bff).into(),
|
||||
git_ignored: rgba(0x6e6876ff).into(),
|
||||
git_renamed: rgba(0xa06e3bff).into(),
|
||||
players: [
|
||||
PlayerTheme {
|
||||
cursor: rgba(0x586cdaff).into(),
|
||||
selection: rgba(0x586cda3d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0x2b9292ff).into(),
|
||||
selection: rgba(0x2b92923d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0xbf41bfff).into(),
|
||||
selection: rgba(0xbf41bf3d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0xaa573cff).into(),
|
||||
selection: rgba(0xaa573c3d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0x955ae6ff).into(),
|
||||
selection: rgba(0x955ae63d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0x3a8bc6ff).into(),
|
||||
selection: rgba(0x3a8bc63d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0xbd4677ff).into(),
|
||||
selection: rgba(0xbd46773d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0xa06e3bff).into(),
|
||||
selection: rgba(0xa06e3b3d).into(),
|
||||
},
|
||||
],
|
||||
}
|
||||
}
|
||||
@@ -1,136 +0,0 @@
|
||||
use gpui2::rgba;
|
||||
|
||||
use crate::{PlayerTheme, SyntaxTheme, Theme, ThemeMetadata};
|
||||
|
||||
pub fn atelier_dune_dark() -> Theme {
|
||||
Theme {
|
||||
metadata: ThemeMetadata {
|
||||
name: "Atelier Dune Dark".into(),
|
||||
is_light: false,
|
||||
},
|
||||
transparent: rgba(0x00000000).into(),
|
||||
mac_os_traffic_light_red: rgba(0xec695eff).into(),
|
||||
mac_os_traffic_light_yellow: rgba(0xf4bf4eff).into(),
|
||||
mac_os_traffic_light_green: rgba(0x61c553ff).into(),
|
||||
border: rgba(0x6c695cff).into(),
|
||||
border_variant: rgba(0x6c695cff).into(),
|
||||
border_focused: rgba(0x262f56ff).into(),
|
||||
border_transparent: rgba(0x00000000).into(),
|
||||
elevated_surface: rgba(0x45433bff).into(),
|
||||
surface: rgba(0x262622ff).into(),
|
||||
background: rgba(0x45433bff).into(),
|
||||
filled_element: rgba(0x45433bff).into(),
|
||||
filled_element_hover: rgba(0xffffff1e).into(),
|
||||
filled_element_active: rgba(0xffffff28).into(),
|
||||
filled_element_selected: rgba(0x171e38ff).into(),
|
||||
filled_element_disabled: rgba(0x00000000).into(),
|
||||
ghost_element: rgba(0x00000000).into(),
|
||||
ghost_element_hover: rgba(0xffffff14).into(),
|
||||
ghost_element_active: rgba(0xffffff1e).into(),
|
||||
ghost_element_selected: rgba(0x171e38ff).into(),
|
||||
ghost_element_disabled: rgba(0x00000000).into(),
|
||||
text: rgba(0xfefbecff).into(),
|
||||
text_muted: rgba(0xa4a08bff).into(),
|
||||
text_placeholder: rgba(0xd73837ff).into(),
|
||||
text_disabled: rgba(0x8f8b77ff).into(),
|
||||
text_accent: rgba(0x6684e0ff).into(),
|
||||
icon_muted: rgba(0xa4a08bff).into(),
|
||||
syntax: SyntaxTheme {
|
||||
highlights: vec![
|
||||
("constructor".into(), rgba(0x6684e0ff).into()),
|
||||
("punctuation".into(), rgba(0xe8e4cfff).into()),
|
||||
("punctuation.delimiter".into(), rgba(0xa6a28cff).into()),
|
||||
("string.special".into(), rgba(0xd43451ff).into()),
|
||||
("string.escape".into(), rgba(0xa6a28cff).into()),
|
||||
("comment".into(), rgba(0x7d7a68ff).into()),
|
||||
("enum".into(), rgba(0xb65611ff).into()),
|
||||
("variable.special".into(), rgba(0xb854d4ff).into()),
|
||||
("primary".into(), rgba(0xe8e4cfff).into()),
|
||||
("comment.doc".into(), rgba(0xa6a28cff).into()),
|
||||
("label".into(), rgba(0x6684e0ff).into()),
|
||||
("operator".into(), rgba(0xa6a28cff).into()),
|
||||
("string".into(), rgba(0x5fac38ff).into()),
|
||||
("variant".into(), rgba(0xae9512ff).into()),
|
||||
("variable".into(), rgba(0xe8e4cfff).into()),
|
||||
("function.method".into(), rgba(0x6583e1ff).into()),
|
||||
(
|
||||
"function.special.definition".into(),
|
||||
rgba(0xae9512ff).into(),
|
||||
),
|
||||
("string.regex".into(), rgba(0x1ead82ff).into()),
|
||||
("emphasis.strong".into(), rgba(0x6684e0ff).into()),
|
||||
("punctuation.special".into(), rgba(0xd43451ff).into()),
|
||||
("punctuation.bracket".into(), rgba(0xa6a28cff).into()),
|
||||
("link_text".into(), rgba(0xb65611ff).into()),
|
||||
("link_uri".into(), rgba(0x5fac39ff).into()),
|
||||
("boolean".into(), rgba(0x5fac39ff).into()),
|
||||
("hint".into(), rgba(0xb17272ff).into()),
|
||||
("tag".into(), rgba(0x6684e0ff).into()),
|
||||
("function".into(), rgba(0x6583e1ff).into()),
|
||||
("title".into(), rgba(0xfefbecff).into()),
|
||||
("property".into(), rgba(0xd73737ff).into()),
|
||||
("type".into(), rgba(0xae9512ff).into()),
|
||||
("constant".into(), rgba(0x5fac39ff).into()),
|
||||
("attribute".into(), rgba(0x6684e0ff).into()),
|
||||
("predictive".into(), rgba(0x9c6262ff).into()),
|
||||
("string.special.symbol".into(), rgba(0x5fac38ff).into()),
|
||||
("punctuation.list_marker".into(), rgba(0xe8e4cfff).into()),
|
||||
("emphasis".into(), rgba(0x6684e0ff).into()),
|
||||
("keyword".into(), rgba(0xb854d4ff).into()),
|
||||
("text.literal".into(), rgba(0xb65611ff).into()),
|
||||
("number".into(), rgba(0xb65610ff).into()),
|
||||
("preproc".into(), rgba(0xfefbecff).into()),
|
||||
("embedded".into(), rgba(0xfefbecff).into()),
|
||||
],
|
||||
},
|
||||
status_bar: rgba(0x45433bff).into(),
|
||||
title_bar: rgba(0x45433bff).into(),
|
||||
toolbar: rgba(0x20201dff).into(),
|
||||
tab_bar: rgba(0x262622ff).into(),
|
||||
editor: rgba(0x20201dff).into(),
|
||||
editor_subheader: rgba(0x262622ff).into(),
|
||||
editor_active_line: rgba(0x262622ff).into(),
|
||||
terminal: rgba(0x20201dff).into(),
|
||||
image_fallback_background: rgba(0x45433bff).into(),
|
||||
git_created: rgba(0x5fac39ff).into(),
|
||||
git_modified: rgba(0x6684e0ff).into(),
|
||||
git_deleted: rgba(0xd73837ff).into(),
|
||||
git_conflict: rgba(0xae9414ff).into(),
|
||||
git_ignored: rgba(0x8f8b77ff).into(),
|
||||
git_renamed: rgba(0xae9414ff).into(),
|
||||
players: [
|
||||
PlayerTheme {
|
||||
cursor: rgba(0x6684e0ff).into(),
|
||||
selection: rgba(0x6684e03d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0x5fac39ff).into(),
|
||||
selection: rgba(0x5fac393d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0xd43651ff).into(),
|
||||
selection: rgba(0xd436513d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0xb65611ff).into(),
|
||||
selection: rgba(0xb656113d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0xb854d3ff).into(),
|
||||
selection: rgba(0xb854d33d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0x20ad83ff).into(),
|
||||
selection: rgba(0x20ad833d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0xd73837ff).into(),
|
||||
selection: rgba(0xd738373d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0xae9414ff).into(),
|
||||
selection: rgba(0xae94143d).into(),
|
||||
},
|
||||
],
|
||||
}
|
||||
}
|
||||
@@ -1,136 +0,0 @@
|
||||
use gpui2::rgba;
|
||||
|
||||
use crate::{PlayerTheme, SyntaxTheme, Theme, ThemeMetadata};
|
||||
|
||||
pub fn atelier_dune_light() -> Theme {
|
||||
Theme {
|
||||
metadata: ThemeMetadata {
|
||||
name: "Atelier Dune Light".into(),
|
||||
is_light: true,
|
||||
},
|
||||
transparent: rgba(0x00000000).into(),
|
||||
mac_os_traffic_light_red: rgba(0xec695eff).into(),
|
||||
mac_os_traffic_light_yellow: rgba(0xf4bf4eff).into(),
|
||||
mac_os_traffic_light_green: rgba(0x61c553ff).into(),
|
||||
border: rgba(0xa8a48eff).into(),
|
||||
border_variant: rgba(0xa8a48eff).into(),
|
||||
border_focused: rgba(0xcdd1f5ff).into(),
|
||||
border_transparent: rgba(0x00000000).into(),
|
||||
elevated_surface: rgba(0xcecab4ff).into(),
|
||||
surface: rgba(0xeeebd7ff).into(),
|
||||
background: rgba(0xcecab4ff).into(),
|
||||
filled_element: rgba(0xcecab4ff).into(),
|
||||
filled_element_hover: rgba(0xffffff1e).into(),
|
||||
filled_element_active: rgba(0xffffff28).into(),
|
||||
filled_element_selected: rgba(0xe3e5faff).into(),
|
||||
filled_element_disabled: rgba(0x00000000).into(),
|
||||
ghost_element: rgba(0x00000000).into(),
|
||||
ghost_element_hover: rgba(0xffffff14).into(),
|
||||
ghost_element_active: rgba(0xffffff1e).into(),
|
||||
ghost_element_selected: rgba(0xe3e5faff).into(),
|
||||
ghost_element_disabled: rgba(0x00000000).into(),
|
||||
text: rgba(0x20201dff).into(),
|
||||
text_muted: rgba(0x706d5fff).into(),
|
||||
text_placeholder: rgba(0xd73737ff).into(),
|
||||
text_disabled: rgba(0x878471ff).into(),
|
||||
text_accent: rgba(0x6684dfff).into(),
|
||||
icon_muted: rgba(0x706d5fff).into(),
|
||||
syntax: SyntaxTheme {
|
||||
highlights: vec![
|
||||
("primary".into(), rgba(0x292824ff).into()),
|
||||
("comment".into(), rgba(0x999580ff).into()),
|
||||
("type".into(), rgba(0xae9512ff).into()),
|
||||
("variant".into(), rgba(0xae9512ff).into()),
|
||||
("label".into(), rgba(0x6684dfff).into()),
|
||||
("function.method".into(), rgba(0x6583e1ff).into()),
|
||||
("variable.special".into(), rgba(0xb854d4ff).into()),
|
||||
("string.regex".into(), rgba(0x1ead82ff).into()),
|
||||
("property".into(), rgba(0xd73737ff).into()),
|
||||
("keyword".into(), rgba(0xb854d4ff).into()),
|
||||
("number".into(), rgba(0xb65610ff).into()),
|
||||
("punctuation.list_marker".into(), rgba(0x292824ff).into()),
|
||||
(
|
||||
"function.special.definition".into(),
|
||||
rgba(0xae9512ff).into(),
|
||||
),
|
||||
("punctuation.special".into(), rgba(0xd43451ff).into()),
|
||||
("punctuation".into(), rgba(0x292824ff).into()),
|
||||
("punctuation.delimiter".into(), rgba(0x6e6b5eff).into()),
|
||||
("tag".into(), rgba(0x6684dfff).into()),
|
||||
("link_text".into(), rgba(0xb65712ff).into()),
|
||||
("boolean".into(), rgba(0x61ac39ff).into()),
|
||||
("hint".into(), rgba(0xb37979ff).into()),
|
||||
("operator".into(), rgba(0x6e6b5eff).into()),
|
||||
("constant".into(), rgba(0x61ac39ff).into()),
|
||||
("function".into(), rgba(0x6583e1ff).into()),
|
||||
("text.literal".into(), rgba(0xb65712ff).into()),
|
||||
("string.special.symbol".into(), rgba(0x5fac38ff).into()),
|
||||
("attribute".into(), rgba(0x6684dfff).into()),
|
||||
("emphasis".into(), rgba(0x6684dfff).into()),
|
||||
("preproc".into(), rgba(0x20201dff).into()),
|
||||
("comment.doc".into(), rgba(0x6e6b5eff).into()),
|
||||
("punctuation.bracket".into(), rgba(0x6e6b5eff).into()),
|
||||
("string".into(), rgba(0x5fac38ff).into()),
|
||||
("enum".into(), rgba(0xb65712ff).into()),
|
||||
("variable".into(), rgba(0x292824ff).into()),
|
||||
("string.special".into(), rgba(0xd43451ff).into()),
|
||||
("embedded".into(), rgba(0x20201dff).into()),
|
||||
("emphasis.strong".into(), rgba(0x6684dfff).into()),
|
||||
("predictive".into(), rgba(0xc88a8aff).into()),
|
||||
("title".into(), rgba(0x20201dff).into()),
|
||||
("constructor".into(), rgba(0x6684dfff).into()),
|
||||
("link_uri".into(), rgba(0x61ac39ff).into()),
|
||||
("string.escape".into(), rgba(0x6e6b5eff).into()),
|
||||
],
|
||||
},
|
||||
status_bar: rgba(0xcecab4ff).into(),
|
||||
title_bar: rgba(0xcecab4ff).into(),
|
||||
toolbar: rgba(0xfefbecff).into(),
|
||||
tab_bar: rgba(0xeeebd7ff).into(),
|
||||
editor: rgba(0xfefbecff).into(),
|
||||
editor_subheader: rgba(0xeeebd7ff).into(),
|
||||
editor_active_line: rgba(0xeeebd7ff).into(),
|
||||
terminal: rgba(0xfefbecff).into(),
|
||||
image_fallback_background: rgba(0xcecab4ff).into(),
|
||||
git_created: rgba(0x61ac39ff).into(),
|
||||
git_modified: rgba(0x6684dfff).into(),
|
||||
git_deleted: rgba(0xd73737ff).into(),
|
||||
git_conflict: rgba(0xae9414ff).into(),
|
||||
git_ignored: rgba(0x878471ff).into(),
|
||||
git_renamed: rgba(0xae9414ff).into(),
|
||||
players: [
|
||||
PlayerTheme {
|
||||
cursor: rgba(0x6684dfff).into(),
|
||||
selection: rgba(0x6684df3d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0x61ac39ff).into(),
|
||||
selection: rgba(0x61ac393d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0xd43652ff).into(),
|
||||
selection: rgba(0xd436523d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0xb65712ff).into(),
|
||||
selection: rgba(0xb657123d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0xb755d3ff).into(),
|
||||
selection: rgba(0xb755d33d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0x21ad82ff).into(),
|
||||
selection: rgba(0x21ad823d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0xd73737ff).into(),
|
||||
selection: rgba(0xd737373d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0xae9414ff).into(),
|
||||
selection: rgba(0xae94143d).into(),
|
||||
},
|
||||
],
|
||||
}
|
||||
}
|
||||
@@ -1,136 +0,0 @@
|
||||
use gpui2::rgba;
|
||||
|
||||
use crate::{PlayerTheme, SyntaxTheme, Theme, ThemeMetadata};
|
||||
|
||||
pub fn atelier_estuary_dark() -> Theme {
|
||||
Theme {
|
||||
metadata: ThemeMetadata {
|
||||
name: "Atelier Estuary Dark".into(),
|
||||
is_light: false,
|
||||
},
|
||||
transparent: rgba(0x00000000).into(),
|
||||
mac_os_traffic_light_red: rgba(0xec695eff).into(),
|
||||
mac_os_traffic_light_yellow: rgba(0xf4bf4eff).into(),
|
||||
mac_os_traffic_light_green: rgba(0x61c553ff).into(),
|
||||
border: rgba(0x5d5c4cff).into(),
|
||||
border_variant: rgba(0x5d5c4cff).into(),
|
||||
border_focused: rgba(0x1c3927ff).into(),
|
||||
border_transparent: rgba(0x00000000).into(),
|
||||
elevated_surface: rgba(0x424136ff).into(),
|
||||
surface: rgba(0x2c2b23ff).into(),
|
||||
background: rgba(0x424136ff).into(),
|
||||
filled_element: rgba(0x424136ff).into(),
|
||||
filled_element_hover: rgba(0xffffff1e).into(),
|
||||
filled_element_active: rgba(0xffffff28).into(),
|
||||
filled_element_selected: rgba(0x142319ff).into(),
|
||||
filled_element_disabled: rgba(0x00000000).into(),
|
||||
ghost_element: rgba(0x00000000).into(),
|
||||
ghost_element_hover: rgba(0xffffff14).into(),
|
||||
ghost_element_active: rgba(0xffffff1e).into(),
|
||||
ghost_element_selected: rgba(0x142319ff).into(),
|
||||
ghost_element_disabled: rgba(0x00000000).into(),
|
||||
text: rgba(0xf4f3ecff).into(),
|
||||
text_muted: rgba(0x91907fff).into(),
|
||||
text_placeholder: rgba(0xba6136ff).into(),
|
||||
text_disabled: rgba(0x7d7c6aff).into(),
|
||||
text_accent: rgba(0x36a165ff).into(),
|
||||
icon_muted: rgba(0x91907fff).into(),
|
||||
syntax: SyntaxTheme {
|
||||
highlights: vec![
|
||||
("string.special.symbol".into(), rgba(0x7c9725ff).into()),
|
||||
("comment".into(), rgba(0x6c6b5aff).into()),
|
||||
("operator".into(), rgba(0x929181ff).into()),
|
||||
("punctuation.delimiter".into(), rgba(0x929181ff).into()),
|
||||
("keyword".into(), rgba(0x5f9182ff).into()),
|
||||
("punctuation.special".into(), rgba(0x9d6b7bff).into()),
|
||||
("preproc".into(), rgba(0xf4f3ecff).into()),
|
||||
("title".into(), rgba(0xf4f3ecff).into()),
|
||||
("string.escape".into(), rgba(0x929181ff).into()),
|
||||
("boolean".into(), rgba(0x7d9726ff).into()),
|
||||
("punctuation.bracket".into(), rgba(0x929181ff).into()),
|
||||
("emphasis.strong".into(), rgba(0x36a165ff).into()),
|
||||
("string".into(), rgba(0x7c9725ff).into()),
|
||||
("constant".into(), rgba(0x7d9726ff).into()),
|
||||
("link_text".into(), rgba(0xae7214ff).into()),
|
||||
("tag".into(), rgba(0x36a165ff).into()),
|
||||
("hint".into(), rgba(0x6f815aff).into()),
|
||||
("punctuation".into(), rgba(0xe7e6dfff).into()),
|
||||
("string.regex".into(), rgba(0x5a9d47ff).into()),
|
||||
("variant".into(), rgba(0xa5980cff).into()),
|
||||
("type".into(), rgba(0xa5980cff).into()),
|
||||
("attribute".into(), rgba(0x36a165ff).into()),
|
||||
("emphasis".into(), rgba(0x36a165ff).into()),
|
||||
("enum".into(), rgba(0xae7214ff).into()),
|
||||
("number".into(), rgba(0xae7312ff).into()),
|
||||
("property".into(), rgba(0xba6135ff).into()),
|
||||
("predictive".into(), rgba(0x5f724cff).into()),
|
||||
(
|
||||
"function.special.definition".into(),
|
||||
rgba(0xa5980cff).into(),
|
||||
),
|
||||
("link_uri".into(), rgba(0x7d9726ff).into()),
|
||||
("variable.special".into(), rgba(0x5f9182ff).into()),
|
||||
("text.literal".into(), rgba(0xae7214ff).into()),
|
||||
("label".into(), rgba(0x36a165ff).into()),
|
||||
("primary".into(), rgba(0xe7e6dfff).into()),
|
||||
("variable".into(), rgba(0xe7e6dfff).into()),
|
||||
("embedded".into(), rgba(0xf4f3ecff).into()),
|
||||
("function.method".into(), rgba(0x35a166ff).into()),
|
||||
("comment.doc".into(), rgba(0x929181ff).into()),
|
||||
("string.special".into(), rgba(0x9d6b7bff).into()),
|
||||
("constructor".into(), rgba(0x36a165ff).into()),
|
||||
("punctuation.list_marker".into(), rgba(0xe7e6dfff).into()),
|
||||
("function".into(), rgba(0x35a166ff).into()),
|
||||
],
|
||||
},
|
||||
status_bar: rgba(0x424136ff).into(),
|
||||
title_bar: rgba(0x424136ff).into(),
|
||||
toolbar: rgba(0x22221bff).into(),
|
||||
tab_bar: rgba(0x2c2b23ff).into(),
|
||||
editor: rgba(0x22221bff).into(),
|
||||
editor_subheader: rgba(0x2c2b23ff).into(),
|
||||
editor_active_line: rgba(0x2c2b23ff).into(),
|
||||
terminal: rgba(0x22221bff).into(),
|
||||
image_fallback_background: rgba(0x424136ff).into(),
|
||||
git_created: rgba(0x7d9726ff).into(),
|
||||
git_modified: rgba(0x36a165ff).into(),
|
||||
git_deleted: rgba(0xba6136ff).into(),
|
||||
git_conflict: rgba(0xa5980fff).into(),
|
||||
git_ignored: rgba(0x7d7c6aff).into(),
|
||||
git_renamed: rgba(0xa5980fff).into(),
|
||||
players: [
|
||||
PlayerTheme {
|
||||
cursor: rgba(0x36a165ff).into(),
|
||||
selection: rgba(0x36a1653d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0x7d9726ff).into(),
|
||||
selection: rgba(0x7d97263d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0x9d6b7bff).into(),
|
||||
selection: rgba(0x9d6b7b3d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0xae7214ff).into(),
|
||||
selection: rgba(0xae72143d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0x5f9182ff).into(),
|
||||
selection: rgba(0x5f91823d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0x5a9d47ff).into(),
|
||||
selection: rgba(0x5a9d473d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0xba6136ff).into(),
|
||||
selection: rgba(0xba61363d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0xa5980fff).into(),
|
||||
selection: rgba(0xa5980f3d).into(),
|
||||
},
|
||||
],
|
||||
}
|
||||
}
|
||||
@@ -1,136 +0,0 @@
|
||||
use gpui2::rgba;
|
||||
|
||||
use crate::{PlayerTheme, SyntaxTheme, Theme, ThemeMetadata};
|
||||
|
||||
pub fn atelier_estuary_light() -> Theme {
|
||||
Theme {
|
||||
metadata: ThemeMetadata {
|
||||
name: "Atelier Estuary Light".into(),
|
||||
is_light: true,
|
||||
},
|
||||
transparent: rgba(0x00000000).into(),
|
||||
mac_os_traffic_light_red: rgba(0xec695eff).into(),
|
||||
mac_os_traffic_light_yellow: rgba(0xf4bf4eff).into(),
|
||||
mac_os_traffic_light_green: rgba(0x61c553ff).into(),
|
||||
border: rgba(0x969585ff).into(),
|
||||
border_variant: rgba(0x969585ff).into(),
|
||||
border_focused: rgba(0xbbddc6ff).into(),
|
||||
border_transparent: rgba(0x00000000).into(),
|
||||
elevated_surface: rgba(0xc5c4b9ff).into(),
|
||||
surface: rgba(0xebeae3ff).into(),
|
||||
background: rgba(0xc5c4b9ff).into(),
|
||||
filled_element: rgba(0xc5c4b9ff).into(),
|
||||
filled_element_hover: rgba(0xffffff1e).into(),
|
||||
filled_element_active: rgba(0xffffff28).into(),
|
||||
filled_element_selected: rgba(0xd9ecdfff).into(),
|
||||
filled_element_disabled: rgba(0x00000000).into(),
|
||||
ghost_element: rgba(0x00000000).into(),
|
||||
ghost_element_hover: rgba(0xffffff14).into(),
|
||||
ghost_element_active: rgba(0xffffff1e).into(),
|
||||
ghost_element_selected: rgba(0xd9ecdfff).into(),
|
||||
ghost_element_disabled: rgba(0x00000000).into(),
|
||||
text: rgba(0x22221bff).into(),
|
||||
text_muted: rgba(0x61604fff).into(),
|
||||
text_placeholder: rgba(0xba6336ff).into(),
|
||||
text_disabled: rgba(0x767463ff).into(),
|
||||
text_accent: rgba(0x37a165ff).into(),
|
||||
icon_muted: rgba(0x61604fff).into(),
|
||||
syntax: SyntaxTheme {
|
||||
highlights: vec![
|
||||
("string.special".into(), rgba(0x9d6b7bff).into()),
|
||||
("link_text".into(), rgba(0xae7214ff).into()),
|
||||
("emphasis.strong".into(), rgba(0x37a165ff).into()),
|
||||
("tag".into(), rgba(0x37a165ff).into()),
|
||||
("primary".into(), rgba(0x302f27ff).into()),
|
||||
("emphasis".into(), rgba(0x37a165ff).into()),
|
||||
("hint".into(), rgba(0x758961ff).into()),
|
||||
("title".into(), rgba(0x22221bff).into()),
|
||||
("string.regex".into(), rgba(0x5a9d47ff).into()),
|
||||
("attribute".into(), rgba(0x37a165ff).into()),
|
||||
("string.escape".into(), rgba(0x5f5e4eff).into()),
|
||||
("embedded".into(), rgba(0x22221bff).into()),
|
||||
("punctuation.bracket".into(), rgba(0x5f5e4eff).into()),
|
||||
(
|
||||
"function.special.definition".into(),
|
||||
rgba(0xa5980cff).into(),
|
||||
),
|
||||
("operator".into(), rgba(0x5f5e4eff).into()),
|
||||
("constant".into(), rgba(0x7c9728ff).into()),
|
||||
("comment.doc".into(), rgba(0x5f5e4eff).into()),
|
||||
("label".into(), rgba(0x37a165ff).into()),
|
||||
("variable".into(), rgba(0x302f27ff).into()),
|
||||
("punctuation".into(), rgba(0x302f27ff).into()),
|
||||
("punctuation.delimiter".into(), rgba(0x5f5e4eff).into()),
|
||||
("comment".into(), rgba(0x878573ff).into()),
|
||||
("punctuation.special".into(), rgba(0x9d6b7bff).into()),
|
||||
("string.special.symbol".into(), rgba(0x7c9725ff).into()),
|
||||
("enum".into(), rgba(0xae7214ff).into()),
|
||||
("variable.special".into(), rgba(0x5f9182ff).into()),
|
||||
("link_uri".into(), rgba(0x7c9728ff).into()),
|
||||
("punctuation.list_marker".into(), rgba(0x302f27ff).into()),
|
||||
("number".into(), rgba(0xae7312ff).into()),
|
||||
("function".into(), rgba(0x35a166ff).into()),
|
||||
("text.literal".into(), rgba(0xae7214ff).into()),
|
||||
("boolean".into(), rgba(0x7c9728ff).into()),
|
||||
("predictive".into(), rgba(0x879a72ff).into()),
|
||||
("type".into(), rgba(0xa5980cff).into()),
|
||||
("constructor".into(), rgba(0x37a165ff).into()),
|
||||
("property".into(), rgba(0xba6135ff).into()),
|
||||
("keyword".into(), rgba(0x5f9182ff).into()),
|
||||
("function.method".into(), rgba(0x35a166ff).into()),
|
||||
("variant".into(), rgba(0xa5980cff).into()),
|
||||
("string".into(), rgba(0x7c9725ff).into()),
|
||||
("preproc".into(), rgba(0x22221bff).into()),
|
||||
],
|
||||
},
|
||||
status_bar: rgba(0xc5c4b9ff).into(),
|
||||
title_bar: rgba(0xc5c4b9ff).into(),
|
||||
toolbar: rgba(0xf4f3ecff).into(),
|
||||
tab_bar: rgba(0xebeae3ff).into(),
|
||||
editor: rgba(0xf4f3ecff).into(),
|
||||
editor_subheader: rgba(0xebeae3ff).into(),
|
||||
editor_active_line: rgba(0xebeae3ff).into(),
|
||||
terminal: rgba(0xf4f3ecff).into(),
|
||||
image_fallback_background: rgba(0xc5c4b9ff).into(),
|
||||
git_created: rgba(0x7c9728ff).into(),
|
||||
git_modified: rgba(0x37a165ff).into(),
|
||||
git_deleted: rgba(0xba6336ff).into(),
|
||||
git_conflict: rgba(0xa5980fff).into(),
|
||||
git_ignored: rgba(0x767463ff).into(),
|
||||
git_renamed: rgba(0xa5980fff).into(),
|
||||
players: [
|
||||
PlayerTheme {
|
||||
cursor: rgba(0x37a165ff).into(),
|
||||
selection: rgba(0x37a1653d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0x7c9728ff).into(),
|
||||
selection: rgba(0x7c97283d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0x9d6b7bff).into(),
|
||||
selection: rgba(0x9d6b7b3d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0xae7214ff).into(),
|
||||
selection: rgba(0xae72143d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0x5f9182ff).into(),
|
||||
selection: rgba(0x5f91823d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0x5c9d49ff).into(),
|
||||
selection: rgba(0x5c9d493d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0xba6336ff).into(),
|
||||
selection: rgba(0xba63363d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0xa5980fff).into(),
|
||||
selection: rgba(0xa5980f3d).into(),
|
||||
},
|
||||
],
|
||||
}
|
||||
}
|
||||
@@ -1,136 +0,0 @@
|
||||
use gpui2::rgba;
|
||||
|
||||
use crate::{PlayerTheme, SyntaxTheme, Theme, ThemeMetadata};
|
||||
|
||||
pub fn atelier_forest_dark() -> Theme {
|
||||
Theme {
|
||||
metadata: ThemeMetadata {
|
||||
name: "Atelier Forest Dark".into(),
|
||||
is_light: false,
|
||||
},
|
||||
transparent: rgba(0x00000000).into(),
|
||||
mac_os_traffic_light_red: rgba(0xec695eff).into(),
|
||||
mac_os_traffic_light_yellow: rgba(0xf4bf4eff).into(),
|
||||
mac_os_traffic_light_green: rgba(0x61c553ff).into(),
|
||||
border: rgba(0x665f5cff).into(),
|
||||
border_variant: rgba(0x665f5cff).into(),
|
||||
border_focused: rgba(0x182d5bff).into(),
|
||||
border_transparent: rgba(0x00000000).into(),
|
||||
elevated_surface: rgba(0x443c39ff).into(),
|
||||
surface: rgba(0x27211eff).into(),
|
||||
background: rgba(0x443c39ff).into(),
|
||||
filled_element: rgba(0x443c39ff).into(),
|
||||
filled_element_hover: rgba(0xffffff1e).into(),
|
||||
filled_element_active: rgba(0xffffff28).into(),
|
||||
filled_element_selected: rgba(0x0f1c3dff).into(),
|
||||
filled_element_disabled: rgba(0x00000000).into(),
|
||||
ghost_element: rgba(0x00000000).into(),
|
||||
ghost_element_hover: rgba(0xffffff14).into(),
|
||||
ghost_element_active: rgba(0xffffff1e).into(),
|
||||
ghost_element_selected: rgba(0x0f1c3dff).into(),
|
||||
ghost_element_disabled: rgba(0x00000000).into(),
|
||||
text: rgba(0xf0eeedff).into(),
|
||||
text_muted: rgba(0xa79f9dff).into(),
|
||||
text_placeholder: rgba(0xf22c3fff).into(),
|
||||
text_disabled: rgba(0x8e8683ff).into(),
|
||||
text_accent: rgba(0x407ee6ff).into(),
|
||||
icon_muted: rgba(0xa79f9dff).into(),
|
||||
syntax: SyntaxTheme {
|
||||
highlights: vec![
|
||||
("link_uri".into(), rgba(0x7a9726ff).into()),
|
||||
("punctuation.list_marker".into(), rgba(0xe6e2e0ff).into()),
|
||||
("type".into(), rgba(0xc38417ff).into()),
|
||||
("punctuation.bracket".into(), rgba(0xa8a19fff).into()),
|
||||
("punctuation".into(), rgba(0xe6e2e0ff).into()),
|
||||
("preproc".into(), rgba(0xf0eeedff).into()),
|
||||
("punctuation.special".into(), rgba(0xc33ff3ff).into()),
|
||||
("variable.special".into(), rgba(0x6666eaff).into()),
|
||||
("tag".into(), rgba(0x407ee6ff).into()),
|
||||
("constructor".into(), rgba(0x407ee6ff).into()),
|
||||
("title".into(), rgba(0xf0eeedff).into()),
|
||||
("hint".into(), rgba(0xa77087ff).into()),
|
||||
("constant".into(), rgba(0x7a9726ff).into()),
|
||||
("number".into(), rgba(0xdf521fff).into()),
|
||||
("emphasis.strong".into(), rgba(0x407ee6ff).into()),
|
||||
("boolean".into(), rgba(0x7a9726ff).into()),
|
||||
("comment".into(), rgba(0x766e6bff).into()),
|
||||
("string.special".into(), rgba(0xc33ff3ff).into()),
|
||||
("text.literal".into(), rgba(0xdf5321ff).into()),
|
||||
("string.regex".into(), rgba(0x3c96b8ff).into()),
|
||||
("enum".into(), rgba(0xdf5321ff).into()),
|
||||
("operator".into(), rgba(0xa8a19fff).into()),
|
||||
("embedded".into(), rgba(0xf0eeedff).into()),
|
||||
("string.special.symbol".into(), rgba(0x7a9725ff).into()),
|
||||
("predictive".into(), rgba(0x8f5b70ff).into()),
|
||||
("comment.doc".into(), rgba(0xa8a19fff).into()),
|
||||
("variant".into(), rgba(0xc38417ff).into()),
|
||||
("label".into(), rgba(0x407ee6ff).into()),
|
||||
("property".into(), rgba(0xf22c40ff).into()),
|
||||
("keyword".into(), rgba(0x6666eaff).into()),
|
||||
("function".into(), rgba(0x3f7ee7ff).into()),
|
||||
("string.escape".into(), rgba(0xa8a19fff).into()),
|
||||
("string".into(), rgba(0x7a9725ff).into()),
|
||||
("primary".into(), rgba(0xe6e2e0ff).into()),
|
||||
("function.method".into(), rgba(0x3f7ee7ff).into()),
|
||||
("link_text".into(), rgba(0xdf5321ff).into()),
|
||||
("attribute".into(), rgba(0x407ee6ff).into()),
|
||||
("emphasis".into(), rgba(0x407ee6ff).into()),
|
||||
(
|
||||
"function.special.definition".into(),
|
||||
rgba(0xc38417ff).into(),
|
||||
),
|
||||
("variable".into(), rgba(0xe6e2e0ff).into()),
|
||||
("punctuation.delimiter".into(), rgba(0xa8a19fff).into()),
|
||||
],
|
||||
},
|
||||
status_bar: rgba(0x443c39ff).into(),
|
||||
title_bar: rgba(0x443c39ff).into(),
|
||||
toolbar: rgba(0x1b1918ff).into(),
|
||||
tab_bar: rgba(0x27211eff).into(),
|
||||
editor: rgba(0x1b1918ff).into(),
|
||||
editor_subheader: rgba(0x27211eff).into(),
|
||||
editor_active_line: rgba(0x27211eff).into(),
|
||||
terminal: rgba(0x1b1918ff).into(),
|
||||
image_fallback_background: rgba(0x443c39ff).into(),
|
||||
git_created: rgba(0x7a9726ff).into(),
|
||||
git_modified: rgba(0x407ee6ff).into(),
|
||||
git_deleted: rgba(0xf22c3fff).into(),
|
||||
git_conflict: rgba(0xc38418ff).into(),
|
||||
git_ignored: rgba(0x8e8683ff).into(),
|
||||
git_renamed: rgba(0xc38418ff).into(),
|
||||
players: [
|
||||
PlayerTheme {
|
||||
cursor: rgba(0x407ee6ff).into(),
|
||||
selection: rgba(0x407ee63d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0x7a9726ff).into(),
|
||||
selection: rgba(0x7a97263d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0xc340f2ff).into(),
|
||||
selection: rgba(0xc340f23d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0xdf5321ff).into(),
|
||||
selection: rgba(0xdf53213d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0x6565e9ff).into(),
|
||||
selection: rgba(0x6565e93d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0x3d97b8ff).into(),
|
||||
selection: rgba(0x3d97b83d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0xf22c3fff).into(),
|
||||
selection: rgba(0xf22c3f3d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0xc38418ff).into(),
|
||||
selection: rgba(0xc384183d).into(),
|
||||
},
|
||||
],
|
||||
}
|
||||
}
|
||||
@@ -1,136 +0,0 @@
|
||||
use gpui2::rgba;
|
||||
|
||||
use crate::{PlayerTheme, SyntaxTheme, Theme, ThemeMetadata};
|
||||
|
||||
pub fn atelier_forest_light() -> Theme {
|
||||
Theme {
|
||||
metadata: ThemeMetadata {
|
||||
name: "Atelier Forest Light".into(),
|
||||
is_light: true,
|
||||
},
|
||||
transparent: rgba(0x00000000).into(),
|
||||
mac_os_traffic_light_red: rgba(0xec695eff).into(),
|
||||
mac_os_traffic_light_yellow: rgba(0xf4bf4eff).into(),
|
||||
mac_os_traffic_light_green: rgba(0x61c553ff).into(),
|
||||
border: rgba(0xaaa3a1ff).into(),
|
||||
border_variant: rgba(0xaaa3a1ff).into(),
|
||||
border_focused: rgba(0xc6cef7ff).into(),
|
||||
border_transparent: rgba(0x00000000).into(),
|
||||
elevated_surface: rgba(0xccc7c5ff).into(),
|
||||
surface: rgba(0xe9e6e4ff).into(),
|
||||
background: rgba(0xccc7c5ff).into(),
|
||||
filled_element: rgba(0xccc7c5ff).into(),
|
||||
filled_element_hover: rgba(0xffffff1e).into(),
|
||||
filled_element_active: rgba(0xffffff28).into(),
|
||||
filled_element_selected: rgba(0xdfe3fbff).into(),
|
||||
filled_element_disabled: rgba(0x00000000).into(),
|
||||
ghost_element: rgba(0x00000000).into(),
|
||||
ghost_element_hover: rgba(0xffffff14).into(),
|
||||
ghost_element_active: rgba(0xffffff1e).into(),
|
||||
ghost_element_selected: rgba(0xdfe3fbff).into(),
|
||||
ghost_element_disabled: rgba(0x00000000).into(),
|
||||
text: rgba(0x1b1918ff).into(),
|
||||
text_muted: rgba(0x6a6360ff).into(),
|
||||
text_placeholder: rgba(0xf22e40ff).into(),
|
||||
text_disabled: rgba(0x837b78ff).into(),
|
||||
text_accent: rgba(0x407ee6ff).into(),
|
||||
icon_muted: rgba(0x6a6360ff).into(),
|
||||
syntax: SyntaxTheme {
|
||||
highlights: vec![
|
||||
("punctuation.special".into(), rgba(0xc33ff3ff).into()),
|
||||
("text.literal".into(), rgba(0xdf5421ff).into()),
|
||||
("string.escape".into(), rgba(0x68615eff).into()),
|
||||
("string.regex".into(), rgba(0x3c96b8ff).into()),
|
||||
("number".into(), rgba(0xdf521fff).into()),
|
||||
("preproc".into(), rgba(0x1b1918ff).into()),
|
||||
("keyword".into(), rgba(0x6666eaff).into()),
|
||||
("variable.special".into(), rgba(0x6666eaff).into()),
|
||||
("punctuation.delimiter".into(), rgba(0x68615eff).into()),
|
||||
("emphasis.strong".into(), rgba(0x407ee6ff).into()),
|
||||
("boolean".into(), rgba(0x7a9728ff).into()),
|
||||
("variant".into(), rgba(0xc38417ff).into()),
|
||||
("predictive".into(), rgba(0xbe899eff).into()),
|
||||
("tag".into(), rgba(0x407ee6ff).into()),
|
||||
("property".into(), rgba(0xf22c40ff).into()),
|
||||
("enum".into(), rgba(0xdf5421ff).into()),
|
||||
("attribute".into(), rgba(0x407ee6ff).into()),
|
||||
("function.method".into(), rgba(0x3f7ee7ff).into()),
|
||||
("function".into(), rgba(0x3f7ee7ff).into()),
|
||||
("emphasis".into(), rgba(0x407ee6ff).into()),
|
||||
("primary".into(), rgba(0x2c2421ff).into()),
|
||||
("variable".into(), rgba(0x2c2421ff).into()),
|
||||
("constant".into(), rgba(0x7a9728ff).into()),
|
||||
("title".into(), rgba(0x1b1918ff).into()),
|
||||
("comment.doc".into(), rgba(0x68615eff).into()),
|
||||
("constructor".into(), rgba(0x407ee6ff).into()),
|
||||
("type".into(), rgba(0xc38417ff).into()),
|
||||
("punctuation.list_marker".into(), rgba(0x2c2421ff).into()),
|
||||
("punctuation".into(), rgba(0x2c2421ff).into()),
|
||||
("string".into(), rgba(0x7a9725ff).into()),
|
||||
("label".into(), rgba(0x407ee6ff).into()),
|
||||
("string.special".into(), rgba(0xc33ff3ff).into()),
|
||||
("embedded".into(), rgba(0x1b1918ff).into()),
|
||||
("link_text".into(), rgba(0xdf5421ff).into()),
|
||||
("punctuation.bracket".into(), rgba(0x68615eff).into()),
|
||||
("comment".into(), rgba(0x9c9491ff).into()),
|
||||
(
|
||||
"function.special.definition".into(),
|
||||
rgba(0xc38417ff).into(),
|
||||
),
|
||||
("link_uri".into(), rgba(0x7a9728ff).into()),
|
||||
("operator".into(), rgba(0x68615eff).into()),
|
||||
("hint".into(), rgba(0xa67287ff).into()),
|
||||
("string.special.symbol".into(), rgba(0x7a9725ff).into()),
|
||||
],
|
||||
},
|
||||
status_bar: rgba(0xccc7c5ff).into(),
|
||||
title_bar: rgba(0xccc7c5ff).into(),
|
||||
toolbar: rgba(0xf0eeedff).into(),
|
||||
tab_bar: rgba(0xe9e6e4ff).into(),
|
||||
editor: rgba(0xf0eeedff).into(),
|
||||
editor_subheader: rgba(0xe9e6e4ff).into(),
|
||||
editor_active_line: rgba(0xe9e6e4ff).into(),
|
||||
terminal: rgba(0xf0eeedff).into(),
|
||||
image_fallback_background: rgba(0xccc7c5ff).into(),
|
||||
git_created: rgba(0x7a9728ff).into(),
|
||||
git_modified: rgba(0x407ee6ff).into(),
|
||||
git_deleted: rgba(0xf22e40ff).into(),
|
||||
git_conflict: rgba(0xc38419ff).into(),
|
||||
git_ignored: rgba(0x837b78ff).into(),
|
||||
git_renamed: rgba(0xc38419ff).into(),
|
||||
players: [
|
||||
PlayerTheme {
|
||||
cursor: rgba(0x407ee6ff).into(),
|
||||
selection: rgba(0x407ee63d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0x7a9728ff).into(),
|
||||
selection: rgba(0x7a97283d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0xc340f2ff).into(),
|
||||
selection: rgba(0xc340f23d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0xdf5421ff).into(),
|
||||
selection: rgba(0xdf54213d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0x6765e9ff).into(),
|
||||
selection: rgba(0x6765e93d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0x3e96b8ff).into(),
|
||||
selection: rgba(0x3e96b83d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0xf22e40ff).into(),
|
||||
selection: rgba(0xf22e403d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0xc38419ff).into(),
|
||||
selection: rgba(0xc384193d).into(),
|
||||
},
|
||||
],
|
||||
}
|
||||
}
|
||||
@@ -1,136 +0,0 @@
|
||||
use gpui2::rgba;
|
||||
|
||||
use crate::{PlayerTheme, SyntaxTheme, Theme, ThemeMetadata};
|
||||
|
||||
pub fn atelier_heath_dark() -> Theme {
|
||||
Theme {
|
||||
metadata: ThemeMetadata {
|
||||
name: "Atelier Heath Dark".into(),
|
||||
is_light: false,
|
||||
},
|
||||
transparent: rgba(0x00000000).into(),
|
||||
mac_os_traffic_light_red: rgba(0xec695eff).into(),
|
||||
mac_os_traffic_light_yellow: rgba(0xf4bf4eff).into(),
|
||||
mac_os_traffic_light_green: rgba(0x61c553ff).into(),
|
||||
border: rgba(0x675b67ff).into(),
|
||||
border_variant: rgba(0x675b67ff).into(),
|
||||
border_focused: rgba(0x192961ff).into(),
|
||||
border_transparent: rgba(0x00000000).into(),
|
||||
elevated_surface: rgba(0x433a43ff).into(),
|
||||
surface: rgba(0x252025ff).into(),
|
||||
background: rgba(0x433a43ff).into(),
|
||||
filled_element: rgba(0x433a43ff).into(),
|
||||
filled_element_hover: rgba(0xffffff1e).into(),
|
||||
filled_element_active: rgba(0xffffff28).into(),
|
||||
filled_element_selected: rgba(0x0d1a43ff).into(),
|
||||
filled_element_disabled: rgba(0x00000000).into(),
|
||||
ghost_element: rgba(0x00000000).into(),
|
||||
ghost_element_hover: rgba(0xffffff14).into(),
|
||||
ghost_element_active: rgba(0xffffff1e).into(),
|
||||
ghost_element_selected: rgba(0x0d1a43ff).into(),
|
||||
ghost_element_disabled: rgba(0x00000000).into(),
|
||||
text: rgba(0xf7f3f7ff).into(),
|
||||
text_muted: rgba(0xa899a8ff).into(),
|
||||
text_placeholder: rgba(0xca3f2bff).into(),
|
||||
text_disabled: rgba(0x908190ff).into(),
|
||||
text_accent: rgba(0x5169ebff).into(),
|
||||
icon_muted: rgba(0xa899a8ff).into(),
|
||||
syntax: SyntaxTheme {
|
||||
highlights: vec![
|
||||
("preproc".into(), rgba(0xf7f3f7ff).into()),
|
||||
("number".into(), rgba(0xa65825ff).into()),
|
||||
("boolean".into(), rgba(0x918b3aff).into()),
|
||||
("embedded".into(), rgba(0xf7f3f7ff).into()),
|
||||
("variable.special".into(), rgba(0x7b58bfff).into()),
|
||||
("operator".into(), rgba(0xab9babff).into()),
|
||||
("punctuation.delimiter".into(), rgba(0xab9babff).into()),
|
||||
("primary".into(), rgba(0xd8cad8ff).into()),
|
||||
("punctuation.bracket".into(), rgba(0xab9babff).into()),
|
||||
("comment.doc".into(), rgba(0xab9babff).into()),
|
||||
("variant".into(), rgba(0xbb8a34ff).into()),
|
||||
("attribute".into(), rgba(0x5169ebff).into()),
|
||||
("property".into(), rgba(0xca3f2aff).into()),
|
||||
("keyword".into(), rgba(0x7b58bfff).into()),
|
||||
("hint".into(), rgba(0x8d70a8ff).into()),
|
||||
("string.special.symbol".into(), rgba(0x918b3aff).into()),
|
||||
("punctuation.special".into(), rgba(0xcc32ccff).into()),
|
||||
("link_uri".into(), rgba(0x918b3aff).into()),
|
||||
("link_text".into(), rgba(0xa65827ff).into()),
|
||||
("enum".into(), rgba(0xa65827ff).into()),
|
||||
("function".into(), rgba(0x506aecff).into()),
|
||||
(
|
||||
"function.special.definition".into(),
|
||||
rgba(0xbb8a34ff).into(),
|
||||
),
|
||||
("constant".into(), rgba(0x918b3aff).into()),
|
||||
("title".into(), rgba(0xf7f3f7ff).into()),
|
||||
("string.regex".into(), rgba(0x149393ff).into()),
|
||||
("variable".into(), rgba(0xd8cad8ff).into()),
|
||||
("comment".into(), rgba(0x776977ff).into()),
|
||||
("predictive".into(), rgba(0x75588fff).into()),
|
||||
("function.method".into(), rgba(0x506aecff).into()),
|
||||
("type".into(), rgba(0xbb8a34ff).into()),
|
||||
("punctuation".into(), rgba(0xd8cad8ff).into()),
|
||||
("emphasis".into(), rgba(0x5169ebff).into()),
|
||||
("emphasis.strong".into(), rgba(0x5169ebff).into()),
|
||||
("tag".into(), rgba(0x5169ebff).into()),
|
||||
("text.literal".into(), rgba(0xa65827ff).into()),
|
||||
("string".into(), rgba(0x918b3aff).into()),
|
||||
("string.escape".into(), rgba(0xab9babff).into()),
|
||||
("constructor".into(), rgba(0x5169ebff).into()),
|
||||
("label".into(), rgba(0x5169ebff).into()),
|
||||
("punctuation.list_marker".into(), rgba(0xd8cad8ff).into()),
|
||||
("string.special".into(), rgba(0xcc32ccff).into()),
|
||||
],
|
||||
},
|
||||
status_bar: rgba(0x433a43ff).into(),
|
||||
title_bar: rgba(0x433a43ff).into(),
|
||||
toolbar: rgba(0x1b181bff).into(),
|
||||
tab_bar: rgba(0x252025ff).into(),
|
||||
editor: rgba(0x1b181bff).into(),
|
||||
editor_subheader: rgba(0x252025ff).into(),
|
||||
editor_active_line: rgba(0x252025ff).into(),
|
||||
terminal: rgba(0x1b181bff).into(),
|
||||
image_fallback_background: rgba(0x433a43ff).into(),
|
||||
git_created: rgba(0x918b3aff).into(),
|
||||
git_modified: rgba(0x5169ebff).into(),
|
||||
git_deleted: rgba(0xca3f2bff).into(),
|
||||
git_conflict: rgba(0xbb8a35ff).into(),
|
||||
git_ignored: rgba(0x908190ff).into(),
|
||||
git_renamed: rgba(0xbb8a35ff).into(),
|
||||
players: [
|
||||
PlayerTheme {
|
||||
cursor: rgba(0x5169ebff).into(),
|
||||
selection: rgba(0x5169eb3d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0x918b3aff).into(),
|
||||
selection: rgba(0x918b3a3d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0xcc34ccff).into(),
|
||||
selection: rgba(0xcc34cc3d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0xa65827ff).into(),
|
||||
selection: rgba(0xa658273d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0x7b58bfff).into(),
|
||||
selection: rgba(0x7b58bf3d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0x189393ff).into(),
|
||||
selection: rgba(0x1893933d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0xca3f2bff).into(),
|
||||
selection: rgba(0xca3f2b3d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0xbb8a35ff).into(),
|
||||
selection: rgba(0xbb8a353d).into(),
|
||||
},
|
||||
],
|
||||
}
|
||||
}
|
||||
@@ -1,136 +0,0 @@
|
||||
use gpui2::rgba;
|
||||
|
||||
use crate::{PlayerTheme, SyntaxTheme, Theme, ThemeMetadata};
|
||||
|
||||
pub fn atelier_heath_light() -> Theme {
|
||||
Theme {
|
||||
metadata: ThemeMetadata {
|
||||
name: "Atelier Heath Light".into(),
|
||||
is_light: true,
|
||||
},
|
||||
transparent: rgba(0x00000000).into(),
|
||||
mac_os_traffic_light_red: rgba(0xec695eff).into(),
|
||||
mac_os_traffic_light_yellow: rgba(0xf4bf4eff).into(),
|
||||
mac_os_traffic_light_green: rgba(0x61c553ff).into(),
|
||||
border: rgba(0xad9dadff).into(),
|
||||
border_variant: rgba(0xad9dadff).into(),
|
||||
border_focused: rgba(0xcac7faff).into(),
|
||||
border_transparent: rgba(0x00000000).into(),
|
||||
elevated_surface: rgba(0xc6b8c6ff).into(),
|
||||
surface: rgba(0xe0d5e0ff).into(),
|
||||
background: rgba(0xc6b8c6ff).into(),
|
||||
filled_element: rgba(0xc6b8c6ff).into(),
|
||||
filled_element_hover: rgba(0xffffff1e).into(),
|
||||
filled_element_active: rgba(0xffffff28).into(),
|
||||
filled_element_selected: rgba(0xe2dffcff).into(),
|
||||
filled_element_disabled: rgba(0x00000000).into(),
|
||||
ghost_element: rgba(0x00000000).into(),
|
||||
ghost_element_hover: rgba(0xffffff14).into(),
|
||||
ghost_element_active: rgba(0xffffff1e).into(),
|
||||
ghost_element_selected: rgba(0xe2dffcff).into(),
|
||||
ghost_element_disabled: rgba(0x00000000).into(),
|
||||
text: rgba(0x1b181bff).into(),
|
||||
text_muted: rgba(0x6b5e6bff).into(),
|
||||
text_placeholder: rgba(0xca402bff).into(),
|
||||
text_disabled: rgba(0x857785ff).into(),
|
||||
text_accent: rgba(0x5169ebff).into(),
|
||||
icon_muted: rgba(0x6b5e6bff).into(),
|
||||
syntax: SyntaxTheme {
|
||||
highlights: vec![
|
||||
("enum".into(), rgba(0xa65927ff).into()),
|
||||
("string.escape".into(), rgba(0x695d69ff).into()),
|
||||
("link_uri".into(), rgba(0x918b3bff).into()),
|
||||
("function.method".into(), rgba(0x506aecff).into()),
|
||||
("comment.doc".into(), rgba(0x695d69ff).into()),
|
||||
("property".into(), rgba(0xca3f2aff).into()),
|
||||
("string.special".into(), rgba(0xcc32ccff).into()),
|
||||
("tag".into(), rgba(0x5169ebff).into()),
|
||||
("embedded".into(), rgba(0x1b181bff).into()),
|
||||
("primary".into(), rgba(0x292329ff).into()),
|
||||
("punctuation".into(), rgba(0x292329ff).into()),
|
||||
("punctuation.special".into(), rgba(0xcc32ccff).into()),
|
||||
("type".into(), rgba(0xbb8a34ff).into()),
|
||||
("number".into(), rgba(0xa65825ff).into()),
|
||||
("function".into(), rgba(0x506aecff).into()),
|
||||
("preproc".into(), rgba(0x1b181bff).into()),
|
||||
("punctuation.bracket".into(), rgba(0x695d69ff).into()),
|
||||
("punctuation.delimiter".into(), rgba(0x695d69ff).into()),
|
||||
("variable".into(), rgba(0x292329ff).into()),
|
||||
(
|
||||
"function.special.definition".into(),
|
||||
rgba(0xbb8a34ff).into(),
|
||||
),
|
||||
("label".into(), rgba(0x5169ebff).into()),
|
||||
("constructor".into(), rgba(0x5169ebff).into()),
|
||||
("emphasis.strong".into(), rgba(0x5169ebff).into()),
|
||||
("constant".into(), rgba(0x918b3bff).into()),
|
||||
("keyword".into(), rgba(0x7b58bfff).into()),
|
||||
("variable.special".into(), rgba(0x7b58bfff).into()),
|
||||
("variant".into(), rgba(0xbb8a34ff).into()),
|
||||
("title".into(), rgba(0x1b181bff).into()),
|
||||
("attribute".into(), rgba(0x5169ebff).into()),
|
||||
("comment".into(), rgba(0x9e8f9eff).into()),
|
||||
("string.special.symbol".into(), rgba(0x918b3aff).into()),
|
||||
("predictive".into(), rgba(0xa487bfff).into()),
|
||||
("link_text".into(), rgba(0xa65927ff).into()),
|
||||
("punctuation.list_marker".into(), rgba(0x292329ff).into()),
|
||||
("boolean".into(), rgba(0x918b3bff).into()),
|
||||
("text.literal".into(), rgba(0xa65927ff).into()),
|
||||
("emphasis".into(), rgba(0x5169ebff).into()),
|
||||
("string.regex".into(), rgba(0x149393ff).into()),
|
||||
("hint".into(), rgba(0x8c70a6ff).into()),
|
||||
("string".into(), rgba(0x918b3aff).into()),
|
||||
("operator".into(), rgba(0x695d69ff).into()),
|
||||
],
|
||||
},
|
||||
status_bar: rgba(0xc6b8c6ff).into(),
|
||||
title_bar: rgba(0xc6b8c6ff).into(),
|
||||
toolbar: rgba(0xf7f3f7ff).into(),
|
||||
tab_bar: rgba(0xe0d5e0ff).into(),
|
||||
editor: rgba(0xf7f3f7ff).into(),
|
||||
editor_subheader: rgba(0xe0d5e0ff).into(),
|
||||
editor_active_line: rgba(0xe0d5e0ff).into(),
|
||||
terminal: rgba(0xf7f3f7ff).into(),
|
||||
image_fallback_background: rgba(0xc6b8c6ff).into(),
|
||||
git_created: rgba(0x918b3bff).into(),
|
||||
git_modified: rgba(0x5169ebff).into(),
|
||||
git_deleted: rgba(0xca402bff).into(),
|
||||
git_conflict: rgba(0xbb8a35ff).into(),
|
||||
git_ignored: rgba(0x857785ff).into(),
|
||||
git_renamed: rgba(0xbb8a35ff).into(),
|
||||
players: [
|
||||
PlayerTheme {
|
||||
cursor: rgba(0x5169ebff).into(),
|
||||
selection: rgba(0x5169eb3d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0x918b3bff).into(),
|
||||
selection: rgba(0x918b3b3d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0xcc34ccff).into(),
|
||||
selection: rgba(0xcc34cc3d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0xa65927ff).into(),
|
||||
selection: rgba(0xa659273d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0x7a5ac0ff).into(),
|
||||
selection: rgba(0x7a5ac03d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0x189393ff).into(),
|
||||
selection: rgba(0x1893933d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0xca402bff).into(),
|
||||
selection: rgba(0xca402b3d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0xbb8a35ff).into(),
|
||||
selection: rgba(0xbb8a353d).into(),
|
||||
},
|
||||
],
|
||||
}
|
||||
}
|
||||
@@ -1,136 +0,0 @@
|
||||
use gpui2::rgba;
|
||||
|
||||
use crate::{PlayerTheme, SyntaxTheme, Theme, ThemeMetadata};
|
||||
|
||||
pub fn atelier_lakeside_dark() -> Theme {
|
||||
Theme {
|
||||
metadata: ThemeMetadata {
|
||||
name: "Atelier Lakeside Dark".into(),
|
||||
is_light: false,
|
||||
},
|
||||
transparent: rgba(0x00000000).into(),
|
||||
mac_os_traffic_light_red: rgba(0xec695eff).into(),
|
||||
mac_os_traffic_light_yellow: rgba(0xf4bf4eff).into(),
|
||||
mac_os_traffic_light_green: rgba(0x61c553ff).into(),
|
||||
border: rgba(0x4f6a78ff).into(),
|
||||
border_variant: rgba(0x4f6a78ff).into(),
|
||||
border_focused: rgba(0x1a2f3cff).into(),
|
||||
border_transparent: rgba(0x00000000).into(),
|
||||
elevated_surface: rgba(0x33444dff).into(),
|
||||
surface: rgba(0x1c2529ff).into(),
|
||||
background: rgba(0x33444dff).into(),
|
||||
filled_element: rgba(0x33444dff).into(),
|
||||
filled_element_hover: rgba(0xffffff1e).into(),
|
||||
filled_element_active: rgba(0xffffff28).into(),
|
||||
filled_element_selected: rgba(0x121c24ff).into(),
|
||||
filled_element_disabled: rgba(0x00000000).into(),
|
||||
ghost_element: rgba(0x00000000).into(),
|
||||
ghost_element_hover: rgba(0xffffff14).into(),
|
||||
ghost_element_active: rgba(0xffffff1e).into(),
|
||||
ghost_element_selected: rgba(0x121c24ff).into(),
|
||||
ghost_element_disabled: rgba(0x00000000).into(),
|
||||
text: rgba(0xebf8ffff).into(),
|
||||
text_muted: rgba(0x7c9fb3ff).into(),
|
||||
text_placeholder: rgba(0xd22e72ff).into(),
|
||||
text_disabled: rgba(0x688c9dff).into(),
|
||||
text_accent: rgba(0x267eadff).into(),
|
||||
icon_muted: rgba(0x7c9fb3ff).into(),
|
||||
syntax: SyntaxTheme {
|
||||
highlights: vec![
|
||||
("punctuation.bracket".into(), rgba(0x7ea2b4ff).into()),
|
||||
("punctuation.special".into(), rgba(0xb72cd2ff).into()),
|
||||
("property".into(), rgba(0xd22c72ff).into()),
|
||||
("function.method".into(), rgba(0x247eadff).into()),
|
||||
("comment".into(), rgba(0x5a7b8cff).into()),
|
||||
("constructor".into(), rgba(0x267eadff).into()),
|
||||
("boolean".into(), rgba(0x558c3aff).into()),
|
||||
("hint".into(), rgba(0x52809aff).into()),
|
||||
("label".into(), rgba(0x267eadff).into()),
|
||||
("string.special".into(), rgba(0xb72cd2ff).into()),
|
||||
("title".into(), rgba(0xebf8ffff).into()),
|
||||
("punctuation.list_marker".into(), rgba(0xc1e4f6ff).into()),
|
||||
("emphasis.strong".into(), rgba(0x267eadff).into()),
|
||||
("enum".into(), rgba(0x935b25ff).into()),
|
||||
("type".into(), rgba(0x8a8a0eff).into()),
|
||||
("tag".into(), rgba(0x267eadff).into()),
|
||||
("punctuation.delimiter".into(), rgba(0x7ea2b4ff).into()),
|
||||
("primary".into(), rgba(0xc1e4f6ff).into()),
|
||||
("link_text".into(), rgba(0x935b25ff).into()),
|
||||
("variable".into(), rgba(0xc1e4f6ff).into()),
|
||||
("variable.special".into(), rgba(0x6a6ab7ff).into()),
|
||||
("string.special.symbol".into(), rgba(0x558c3aff).into()),
|
||||
("link_uri".into(), rgba(0x558c3aff).into()),
|
||||
("function".into(), rgba(0x247eadff).into()),
|
||||
("predictive".into(), rgba(0x426f88ff).into()),
|
||||
("punctuation".into(), rgba(0xc1e4f6ff).into()),
|
||||
("string.escape".into(), rgba(0x7ea2b4ff).into()),
|
||||
("keyword".into(), rgba(0x6a6ab7ff).into()),
|
||||
("attribute".into(), rgba(0x267eadff).into()),
|
||||
("string.regex".into(), rgba(0x2c8f6eff).into()),
|
||||
("embedded".into(), rgba(0xebf8ffff).into()),
|
||||
("emphasis".into(), rgba(0x267eadff).into()),
|
||||
("string".into(), rgba(0x558c3aff).into()),
|
||||
("operator".into(), rgba(0x7ea2b4ff).into()),
|
||||
("text.literal".into(), rgba(0x935b25ff).into()),
|
||||
("constant".into(), rgba(0x558c3aff).into()),
|
||||
("comment.doc".into(), rgba(0x7ea2b4ff).into()),
|
||||
("number".into(), rgba(0x935c24ff).into()),
|
||||
("preproc".into(), rgba(0xebf8ffff).into()),
|
||||
(
|
||||
"function.special.definition".into(),
|
||||
rgba(0x8a8a0eff).into(),
|
||||
),
|
||||
("variant".into(), rgba(0x8a8a0eff).into()),
|
||||
],
|
||||
},
|
||||
status_bar: rgba(0x33444dff).into(),
|
||||
title_bar: rgba(0x33444dff).into(),
|
||||
toolbar: rgba(0x161b1dff).into(),
|
||||
tab_bar: rgba(0x1c2529ff).into(),
|
||||
editor: rgba(0x161b1dff).into(),
|
||||
editor_subheader: rgba(0x1c2529ff).into(),
|
||||
editor_active_line: rgba(0x1c2529ff).into(),
|
||||
terminal: rgba(0x161b1dff).into(),
|
||||
image_fallback_background: rgba(0x33444dff).into(),
|
||||
git_created: rgba(0x558c3aff).into(),
|
||||
git_modified: rgba(0x267eadff).into(),
|
||||
git_deleted: rgba(0xd22e72ff).into(),
|
||||
git_conflict: rgba(0x8a8a10ff).into(),
|
||||
git_ignored: rgba(0x688c9dff).into(),
|
||||
git_renamed: rgba(0x8a8a10ff).into(),
|
||||
players: [
|
||||
PlayerTheme {
|
||||
cursor: rgba(0x267eadff).into(),
|
||||
selection: rgba(0x267ead3d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0x558c3aff).into(),
|
||||
selection: rgba(0x558c3a3d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0xb72ed2ff).into(),
|
||||
selection: rgba(0xb72ed23d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0x935b25ff).into(),
|
||||
selection: rgba(0x935b253d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0x6a6ab7ff).into(),
|
||||
selection: rgba(0x6a6ab73d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0x2d8f6fff).into(),
|
||||
selection: rgba(0x2d8f6f3d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0xd22e72ff).into(),
|
||||
selection: rgba(0xd22e723d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0x8a8a10ff).into(),
|
||||
selection: rgba(0x8a8a103d).into(),
|
||||
},
|
||||
],
|
||||
}
|
||||
}
|
||||
@@ -1,136 +0,0 @@
|
||||
use gpui2::rgba;
|
||||
|
||||
use crate::{PlayerTheme, SyntaxTheme, Theme, ThemeMetadata};
|
||||
|
||||
pub fn atelier_lakeside_light() -> Theme {
|
||||
Theme {
|
||||
metadata: ThemeMetadata {
|
||||
name: "Atelier Lakeside Light".into(),
|
||||
is_light: true,
|
||||
},
|
||||
transparent: rgba(0x00000000).into(),
|
||||
mac_os_traffic_light_red: rgba(0xec695eff).into(),
|
||||
mac_os_traffic_light_yellow: rgba(0xf4bf4eff).into(),
|
||||
mac_os_traffic_light_green: rgba(0x61c553ff).into(),
|
||||
border: rgba(0x80a4b6ff).into(),
|
||||
border_variant: rgba(0x80a4b6ff).into(),
|
||||
border_focused: rgba(0xb9cee0ff).into(),
|
||||
border_transparent: rgba(0x00000000).into(),
|
||||
elevated_surface: rgba(0xa6cadcff).into(),
|
||||
surface: rgba(0xcdeaf9ff).into(),
|
||||
background: rgba(0xa6cadcff).into(),
|
||||
filled_element: rgba(0xa6cadcff).into(),
|
||||
filled_element_hover: rgba(0xffffff1e).into(),
|
||||
filled_element_active: rgba(0xffffff28).into(),
|
||||
filled_element_selected: rgba(0xd8e4eeff).into(),
|
||||
filled_element_disabled: rgba(0x00000000).into(),
|
||||
ghost_element: rgba(0x00000000).into(),
|
||||
ghost_element_hover: rgba(0xffffff14).into(),
|
||||
ghost_element_active: rgba(0xffffff1e).into(),
|
||||
ghost_element_selected: rgba(0xd8e4eeff).into(),
|
||||
ghost_element_disabled: rgba(0x00000000).into(),
|
||||
text: rgba(0x161b1dff).into(),
|
||||
text_muted: rgba(0x526f7dff).into(),
|
||||
text_placeholder: rgba(0xd22e71ff).into(),
|
||||
text_disabled: rgba(0x628496ff).into(),
|
||||
text_accent: rgba(0x267eadff).into(),
|
||||
icon_muted: rgba(0x526f7dff).into(),
|
||||
syntax: SyntaxTheme {
|
||||
highlights: vec![
|
||||
("emphasis".into(), rgba(0x267eadff).into()),
|
||||
("number".into(), rgba(0x935c24ff).into()),
|
||||
("embedded".into(), rgba(0x161b1dff).into()),
|
||||
("link_text".into(), rgba(0x935c25ff).into()),
|
||||
("string".into(), rgba(0x558c3aff).into()),
|
||||
("constructor".into(), rgba(0x267eadff).into()),
|
||||
("punctuation.list_marker".into(), rgba(0x1f292eff).into()),
|
||||
("string.special".into(), rgba(0xb72cd2ff).into()),
|
||||
("title".into(), rgba(0x161b1dff).into()),
|
||||
("variant".into(), rgba(0x8a8a0eff).into()),
|
||||
("tag".into(), rgba(0x267eadff).into()),
|
||||
("attribute".into(), rgba(0x267eadff).into()),
|
||||
("keyword".into(), rgba(0x6a6ab7ff).into()),
|
||||
("enum".into(), rgba(0x935c25ff).into()),
|
||||
("function".into(), rgba(0x247eadff).into()),
|
||||
("string.escape".into(), rgba(0x516d7bff).into()),
|
||||
("operator".into(), rgba(0x516d7bff).into()),
|
||||
("function.method".into(), rgba(0x247eadff).into()),
|
||||
(
|
||||
"function.special.definition".into(),
|
||||
rgba(0x8a8a0eff).into(),
|
||||
),
|
||||
("punctuation.delimiter".into(), rgba(0x516d7bff).into()),
|
||||
("comment".into(), rgba(0x7094a7ff).into()),
|
||||
("primary".into(), rgba(0x1f292eff).into()),
|
||||
("punctuation.bracket".into(), rgba(0x516d7bff).into()),
|
||||
("variable".into(), rgba(0x1f292eff).into()),
|
||||
("emphasis.strong".into(), rgba(0x267eadff).into()),
|
||||
("predictive".into(), rgba(0x6a97b2ff).into()),
|
||||
("punctuation.special".into(), rgba(0xb72cd2ff).into()),
|
||||
("hint".into(), rgba(0x5a87a0ff).into()),
|
||||
("text.literal".into(), rgba(0x935c25ff).into()),
|
||||
("string.special.symbol".into(), rgba(0x558c3aff).into()),
|
||||
("comment.doc".into(), rgba(0x516d7bff).into()),
|
||||
("constant".into(), rgba(0x568c3bff).into()),
|
||||
("boolean".into(), rgba(0x568c3bff).into()),
|
||||
("preproc".into(), rgba(0x161b1dff).into()),
|
||||
("variable.special".into(), rgba(0x6a6ab7ff).into()),
|
||||
("link_uri".into(), rgba(0x568c3bff).into()),
|
||||
("string.regex".into(), rgba(0x2c8f6eff).into()),
|
||||
("punctuation".into(), rgba(0x1f292eff).into()),
|
||||
("property".into(), rgba(0xd22c72ff).into()),
|
||||
("label".into(), rgba(0x267eadff).into()),
|
||||
("type".into(), rgba(0x8a8a0eff).into()),
|
||||
],
|
||||
},
|
||||
status_bar: rgba(0xa6cadcff).into(),
|
||||
title_bar: rgba(0xa6cadcff).into(),
|
||||
toolbar: rgba(0xebf8ffff).into(),
|
||||
tab_bar: rgba(0xcdeaf9ff).into(),
|
||||
editor: rgba(0xebf8ffff).into(),
|
||||
editor_subheader: rgba(0xcdeaf9ff).into(),
|
||||
editor_active_line: rgba(0xcdeaf9ff).into(),
|
||||
terminal: rgba(0xebf8ffff).into(),
|
||||
image_fallback_background: rgba(0xa6cadcff).into(),
|
||||
git_created: rgba(0x568c3bff).into(),
|
||||
git_modified: rgba(0x267eadff).into(),
|
||||
git_deleted: rgba(0xd22e71ff).into(),
|
||||
git_conflict: rgba(0x8a8a10ff).into(),
|
||||
git_ignored: rgba(0x628496ff).into(),
|
||||
git_renamed: rgba(0x8a8a10ff).into(),
|
||||
players: [
|
||||
PlayerTheme {
|
||||
cursor: rgba(0x267eadff).into(),
|
||||
selection: rgba(0x267ead3d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0x568c3bff).into(),
|
||||
selection: rgba(0x568c3b3d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0xb72ed2ff).into(),
|
||||
selection: rgba(0xb72ed23d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0x935c25ff).into(),
|
||||
selection: rgba(0x935c253d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0x6c6ab7ff).into(),
|
||||
selection: rgba(0x6c6ab73d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0x2e8f6eff).into(),
|
||||
selection: rgba(0x2e8f6e3d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0xd22e71ff).into(),
|
||||
selection: rgba(0xd22e713d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0x8a8a10ff).into(),
|
||||
selection: rgba(0x8a8a103d).into(),
|
||||
},
|
||||
],
|
||||
}
|
||||
}
|
||||
@@ -1,136 +0,0 @@
|
||||
use gpui2::rgba;
|
||||
|
||||
use crate::{PlayerTheme, SyntaxTheme, Theme, ThemeMetadata};
|
||||
|
||||
pub fn atelier_plateau_dark() -> Theme {
|
||||
Theme {
|
||||
metadata: ThemeMetadata {
|
||||
name: "Atelier Plateau Dark".into(),
|
||||
is_light: false,
|
||||
},
|
||||
transparent: rgba(0x00000000).into(),
|
||||
mac_os_traffic_light_red: rgba(0xec695eff).into(),
|
||||
mac_os_traffic_light_yellow: rgba(0xf4bf4eff).into(),
|
||||
mac_os_traffic_light_green: rgba(0x61c553ff).into(),
|
||||
border: rgba(0x564e4eff).into(),
|
||||
border_variant: rgba(0x564e4eff).into(),
|
||||
border_focused: rgba(0x2c2b45ff).into(),
|
||||
border_transparent: rgba(0x00000000).into(),
|
||||
elevated_surface: rgba(0x3b3535ff).into(),
|
||||
surface: rgba(0x252020ff).into(),
|
||||
background: rgba(0x3b3535ff).into(),
|
||||
filled_element: rgba(0x3b3535ff).into(),
|
||||
filled_element_hover: rgba(0xffffff1e).into(),
|
||||
filled_element_active: rgba(0xffffff28).into(),
|
||||
filled_element_selected: rgba(0x1c1b29ff).into(),
|
||||
filled_element_disabled: rgba(0x00000000).into(),
|
||||
ghost_element: rgba(0x00000000).into(),
|
||||
ghost_element_hover: rgba(0xffffff14).into(),
|
||||
ghost_element_active: rgba(0xffffff1e).into(),
|
||||
ghost_element_selected: rgba(0x1c1b29ff).into(),
|
||||
ghost_element_disabled: rgba(0x00000000).into(),
|
||||
text: rgba(0xf4ececff).into(),
|
||||
text_muted: rgba(0x898383ff).into(),
|
||||
text_placeholder: rgba(0xca4848ff).into(),
|
||||
text_disabled: rgba(0x756e6eff).into(),
|
||||
text_accent: rgba(0x7272caff).into(),
|
||||
icon_muted: rgba(0x898383ff).into(),
|
||||
syntax: SyntaxTheme {
|
||||
highlights: vec![
|
||||
("variant".into(), rgba(0xa06d3aff).into()),
|
||||
("label".into(), rgba(0x7272caff).into()),
|
||||
("punctuation.delimiter".into(), rgba(0x8a8585ff).into()),
|
||||
("string.regex".into(), rgba(0x5485b6ff).into()),
|
||||
("variable.special".into(), rgba(0x8464c4ff).into()),
|
||||
("string".into(), rgba(0x4b8b8bff).into()),
|
||||
("property".into(), rgba(0xca4848ff).into()),
|
||||
("hint".into(), rgba(0x8a647aff).into()),
|
||||
("comment.doc".into(), rgba(0x8a8585ff).into()),
|
||||
("attribute".into(), rgba(0x7272caff).into()),
|
||||
("tag".into(), rgba(0x7272caff).into()),
|
||||
("constructor".into(), rgba(0x7272caff).into()),
|
||||
("boolean".into(), rgba(0x4b8b8bff).into()),
|
||||
("preproc".into(), rgba(0xf4ececff).into()),
|
||||
("constant".into(), rgba(0x4b8b8bff).into()),
|
||||
("punctuation.special".into(), rgba(0xbd5187ff).into()),
|
||||
("function.method".into(), rgba(0x7272caff).into()),
|
||||
("comment".into(), rgba(0x655d5dff).into()),
|
||||
("variable".into(), rgba(0xe7dfdfff).into()),
|
||||
("primary".into(), rgba(0xe7dfdfff).into()),
|
||||
("title".into(), rgba(0xf4ececff).into()),
|
||||
("emphasis".into(), rgba(0x7272caff).into()),
|
||||
("emphasis.strong".into(), rgba(0x7272caff).into()),
|
||||
("function".into(), rgba(0x7272caff).into()),
|
||||
("type".into(), rgba(0xa06d3aff).into()),
|
||||
("operator".into(), rgba(0x8a8585ff).into()),
|
||||
("embedded".into(), rgba(0xf4ececff).into()),
|
||||
("predictive".into(), rgba(0x795369ff).into()),
|
||||
("punctuation".into(), rgba(0xe7dfdfff).into()),
|
||||
("link_text".into(), rgba(0xb4593bff).into()),
|
||||
("enum".into(), rgba(0xb4593bff).into()),
|
||||
("string.special".into(), rgba(0xbd5187ff).into()),
|
||||
("text.literal".into(), rgba(0xb4593bff).into()),
|
||||
("string.escape".into(), rgba(0x8a8585ff).into()),
|
||||
(
|
||||
"function.special.definition".into(),
|
||||
rgba(0xa06d3aff).into(),
|
||||
),
|
||||
("keyword".into(), rgba(0x8464c4ff).into()),
|
||||
("link_uri".into(), rgba(0x4b8b8bff).into()),
|
||||
("number".into(), rgba(0xb4593bff).into()),
|
||||
("punctuation.bracket".into(), rgba(0x8a8585ff).into()),
|
||||
("string.special.symbol".into(), rgba(0x4b8b8bff).into()),
|
||||
("punctuation.list_marker".into(), rgba(0xe7dfdfff).into()),
|
||||
],
|
||||
},
|
||||
status_bar: rgba(0x3b3535ff).into(),
|
||||
title_bar: rgba(0x3b3535ff).into(),
|
||||
toolbar: rgba(0x1b1818ff).into(),
|
||||
tab_bar: rgba(0x252020ff).into(),
|
||||
editor: rgba(0x1b1818ff).into(),
|
||||
editor_subheader: rgba(0x252020ff).into(),
|
||||
editor_active_line: rgba(0x252020ff).into(),
|
||||
terminal: rgba(0x1b1818ff).into(),
|
||||
image_fallback_background: rgba(0x3b3535ff).into(),
|
||||
git_created: rgba(0x4b8b8bff).into(),
|
||||
git_modified: rgba(0x7272caff).into(),
|
||||
git_deleted: rgba(0xca4848ff).into(),
|
||||
git_conflict: rgba(0xa06d3aff).into(),
|
||||
git_ignored: rgba(0x756e6eff).into(),
|
||||
git_renamed: rgba(0xa06d3aff).into(),
|
||||
players: [
|
||||
PlayerTheme {
|
||||
cursor: rgba(0x7272caff).into(),
|
||||
selection: rgba(0x7272ca3d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0x4b8b8bff).into(),
|
||||
selection: rgba(0x4b8b8b3d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0xbd5187ff).into(),
|
||||
selection: rgba(0xbd51873d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0xb4593bff).into(),
|
||||
selection: rgba(0xb4593b3d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0x8464c4ff).into(),
|
||||
selection: rgba(0x8464c43d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0x5485b6ff).into(),
|
||||
selection: rgba(0x5485b63d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0xca4848ff).into(),
|
||||
selection: rgba(0xca48483d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0xa06d3aff).into(),
|
||||
selection: rgba(0xa06d3a3d).into(),
|
||||
},
|
||||
],
|
||||
}
|
||||
}
|
||||
@@ -1,136 +0,0 @@
|
||||
use gpui2::rgba;
|
||||
|
||||
use crate::{PlayerTheme, SyntaxTheme, Theme, ThemeMetadata};
|
||||
|
||||
pub fn atelier_plateau_light() -> Theme {
|
||||
Theme {
|
||||
metadata: ThemeMetadata {
|
||||
name: "Atelier Plateau Light".into(),
|
||||
is_light: true,
|
||||
},
|
||||
transparent: rgba(0x00000000).into(),
|
||||
mac_os_traffic_light_red: rgba(0xec695eff).into(),
|
||||
mac_os_traffic_light_yellow: rgba(0xf4bf4eff).into(),
|
||||
mac_os_traffic_light_green: rgba(0x61c553ff).into(),
|
||||
border: rgba(0x8e8989ff).into(),
|
||||
border_variant: rgba(0x8e8989ff).into(),
|
||||
border_focused: rgba(0xcecaecff).into(),
|
||||
border_transparent: rgba(0x00000000).into(),
|
||||
elevated_surface: rgba(0xc1bbbbff).into(),
|
||||
surface: rgba(0xebe3e3ff).into(),
|
||||
background: rgba(0xc1bbbbff).into(),
|
||||
filled_element: rgba(0xc1bbbbff).into(),
|
||||
filled_element_hover: rgba(0xffffff1e).into(),
|
||||
filled_element_active: rgba(0xffffff28).into(),
|
||||
filled_element_selected: rgba(0xe4e1f5ff).into(),
|
||||
filled_element_disabled: rgba(0x00000000).into(),
|
||||
ghost_element: rgba(0x00000000).into(),
|
||||
ghost_element_hover: rgba(0xffffff14).into(),
|
||||
ghost_element_active: rgba(0xffffff1e).into(),
|
||||
ghost_element_selected: rgba(0xe4e1f5ff).into(),
|
||||
ghost_element_disabled: rgba(0x00000000).into(),
|
||||
text: rgba(0x1b1818ff).into(),
|
||||
text_muted: rgba(0x5a5252ff).into(),
|
||||
text_placeholder: rgba(0xca4a4aff).into(),
|
||||
text_disabled: rgba(0x6e6666ff).into(),
|
||||
text_accent: rgba(0x7272caff).into(),
|
||||
icon_muted: rgba(0x5a5252ff).into(),
|
||||
syntax: SyntaxTheme {
|
||||
highlights: vec![
|
||||
("text.literal".into(), rgba(0xb45a3cff).into()),
|
||||
("punctuation.special".into(), rgba(0xbd5187ff).into()),
|
||||
("variant".into(), rgba(0xa06d3aff).into()),
|
||||
("punctuation".into(), rgba(0x292424ff).into()),
|
||||
("string.escape".into(), rgba(0x585050ff).into()),
|
||||
("emphasis".into(), rgba(0x7272caff).into()),
|
||||
("title".into(), rgba(0x1b1818ff).into()),
|
||||
("constructor".into(), rgba(0x7272caff).into()),
|
||||
("variable".into(), rgba(0x292424ff).into()),
|
||||
("predictive".into(), rgba(0xa27a91ff).into()),
|
||||
("label".into(), rgba(0x7272caff).into()),
|
||||
("function.method".into(), rgba(0x7272caff).into()),
|
||||
("link_uri".into(), rgba(0x4c8b8bff).into()),
|
||||
("punctuation.delimiter".into(), rgba(0x585050ff).into()),
|
||||
("link_text".into(), rgba(0xb45a3cff).into()),
|
||||
("hint".into(), rgba(0x91697fff).into()),
|
||||
("emphasis.strong".into(), rgba(0x7272caff).into()),
|
||||
("attribute".into(), rgba(0x7272caff).into()),
|
||||
("boolean".into(), rgba(0x4c8b8bff).into()),
|
||||
("string.special.symbol".into(), rgba(0x4b8b8bff).into()),
|
||||
("string".into(), rgba(0x4b8b8bff).into()),
|
||||
("type".into(), rgba(0xa06d3aff).into()),
|
||||
("string.regex".into(), rgba(0x5485b6ff).into()),
|
||||
("comment.doc".into(), rgba(0x585050ff).into()),
|
||||
("string.special".into(), rgba(0xbd5187ff).into()),
|
||||
("property".into(), rgba(0xca4848ff).into()),
|
||||
("preproc".into(), rgba(0x1b1818ff).into()),
|
||||
("embedded".into(), rgba(0x1b1818ff).into()),
|
||||
("comment".into(), rgba(0x7e7777ff).into()),
|
||||
("primary".into(), rgba(0x292424ff).into()),
|
||||
("number".into(), rgba(0xb4593bff).into()),
|
||||
("function".into(), rgba(0x7272caff).into()),
|
||||
("punctuation.bracket".into(), rgba(0x585050ff).into()),
|
||||
("tag".into(), rgba(0x7272caff).into()),
|
||||
("punctuation.list_marker".into(), rgba(0x292424ff).into()),
|
||||
(
|
||||
"function.special.definition".into(),
|
||||
rgba(0xa06d3aff).into(),
|
||||
),
|
||||
("enum".into(), rgba(0xb45a3cff).into()),
|
||||
("keyword".into(), rgba(0x8464c4ff).into()),
|
||||
("operator".into(), rgba(0x585050ff).into()),
|
||||
("variable.special".into(), rgba(0x8464c4ff).into()),
|
||||
("constant".into(), rgba(0x4c8b8bff).into()),
|
||||
],
|
||||
},
|
||||
status_bar: rgba(0xc1bbbbff).into(),
|
||||
title_bar: rgba(0xc1bbbbff).into(),
|
||||
toolbar: rgba(0xf4ececff).into(),
|
||||
tab_bar: rgba(0xebe3e3ff).into(),
|
||||
editor: rgba(0xf4ececff).into(),
|
||||
editor_subheader: rgba(0xebe3e3ff).into(),
|
||||
editor_active_line: rgba(0xebe3e3ff).into(),
|
||||
terminal: rgba(0xf4ececff).into(),
|
||||
image_fallback_background: rgba(0xc1bbbbff).into(),
|
||||
git_created: rgba(0x4c8b8bff).into(),
|
||||
git_modified: rgba(0x7272caff).into(),
|
||||
git_deleted: rgba(0xca4a4aff).into(),
|
||||
git_conflict: rgba(0xa06e3bff).into(),
|
||||
git_ignored: rgba(0x6e6666ff).into(),
|
||||
git_renamed: rgba(0xa06e3bff).into(),
|
||||
players: [
|
||||
PlayerTheme {
|
||||
cursor: rgba(0x7272caff).into(),
|
||||
selection: rgba(0x7272ca3d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0x4c8b8bff).into(),
|
||||
selection: rgba(0x4c8b8b3d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0xbd5186ff).into(),
|
||||
selection: rgba(0xbd51863d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0xb45a3cff).into(),
|
||||
selection: rgba(0xb45a3c3d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0x8464c4ff).into(),
|
||||
selection: rgba(0x8464c43d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0x5485b5ff).into(),
|
||||
selection: rgba(0x5485b53d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0xca4a4aff).into(),
|
||||
selection: rgba(0xca4a4a3d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0xa06e3bff).into(),
|
||||
selection: rgba(0xa06e3b3d).into(),
|
||||
},
|
||||
],
|
||||
}
|
||||
}
|
||||
@@ -1,136 +0,0 @@
|
||||
use gpui2::rgba;
|
||||
|
||||
use crate::{PlayerTheme, SyntaxTheme, Theme, ThemeMetadata};
|
||||
|
||||
pub fn atelier_savanna_dark() -> Theme {
|
||||
Theme {
|
||||
metadata: ThemeMetadata {
|
||||
name: "Atelier Savanna Dark".into(),
|
||||
is_light: false,
|
||||
},
|
||||
transparent: rgba(0x00000000).into(),
|
||||
mac_os_traffic_light_red: rgba(0xec695eff).into(),
|
||||
mac_os_traffic_light_yellow: rgba(0xf4bf4eff).into(),
|
||||
mac_os_traffic_light_green: rgba(0x61c553ff).into(),
|
||||
border: rgba(0x505e55ff).into(),
|
||||
border_variant: rgba(0x505e55ff).into(),
|
||||
border_focused: rgba(0x1f3233ff).into(),
|
||||
border_transparent: rgba(0x00000000).into(),
|
||||
elevated_surface: rgba(0x353f39ff).into(),
|
||||
surface: rgba(0x1f2621ff).into(),
|
||||
background: rgba(0x353f39ff).into(),
|
||||
filled_element: rgba(0x353f39ff).into(),
|
||||
filled_element_hover: rgba(0xffffff1e).into(),
|
||||
filled_element_active: rgba(0xffffff28).into(),
|
||||
filled_element_selected: rgba(0x151e20ff).into(),
|
||||
filled_element_disabled: rgba(0x00000000).into(),
|
||||
ghost_element: rgba(0x00000000).into(),
|
||||
ghost_element_hover: rgba(0xffffff14).into(),
|
||||
ghost_element_active: rgba(0xffffff1e).into(),
|
||||
ghost_element_selected: rgba(0x151e20ff).into(),
|
||||
ghost_element_disabled: rgba(0x00000000).into(),
|
||||
text: rgba(0xecf4eeff).into(),
|
||||
text_muted: rgba(0x859188ff).into(),
|
||||
text_placeholder: rgba(0xb16038ff).into(),
|
||||
text_disabled: rgba(0x6f7e74ff).into(),
|
||||
text_accent: rgba(0x468b8fff).into(),
|
||||
icon_muted: rgba(0x859188ff).into(),
|
||||
syntax: SyntaxTheme {
|
||||
highlights: vec![
|
||||
("function.method".into(), rgba(0x468b8fff).into()),
|
||||
("title".into(), rgba(0xecf4eeff).into()),
|
||||
("label".into(), rgba(0x468b8fff).into()),
|
||||
("text.literal".into(), rgba(0x9f703bff).into()),
|
||||
("boolean".into(), rgba(0x479962ff).into()),
|
||||
("punctuation.list_marker".into(), rgba(0xdfe7e2ff).into()),
|
||||
("string.escape".into(), rgba(0x87928aff).into()),
|
||||
("string.special".into(), rgba(0x857368ff).into()),
|
||||
("punctuation.delimiter".into(), rgba(0x87928aff).into()),
|
||||
("tag".into(), rgba(0x468b8fff).into()),
|
||||
("property".into(), rgba(0xb16038ff).into()),
|
||||
("preproc".into(), rgba(0xecf4eeff).into()),
|
||||
("primary".into(), rgba(0xdfe7e2ff).into()),
|
||||
("link_uri".into(), rgba(0x479962ff).into()),
|
||||
("comment".into(), rgba(0x5f6d64ff).into()),
|
||||
("type".into(), rgba(0xa07d3aff).into()),
|
||||
("hint".into(), rgba(0x607e76ff).into()),
|
||||
("punctuation".into(), rgba(0xdfe7e2ff).into()),
|
||||
("string.special.symbol".into(), rgba(0x479962ff).into()),
|
||||
("emphasis.strong".into(), rgba(0x468b8fff).into()),
|
||||
("keyword".into(), rgba(0x55859bff).into()),
|
||||
("comment.doc".into(), rgba(0x87928aff).into()),
|
||||
("punctuation.bracket".into(), rgba(0x87928aff).into()),
|
||||
("constant".into(), rgba(0x479962ff).into()),
|
||||
("link_text".into(), rgba(0x9f703bff).into()),
|
||||
("number".into(), rgba(0x9f703bff).into()),
|
||||
("function".into(), rgba(0x468b8fff).into()),
|
||||
("variable".into(), rgba(0xdfe7e2ff).into()),
|
||||
("emphasis".into(), rgba(0x468b8fff).into()),
|
||||
("punctuation.special".into(), rgba(0x857368ff).into()),
|
||||
("constructor".into(), rgba(0x468b8fff).into()),
|
||||
("variable.special".into(), rgba(0x55859bff).into()),
|
||||
("operator".into(), rgba(0x87928aff).into()),
|
||||
("enum".into(), rgba(0x9f703bff).into()),
|
||||
("string.regex".into(), rgba(0x1b9aa0ff).into()),
|
||||
("attribute".into(), rgba(0x468b8fff).into()),
|
||||
("predictive".into(), rgba(0x506d66ff).into()),
|
||||
("string".into(), rgba(0x479962ff).into()),
|
||||
("embedded".into(), rgba(0xecf4eeff).into()),
|
||||
("variant".into(), rgba(0xa07d3aff).into()),
|
||||
(
|
||||
"function.special.definition".into(),
|
||||
rgba(0xa07d3aff).into(),
|
||||
),
|
||||
],
|
||||
},
|
||||
status_bar: rgba(0x353f39ff).into(),
|
||||
title_bar: rgba(0x353f39ff).into(),
|
||||
toolbar: rgba(0x171c19ff).into(),
|
||||
tab_bar: rgba(0x1f2621ff).into(),
|
||||
editor: rgba(0x171c19ff).into(),
|
||||
editor_subheader: rgba(0x1f2621ff).into(),
|
||||
editor_active_line: rgba(0x1f2621ff).into(),
|
||||
terminal: rgba(0x171c19ff).into(),
|
||||
image_fallback_background: rgba(0x353f39ff).into(),
|
||||
git_created: rgba(0x479962ff).into(),
|
||||
git_modified: rgba(0x468b8fff).into(),
|
||||
git_deleted: rgba(0xb16038ff).into(),
|
||||
git_conflict: rgba(0xa07d3aff).into(),
|
||||
git_ignored: rgba(0x6f7e74ff).into(),
|
||||
git_renamed: rgba(0xa07d3aff).into(),
|
||||
players: [
|
||||
PlayerTheme {
|
||||
cursor: rgba(0x468b8fff).into(),
|
||||
selection: rgba(0x468b8f3d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0x479962ff).into(),
|
||||
selection: rgba(0x4799623d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0x857368ff).into(),
|
||||
selection: rgba(0x8573683d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0x9f703bff).into(),
|
||||
selection: rgba(0x9f703b3d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0x55859bff).into(),
|
||||
selection: rgba(0x55859b3d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0x1d9aa0ff).into(),
|
||||
selection: rgba(0x1d9aa03d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0xb16038ff).into(),
|
||||
selection: rgba(0xb160383d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0xa07d3aff).into(),
|
||||
selection: rgba(0xa07d3a3d).into(),
|
||||
},
|
||||
],
|
||||
}
|
||||
}
|
||||
@@ -1,136 +0,0 @@
|
||||
use gpui2::rgba;
|
||||
|
||||
use crate::{PlayerTheme, SyntaxTheme, Theme, ThemeMetadata};
|
||||
|
||||
pub fn atelier_savanna_light() -> Theme {
|
||||
Theme {
|
||||
metadata: ThemeMetadata {
|
||||
name: "Atelier Savanna Light".into(),
|
||||
is_light: true,
|
||||
},
|
||||
transparent: rgba(0x00000000).into(),
|
||||
mac_os_traffic_light_red: rgba(0xec695eff).into(),
|
||||
mac_os_traffic_light_yellow: rgba(0xf4bf4eff).into(),
|
||||
mac_os_traffic_light_green: rgba(0x61c553ff).into(),
|
||||
border: rgba(0x8b968eff).into(),
|
||||
border_variant: rgba(0x8b968eff).into(),
|
||||
border_focused: rgba(0xbed4d6ff).into(),
|
||||
border_transparent: rgba(0x00000000).into(),
|
||||
elevated_surface: rgba(0xbcc5bfff).into(),
|
||||
surface: rgba(0xe3ebe6ff).into(),
|
||||
background: rgba(0xbcc5bfff).into(),
|
||||
filled_element: rgba(0xbcc5bfff).into(),
|
||||
filled_element_hover: rgba(0xffffff1e).into(),
|
||||
filled_element_active: rgba(0xffffff28).into(),
|
||||
filled_element_selected: rgba(0xdae7e8ff).into(),
|
||||
filled_element_disabled: rgba(0x00000000).into(),
|
||||
ghost_element: rgba(0x00000000).into(),
|
||||
ghost_element_hover: rgba(0xffffff14).into(),
|
||||
ghost_element_active: rgba(0xffffff1e).into(),
|
||||
ghost_element_selected: rgba(0xdae7e8ff).into(),
|
||||
ghost_element_disabled: rgba(0x00000000).into(),
|
||||
text: rgba(0x171c19ff).into(),
|
||||
text_muted: rgba(0x546259ff).into(),
|
||||
text_placeholder: rgba(0xb16139ff).into(),
|
||||
text_disabled: rgba(0x68766dff).into(),
|
||||
text_accent: rgba(0x488b90ff).into(),
|
||||
icon_muted: rgba(0x546259ff).into(),
|
||||
syntax: SyntaxTheme {
|
||||
highlights: vec![
|
||||
("text.literal".into(), rgba(0x9f713cff).into()),
|
||||
("string".into(), rgba(0x479962ff).into()),
|
||||
("punctuation.special".into(), rgba(0x857368ff).into()),
|
||||
("type".into(), rgba(0xa07d3aff).into()),
|
||||
("enum".into(), rgba(0x9f713cff).into()),
|
||||
("title".into(), rgba(0x171c19ff).into()),
|
||||
("comment".into(), rgba(0x77877cff).into()),
|
||||
("predictive".into(), rgba(0x75958bff).into()),
|
||||
("punctuation.list_marker".into(), rgba(0x232a25ff).into()),
|
||||
("string.special.symbol".into(), rgba(0x479962ff).into()),
|
||||
("constructor".into(), rgba(0x488b90ff).into()),
|
||||
("variable".into(), rgba(0x232a25ff).into()),
|
||||
("label".into(), rgba(0x488b90ff).into()),
|
||||
("attribute".into(), rgba(0x488b90ff).into()),
|
||||
("constant".into(), rgba(0x499963ff).into()),
|
||||
("function".into(), rgba(0x468b8fff).into()),
|
||||
("variable.special".into(), rgba(0x55859bff).into()),
|
||||
("keyword".into(), rgba(0x55859bff).into()),
|
||||
("number".into(), rgba(0x9f703bff).into()),
|
||||
("boolean".into(), rgba(0x499963ff).into()),
|
||||
("embedded".into(), rgba(0x171c19ff).into()),
|
||||
("string.special".into(), rgba(0x857368ff).into()),
|
||||
("emphasis.strong".into(), rgba(0x488b90ff).into()),
|
||||
("string.regex".into(), rgba(0x1b9aa0ff).into()),
|
||||
("hint".into(), rgba(0x66847cff).into()),
|
||||
("preproc".into(), rgba(0x171c19ff).into()),
|
||||
("link_uri".into(), rgba(0x499963ff).into()),
|
||||
("variant".into(), rgba(0xa07d3aff).into()),
|
||||
("function.method".into(), rgba(0x468b8fff).into()),
|
||||
("punctuation.bracket".into(), rgba(0x526057ff).into()),
|
||||
("punctuation.delimiter".into(), rgba(0x526057ff).into()),
|
||||
("punctuation".into(), rgba(0x232a25ff).into()),
|
||||
("primary".into(), rgba(0x232a25ff).into()),
|
||||
("string.escape".into(), rgba(0x526057ff).into()),
|
||||
("property".into(), rgba(0xb16038ff).into()),
|
||||
("operator".into(), rgba(0x526057ff).into()),
|
||||
("comment.doc".into(), rgba(0x526057ff).into()),
|
||||
(
|
||||
"function.special.definition".into(),
|
||||
rgba(0xa07d3aff).into(),
|
||||
),
|
||||
("link_text".into(), rgba(0x9f713cff).into()),
|
||||
("tag".into(), rgba(0x488b90ff).into()),
|
||||
("emphasis".into(), rgba(0x488b90ff).into()),
|
||||
],
|
||||
},
|
||||
status_bar: rgba(0xbcc5bfff).into(),
|
||||
title_bar: rgba(0xbcc5bfff).into(),
|
||||
toolbar: rgba(0xecf4eeff).into(),
|
||||
tab_bar: rgba(0xe3ebe6ff).into(),
|
||||
editor: rgba(0xecf4eeff).into(),
|
||||
editor_subheader: rgba(0xe3ebe6ff).into(),
|
||||
editor_active_line: rgba(0xe3ebe6ff).into(),
|
||||
terminal: rgba(0xecf4eeff).into(),
|
||||
image_fallback_background: rgba(0xbcc5bfff).into(),
|
||||
git_created: rgba(0x499963ff).into(),
|
||||
git_modified: rgba(0x488b90ff).into(),
|
||||
git_deleted: rgba(0xb16139ff).into(),
|
||||
git_conflict: rgba(0xa07d3bff).into(),
|
||||
git_ignored: rgba(0x68766dff).into(),
|
||||
git_renamed: rgba(0xa07d3bff).into(),
|
||||
players: [
|
||||
PlayerTheme {
|
||||
cursor: rgba(0x488b90ff).into(),
|
||||
selection: rgba(0x488b903d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0x499963ff).into(),
|
||||
selection: rgba(0x4999633d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0x857368ff).into(),
|
||||
selection: rgba(0x8573683d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0x9f713cff).into(),
|
||||
selection: rgba(0x9f713c3d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0x55859bff).into(),
|
||||
selection: rgba(0x55859b3d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0x1e9aa0ff).into(),
|
||||
selection: rgba(0x1e9aa03d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0xb16139ff).into(),
|
||||
selection: rgba(0xb161393d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0xa07d3bff).into(),
|
||||
selection: rgba(0xa07d3b3d).into(),
|
||||
},
|
||||
],
|
||||
}
|
||||
}
|
||||
@@ -1,136 +0,0 @@
|
||||
use gpui2::rgba;
|
||||
|
||||
use crate::{PlayerTheme, SyntaxTheme, Theme, ThemeMetadata};
|
||||
|
||||
pub fn atelier_seaside_dark() -> Theme {
|
||||
Theme {
|
||||
metadata: ThemeMetadata {
|
||||
name: "Atelier Seaside Dark".into(),
|
||||
is_light: false,
|
||||
},
|
||||
transparent: rgba(0x00000000).into(),
|
||||
mac_os_traffic_light_red: rgba(0xec695eff).into(),
|
||||
mac_os_traffic_light_yellow: rgba(0xf4bf4eff).into(),
|
||||
mac_os_traffic_light_green: rgba(0x61c553ff).into(),
|
||||
border: rgba(0x5c6c5cff).into(),
|
||||
border_variant: rgba(0x5c6c5cff).into(),
|
||||
border_focused: rgba(0x102667ff).into(),
|
||||
border_transparent: rgba(0x00000000).into(),
|
||||
elevated_surface: rgba(0x3b453bff).into(),
|
||||
surface: rgba(0x1f231fff).into(),
|
||||
background: rgba(0x3b453bff).into(),
|
||||
filled_element: rgba(0x3b453bff).into(),
|
||||
filled_element_hover: rgba(0xffffff1e).into(),
|
||||
filled_element_active: rgba(0xffffff28).into(),
|
||||
filled_element_selected: rgba(0x051949ff).into(),
|
||||
filled_element_disabled: rgba(0x00000000).into(),
|
||||
ghost_element: rgba(0x00000000).into(),
|
||||
ghost_element_hover: rgba(0xffffff14).into(),
|
||||
ghost_element_active: rgba(0xffffff1e).into(),
|
||||
ghost_element_selected: rgba(0x051949ff).into(),
|
||||
ghost_element_disabled: rgba(0x00000000).into(),
|
||||
text: rgba(0xf3faf3ff).into(),
|
||||
text_muted: rgba(0x8ba48bff).into(),
|
||||
text_placeholder: rgba(0xe61c3bff).into(),
|
||||
text_disabled: rgba(0x778f77ff).into(),
|
||||
text_accent: rgba(0x3e62f4ff).into(),
|
||||
icon_muted: rgba(0x8ba48bff).into(),
|
||||
syntax: SyntaxTheme {
|
||||
highlights: vec![
|
||||
("comment".into(), rgba(0x687d68ff).into()),
|
||||
("predictive".into(), rgba(0x00788bff).into()),
|
||||
("string.special".into(), rgba(0xe618c3ff).into()),
|
||||
("string.regex".into(), rgba(0x1899b3ff).into()),
|
||||
("boolean".into(), rgba(0x2aa329ff).into()),
|
||||
("string".into(), rgba(0x28a328ff).into()),
|
||||
("operator".into(), rgba(0x8ca68cff).into()),
|
||||
("primary".into(), rgba(0xcfe8cfff).into()),
|
||||
("number".into(), rgba(0x87711cff).into()),
|
||||
("punctuation.special".into(), rgba(0xe618c3ff).into()),
|
||||
("link_text".into(), rgba(0x87711dff).into()),
|
||||
("title".into(), rgba(0xf3faf3ff).into()),
|
||||
("comment.doc".into(), rgba(0x8ca68cff).into()),
|
||||
("label".into(), rgba(0x3e62f4ff).into()),
|
||||
("preproc".into(), rgba(0xf3faf3ff).into()),
|
||||
("punctuation.bracket".into(), rgba(0x8ca68cff).into()),
|
||||
("punctuation.delimiter".into(), rgba(0x8ca68cff).into()),
|
||||
("function.method".into(), rgba(0x3d62f5ff).into()),
|
||||
("tag".into(), rgba(0x3e62f4ff).into()),
|
||||
("embedded".into(), rgba(0xf3faf3ff).into()),
|
||||
("text.literal".into(), rgba(0x87711dff).into()),
|
||||
("punctuation".into(), rgba(0xcfe8cfff).into()),
|
||||
("string.special.symbol".into(), rgba(0x28a328ff).into()),
|
||||
("link_uri".into(), rgba(0x2aa329ff).into()),
|
||||
("keyword".into(), rgba(0xac2aeeff).into()),
|
||||
("function".into(), rgba(0x3d62f5ff).into()),
|
||||
("string.escape".into(), rgba(0x8ca68cff).into()),
|
||||
("variant".into(), rgba(0x98981bff).into()),
|
||||
(
|
||||
"function.special.definition".into(),
|
||||
rgba(0x98981bff).into(),
|
||||
),
|
||||
("constructor".into(), rgba(0x3e62f4ff).into()),
|
||||
("constant".into(), rgba(0x2aa329ff).into()),
|
||||
("hint".into(), rgba(0x008b9fff).into()),
|
||||
("type".into(), rgba(0x98981bff).into()),
|
||||
("emphasis".into(), rgba(0x3e62f4ff).into()),
|
||||
("variable".into(), rgba(0xcfe8cfff).into()),
|
||||
("emphasis.strong".into(), rgba(0x3e62f4ff).into()),
|
||||
("attribute".into(), rgba(0x3e62f4ff).into()),
|
||||
("enum".into(), rgba(0x87711dff).into()),
|
||||
("property".into(), rgba(0xe6183bff).into()),
|
||||
("punctuation.list_marker".into(), rgba(0xcfe8cfff).into()),
|
||||
("variable.special".into(), rgba(0xac2aeeff).into()),
|
||||
],
|
||||
},
|
||||
status_bar: rgba(0x3b453bff).into(),
|
||||
title_bar: rgba(0x3b453bff).into(),
|
||||
toolbar: rgba(0x131513ff).into(),
|
||||
tab_bar: rgba(0x1f231fff).into(),
|
||||
editor: rgba(0x131513ff).into(),
|
||||
editor_subheader: rgba(0x1f231fff).into(),
|
||||
editor_active_line: rgba(0x1f231fff).into(),
|
||||
terminal: rgba(0x131513ff).into(),
|
||||
image_fallback_background: rgba(0x3b453bff).into(),
|
||||
git_created: rgba(0x2aa329ff).into(),
|
||||
git_modified: rgba(0x3e62f4ff).into(),
|
||||
git_deleted: rgba(0xe61c3bff).into(),
|
||||
git_conflict: rgba(0x98981bff).into(),
|
||||
git_ignored: rgba(0x778f77ff).into(),
|
||||
git_renamed: rgba(0x98981bff).into(),
|
||||
players: [
|
||||
PlayerTheme {
|
||||
cursor: rgba(0x3e62f4ff).into(),
|
||||
selection: rgba(0x3e62f43d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0x2aa329ff).into(),
|
||||
selection: rgba(0x2aa3293d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0xe61cc3ff).into(),
|
||||
selection: rgba(0xe61cc33d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0x87711dff).into(),
|
||||
selection: rgba(0x87711d3d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0xac2dedff).into(),
|
||||
selection: rgba(0xac2ded3d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0x1b99b3ff).into(),
|
||||
selection: rgba(0x1b99b33d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0xe61c3bff).into(),
|
||||
selection: rgba(0xe61c3b3d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0x98981bff).into(),
|
||||
selection: rgba(0x98981b3d).into(),
|
||||
},
|
||||
],
|
||||
}
|
||||
}
|
||||
@@ -1,136 +0,0 @@
|
||||
use gpui2::rgba;
|
||||
|
||||
use crate::{PlayerTheme, SyntaxTheme, Theme, ThemeMetadata};
|
||||
|
||||
pub fn atelier_seaside_light() -> Theme {
|
||||
Theme {
|
||||
metadata: ThemeMetadata {
|
||||
name: "Atelier Seaside Light".into(),
|
||||
is_light: true,
|
||||
},
|
||||
transparent: rgba(0x00000000).into(),
|
||||
mac_os_traffic_light_red: rgba(0xec695eff).into(),
|
||||
mac_os_traffic_light_yellow: rgba(0xf4bf4eff).into(),
|
||||
mac_os_traffic_light_green: rgba(0x61c553ff).into(),
|
||||
border: rgba(0x8ea88eff).into(),
|
||||
border_variant: rgba(0x8ea88eff).into(),
|
||||
border_focused: rgba(0xc9c4fdff).into(),
|
||||
border_transparent: rgba(0x00000000).into(),
|
||||
elevated_surface: rgba(0xb4ceb4ff).into(),
|
||||
surface: rgba(0xdaeedaff).into(),
|
||||
background: rgba(0xb4ceb4ff).into(),
|
||||
filled_element: rgba(0xb4ceb4ff).into(),
|
||||
filled_element_hover: rgba(0xffffff1e).into(),
|
||||
filled_element_active: rgba(0xffffff28).into(),
|
||||
filled_element_selected: rgba(0xe1ddfeff).into(),
|
||||
filled_element_disabled: rgba(0x00000000).into(),
|
||||
ghost_element: rgba(0x00000000).into(),
|
||||
ghost_element_hover: rgba(0xffffff14).into(),
|
||||
ghost_element_active: rgba(0xffffff1e).into(),
|
||||
ghost_element_selected: rgba(0xe1ddfeff).into(),
|
||||
ghost_element_disabled: rgba(0x00000000).into(),
|
||||
text: rgba(0x131513ff).into(),
|
||||
text_muted: rgba(0x5f705fff).into(),
|
||||
text_placeholder: rgba(0xe61c3dff).into(),
|
||||
text_disabled: rgba(0x718771ff).into(),
|
||||
text_accent: rgba(0x3e61f4ff).into(),
|
||||
icon_muted: rgba(0x5f705fff).into(),
|
||||
syntax: SyntaxTheme {
|
||||
highlights: vec![
|
||||
("string.escape".into(), rgba(0x5e6e5eff).into()),
|
||||
("boolean".into(), rgba(0x2aa32aff).into()),
|
||||
("string.special".into(), rgba(0xe618c3ff).into()),
|
||||
("comment".into(), rgba(0x809980ff).into()),
|
||||
("number".into(), rgba(0x87711cff).into()),
|
||||
("comment.doc".into(), rgba(0x5e6e5eff).into()),
|
||||
("tag".into(), rgba(0x3e61f4ff).into()),
|
||||
("string.special.symbol".into(), rgba(0x28a328ff).into()),
|
||||
("primary".into(), rgba(0x242924ff).into()),
|
||||
("string".into(), rgba(0x28a328ff).into()),
|
||||
("enum".into(), rgba(0x87711fff).into()),
|
||||
("operator".into(), rgba(0x5e6e5eff).into()),
|
||||
("string.regex".into(), rgba(0x1899b3ff).into()),
|
||||
("keyword".into(), rgba(0xac2aeeff).into()),
|
||||
("emphasis".into(), rgba(0x3e61f4ff).into()),
|
||||
("link_uri".into(), rgba(0x2aa32aff).into()),
|
||||
("constant".into(), rgba(0x2aa32aff).into()),
|
||||
("constructor".into(), rgba(0x3e61f4ff).into()),
|
||||
("link_text".into(), rgba(0x87711fff).into()),
|
||||
("emphasis.strong".into(), rgba(0x3e61f4ff).into()),
|
||||
("punctuation.list_marker".into(), rgba(0x242924ff).into()),
|
||||
("punctuation.delimiter".into(), rgba(0x5e6e5eff).into()),
|
||||
("punctuation.special".into(), rgba(0xe618c3ff).into()),
|
||||
("variant".into(), rgba(0x98981bff).into()),
|
||||
("predictive".into(), rgba(0x00a2b5ff).into()),
|
||||
("attribute".into(), rgba(0x3e61f4ff).into()),
|
||||
("preproc".into(), rgba(0x131513ff).into()),
|
||||
("embedded".into(), rgba(0x131513ff).into()),
|
||||
("punctuation".into(), rgba(0x242924ff).into()),
|
||||
("label".into(), rgba(0x3e61f4ff).into()),
|
||||
("function.method".into(), rgba(0x3d62f5ff).into()),
|
||||
("property".into(), rgba(0xe6183bff).into()),
|
||||
("title".into(), rgba(0x131513ff).into()),
|
||||
("variable".into(), rgba(0x242924ff).into()),
|
||||
("function".into(), rgba(0x3d62f5ff).into()),
|
||||
("variable.special".into(), rgba(0xac2aeeff).into()),
|
||||
("type".into(), rgba(0x98981bff).into()),
|
||||
("text.literal".into(), rgba(0x87711fff).into()),
|
||||
("hint".into(), rgba(0x008fa1ff).into()),
|
||||
(
|
||||
"function.special.definition".into(),
|
||||
rgba(0x98981bff).into(),
|
||||
),
|
||||
("punctuation.bracket".into(), rgba(0x5e6e5eff).into()),
|
||||
],
|
||||
},
|
||||
status_bar: rgba(0xb4ceb4ff).into(),
|
||||
title_bar: rgba(0xb4ceb4ff).into(),
|
||||
toolbar: rgba(0xf3faf3ff).into(),
|
||||
tab_bar: rgba(0xdaeedaff).into(),
|
||||
editor: rgba(0xf3faf3ff).into(),
|
||||
editor_subheader: rgba(0xdaeedaff).into(),
|
||||
editor_active_line: rgba(0xdaeedaff).into(),
|
||||
terminal: rgba(0xf3faf3ff).into(),
|
||||
image_fallback_background: rgba(0xb4ceb4ff).into(),
|
||||
git_created: rgba(0x2aa32aff).into(),
|
||||
git_modified: rgba(0x3e61f4ff).into(),
|
||||
git_deleted: rgba(0xe61c3dff).into(),
|
||||
git_conflict: rgba(0x98981cff).into(),
|
||||
git_ignored: rgba(0x718771ff).into(),
|
||||
git_renamed: rgba(0x98981cff).into(),
|
||||
players: [
|
||||
PlayerTheme {
|
||||
cursor: rgba(0x3e61f4ff).into(),
|
||||
selection: rgba(0x3e61f43d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0x2aa32aff).into(),
|
||||
selection: rgba(0x2aa32a3d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0xe61cc2ff).into(),
|
||||
selection: rgba(0xe61cc23d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0x87711fff).into(),
|
||||
selection: rgba(0x87711f3d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0xac2dedff).into(),
|
||||
selection: rgba(0xac2ded3d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0x1c99b3ff).into(),
|
||||
selection: rgba(0x1c99b33d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0xe61c3dff).into(),
|
||||
selection: rgba(0xe61c3d3d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0x98981cff).into(),
|
||||
selection: rgba(0x98981c3d).into(),
|
||||
},
|
||||
],
|
||||
}
|
||||
}
|
||||
@@ -1,136 +0,0 @@
|
||||
use gpui2::rgba;
|
||||
|
||||
use crate::{PlayerTheme, SyntaxTheme, Theme, ThemeMetadata};
|
||||
|
||||
pub fn atelier_sulphurpool_dark() -> Theme {
|
||||
Theme {
|
||||
metadata: ThemeMetadata {
|
||||
name: "Atelier Sulphurpool Dark".into(),
|
||||
is_light: false,
|
||||
},
|
||||
transparent: rgba(0x00000000).into(),
|
||||
mac_os_traffic_light_red: rgba(0xec695eff).into(),
|
||||
mac_os_traffic_light_yellow: rgba(0xf4bf4eff).into(),
|
||||
mac_os_traffic_light_green: rgba(0x61c553ff).into(),
|
||||
border: rgba(0x5b6385ff).into(),
|
||||
border_variant: rgba(0x5b6385ff).into(),
|
||||
border_focused: rgba(0x203348ff).into(),
|
||||
border_transparent: rgba(0x00000000).into(),
|
||||
elevated_surface: rgba(0x3e4769ff).into(),
|
||||
surface: rgba(0x262f51ff).into(),
|
||||
background: rgba(0x3e4769ff).into(),
|
||||
filled_element: rgba(0x3e4769ff).into(),
|
||||
filled_element_hover: rgba(0xffffff1e).into(),
|
||||
filled_element_active: rgba(0xffffff28).into(),
|
||||
filled_element_selected: rgba(0x161f2bff).into(),
|
||||
filled_element_disabled: rgba(0x00000000).into(),
|
||||
ghost_element: rgba(0x00000000).into(),
|
||||
ghost_element_hover: rgba(0xffffff14).into(),
|
||||
ghost_element_active: rgba(0xffffff1e).into(),
|
||||
ghost_element_selected: rgba(0x161f2bff).into(),
|
||||
ghost_element_disabled: rgba(0x00000000).into(),
|
||||
text: rgba(0xf5f7ffff).into(),
|
||||
text_muted: rgba(0x959bb2ff).into(),
|
||||
text_placeholder: rgba(0xc94922ff).into(),
|
||||
text_disabled: rgba(0x7e849eff).into(),
|
||||
text_accent: rgba(0x3e8ed0ff).into(),
|
||||
icon_muted: rgba(0x959bb2ff).into(),
|
||||
syntax: SyntaxTheme {
|
||||
highlights: vec![
|
||||
("title".into(), rgba(0xf5f7ffff).into()),
|
||||
("constructor".into(), rgba(0x3e8ed0ff).into()),
|
||||
("type".into(), rgba(0xc08b2fff).into()),
|
||||
("punctuation.list_marker".into(), rgba(0xdfe2f1ff).into()),
|
||||
("property".into(), rgba(0xc94821ff).into()),
|
||||
("link_uri".into(), rgba(0xac9739ff).into()),
|
||||
("string.escape".into(), rgba(0x979db4ff).into()),
|
||||
("constant".into(), rgba(0xac9739ff).into()),
|
||||
("embedded".into(), rgba(0xf5f7ffff).into()),
|
||||
("punctuation.special".into(), rgba(0x9b6279ff).into()),
|
||||
("punctuation.bracket".into(), rgba(0x979db4ff).into()),
|
||||
("preproc".into(), rgba(0xf5f7ffff).into()),
|
||||
("emphasis.strong".into(), rgba(0x3e8ed0ff).into()),
|
||||
("emphasis".into(), rgba(0x3e8ed0ff).into()),
|
||||
("enum".into(), rgba(0xc76a29ff).into()),
|
||||
("boolean".into(), rgba(0xac9739ff).into()),
|
||||
("primary".into(), rgba(0xdfe2f1ff).into()),
|
||||
("function.method".into(), rgba(0x3d8fd1ff).into()),
|
||||
(
|
||||
"function.special.definition".into(),
|
||||
rgba(0xc08b2fff).into(),
|
||||
),
|
||||
("comment.doc".into(), rgba(0x979db4ff).into()),
|
||||
("string".into(), rgba(0xac9738ff).into()),
|
||||
("text.literal".into(), rgba(0xc76a29ff).into()),
|
||||
("operator".into(), rgba(0x979db4ff).into()),
|
||||
("number".into(), rgba(0xc76a28ff).into()),
|
||||
("string.special".into(), rgba(0x9b6279ff).into()),
|
||||
("punctuation.delimiter".into(), rgba(0x979db4ff).into()),
|
||||
("tag".into(), rgba(0x3e8ed0ff).into()),
|
||||
("string.special.symbol".into(), rgba(0xac9738ff).into()),
|
||||
("variable".into(), rgba(0xdfe2f1ff).into()),
|
||||
("attribute".into(), rgba(0x3e8ed0ff).into()),
|
||||
("punctuation".into(), rgba(0xdfe2f1ff).into()),
|
||||
("string.regex".into(), rgba(0x21a2c9ff).into()),
|
||||
("keyword".into(), rgba(0x6679ccff).into()),
|
||||
("label".into(), rgba(0x3e8ed0ff).into()),
|
||||
("hint".into(), rgba(0x6c81a5ff).into()),
|
||||
("function".into(), rgba(0x3d8fd1ff).into()),
|
||||
("link_text".into(), rgba(0xc76a29ff).into()),
|
||||
("variant".into(), rgba(0xc08b2fff).into()),
|
||||
("variable.special".into(), rgba(0x6679ccff).into()),
|
||||
("predictive".into(), rgba(0x58709aff).into()),
|
||||
("comment".into(), rgba(0x6a7293ff).into()),
|
||||
],
|
||||
},
|
||||
status_bar: rgba(0x3e4769ff).into(),
|
||||
title_bar: rgba(0x3e4769ff).into(),
|
||||
toolbar: rgba(0x202646ff).into(),
|
||||
tab_bar: rgba(0x262f51ff).into(),
|
||||
editor: rgba(0x202646ff).into(),
|
||||
editor_subheader: rgba(0x262f51ff).into(),
|
||||
editor_active_line: rgba(0x262f51ff).into(),
|
||||
terminal: rgba(0x202646ff).into(),
|
||||
image_fallback_background: rgba(0x3e4769ff).into(),
|
||||
git_created: rgba(0xac9739ff).into(),
|
||||
git_modified: rgba(0x3e8ed0ff).into(),
|
||||
git_deleted: rgba(0xc94922ff).into(),
|
||||
git_conflict: rgba(0xc08b30ff).into(),
|
||||
git_ignored: rgba(0x7e849eff).into(),
|
||||
git_renamed: rgba(0xc08b30ff).into(),
|
||||
players: [
|
||||
PlayerTheme {
|
||||
cursor: rgba(0x3e8ed0ff).into(),
|
||||
selection: rgba(0x3e8ed03d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0xac9739ff).into(),
|
||||
selection: rgba(0xac97393d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0x9b6279ff).into(),
|
||||
selection: rgba(0x9b62793d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0xc76a29ff).into(),
|
||||
selection: rgba(0xc76a293d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0x6679ccff).into(),
|
||||
selection: rgba(0x6679cc3d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0x24a1c9ff).into(),
|
||||
selection: rgba(0x24a1c93d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0xc94922ff).into(),
|
||||
selection: rgba(0xc949223d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0xc08b30ff).into(),
|
||||
selection: rgba(0xc08b303d).into(),
|
||||
},
|
||||
],
|
||||
}
|
||||
}
|
||||
@@ -1,136 +0,0 @@
|
||||
use gpui2::rgba;
|
||||
|
||||
use crate::{PlayerTheme, SyntaxTheme, Theme, ThemeMetadata};
|
||||
|
||||
pub fn atelier_sulphurpool_light() -> Theme {
|
||||
Theme {
|
||||
metadata: ThemeMetadata {
|
||||
name: "Atelier Sulphurpool Light".into(),
|
||||
is_light: true,
|
||||
},
|
||||
transparent: rgba(0x00000000).into(),
|
||||
mac_os_traffic_light_red: rgba(0xec695eff).into(),
|
||||
mac_os_traffic_light_yellow: rgba(0xf4bf4eff).into(),
|
||||
mac_os_traffic_light_green: rgba(0x61c553ff).into(),
|
||||
border: rgba(0x9a9fb6ff).into(),
|
||||
border_variant: rgba(0x9a9fb6ff).into(),
|
||||
border_focused: rgba(0xc2d5efff).into(),
|
||||
border_transparent: rgba(0x00000000).into(),
|
||||
elevated_surface: rgba(0xc1c5d8ff).into(),
|
||||
surface: rgba(0xe5e8f5ff).into(),
|
||||
background: rgba(0xc1c5d8ff).into(),
|
||||
filled_element: rgba(0xc1c5d8ff).into(),
|
||||
filled_element_hover: rgba(0xffffff1e).into(),
|
||||
filled_element_active: rgba(0xffffff28).into(),
|
||||
filled_element_selected: rgba(0xdde7f6ff).into(),
|
||||
filled_element_disabled: rgba(0x00000000).into(),
|
||||
ghost_element: rgba(0x00000000).into(),
|
||||
ghost_element_hover: rgba(0xffffff14).into(),
|
||||
ghost_element_active: rgba(0xffffff1e).into(),
|
||||
ghost_element_selected: rgba(0xdde7f6ff).into(),
|
||||
ghost_element_disabled: rgba(0x00000000).into(),
|
||||
text: rgba(0x202646ff).into(),
|
||||
text_muted: rgba(0x5f6789ff).into(),
|
||||
text_placeholder: rgba(0xc94922ff).into(),
|
||||
text_disabled: rgba(0x767d9aff).into(),
|
||||
text_accent: rgba(0x3e8fd0ff).into(),
|
||||
icon_muted: rgba(0x5f6789ff).into(),
|
||||
syntax: SyntaxTheme {
|
||||
highlights: vec![
|
||||
("string.special".into(), rgba(0x9b6279ff).into()),
|
||||
("string.regex".into(), rgba(0x21a2c9ff).into()),
|
||||
("embedded".into(), rgba(0x202646ff).into()),
|
||||
("string".into(), rgba(0xac9738ff).into()),
|
||||
(
|
||||
"function.special.definition".into(),
|
||||
rgba(0xc08b2fff).into(),
|
||||
),
|
||||
("hint".into(), rgba(0x7087b2ff).into()),
|
||||
("function.method".into(), rgba(0x3d8fd1ff).into()),
|
||||
("punctuation.list_marker".into(), rgba(0x293256ff).into()),
|
||||
("punctuation".into(), rgba(0x293256ff).into()),
|
||||
("constant".into(), rgba(0xac9739ff).into()),
|
||||
("label".into(), rgba(0x3e8fd0ff).into()),
|
||||
("comment.doc".into(), rgba(0x5d6587ff).into()),
|
||||
("property".into(), rgba(0xc94821ff).into()),
|
||||
("punctuation.bracket".into(), rgba(0x5d6587ff).into()),
|
||||
("constructor".into(), rgba(0x3e8fd0ff).into()),
|
||||
("variable.special".into(), rgba(0x6679ccff).into()),
|
||||
("emphasis".into(), rgba(0x3e8fd0ff).into()),
|
||||
("link_text".into(), rgba(0xc76a29ff).into()),
|
||||
("keyword".into(), rgba(0x6679ccff).into()),
|
||||
("primary".into(), rgba(0x293256ff).into()),
|
||||
("comment".into(), rgba(0x898ea4ff).into()),
|
||||
("title".into(), rgba(0x202646ff).into()),
|
||||
("link_uri".into(), rgba(0xac9739ff).into()),
|
||||
("text.literal".into(), rgba(0xc76a29ff).into()),
|
||||
("operator".into(), rgba(0x5d6587ff).into()),
|
||||
("number".into(), rgba(0xc76a28ff).into()),
|
||||
("preproc".into(), rgba(0x202646ff).into()),
|
||||
("attribute".into(), rgba(0x3e8fd0ff).into()),
|
||||
("emphasis.strong".into(), rgba(0x3e8fd0ff).into()),
|
||||
("string.escape".into(), rgba(0x5d6587ff).into()),
|
||||
("tag".into(), rgba(0x3e8fd0ff).into()),
|
||||
("variable".into(), rgba(0x293256ff).into()),
|
||||
("predictive".into(), rgba(0x8599beff).into()),
|
||||
("enum".into(), rgba(0xc76a29ff).into()),
|
||||
("string.special.symbol".into(), rgba(0xac9738ff).into()),
|
||||
("punctuation.delimiter".into(), rgba(0x5d6587ff).into()),
|
||||
("function".into(), rgba(0x3d8fd1ff).into()),
|
||||
("type".into(), rgba(0xc08b2fff).into()),
|
||||
("punctuation.special".into(), rgba(0x9b6279ff).into()),
|
||||
("variant".into(), rgba(0xc08b2fff).into()),
|
||||
("boolean".into(), rgba(0xac9739ff).into()),
|
||||
],
|
||||
},
|
||||
status_bar: rgba(0xc1c5d8ff).into(),
|
||||
title_bar: rgba(0xc1c5d8ff).into(),
|
||||
toolbar: rgba(0xf5f7ffff).into(),
|
||||
tab_bar: rgba(0xe5e8f5ff).into(),
|
||||
editor: rgba(0xf5f7ffff).into(),
|
||||
editor_subheader: rgba(0xe5e8f5ff).into(),
|
||||
editor_active_line: rgba(0xe5e8f5ff).into(),
|
||||
terminal: rgba(0xf5f7ffff).into(),
|
||||
image_fallback_background: rgba(0xc1c5d8ff).into(),
|
||||
git_created: rgba(0xac9739ff).into(),
|
||||
git_modified: rgba(0x3e8fd0ff).into(),
|
||||
git_deleted: rgba(0xc94922ff).into(),
|
||||
git_conflict: rgba(0xc08b30ff).into(),
|
||||
git_ignored: rgba(0x767d9aff).into(),
|
||||
git_renamed: rgba(0xc08b30ff).into(),
|
||||
players: [
|
||||
PlayerTheme {
|
||||
cursor: rgba(0x3e8fd0ff).into(),
|
||||
selection: rgba(0x3e8fd03d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0xac9739ff).into(),
|
||||
selection: rgba(0xac97393d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0x9b6279ff).into(),
|
||||
selection: rgba(0x9b62793d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0xc76a29ff).into(),
|
||||
selection: rgba(0xc76a293d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0x6679cbff).into(),
|
||||
selection: rgba(0x6679cb3d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0x24a1c9ff).into(),
|
||||
selection: rgba(0x24a1c93d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0xc94922ff).into(),
|
||||
selection: rgba(0xc949223d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0xc08b30ff).into(),
|
||||
selection: rgba(0xc08b303d).into(),
|
||||
},
|
||||
],
|
||||
}
|
||||
}
|
||||
@@ -1,130 +0,0 @@
|
||||
use gpui2::rgba;
|
||||
|
||||
use crate::{PlayerTheme, SyntaxTheme, Theme, ThemeMetadata};
|
||||
|
||||
pub fn ayu_dark() -> Theme {
|
||||
Theme {
|
||||
metadata: ThemeMetadata {
|
||||
name: "Ayu Dark".into(),
|
||||
is_light: false,
|
||||
},
|
||||
transparent: rgba(0x00000000).into(),
|
||||
mac_os_traffic_light_red: rgba(0xec695eff).into(),
|
||||
mac_os_traffic_light_yellow: rgba(0xf4bf4eff).into(),
|
||||
mac_os_traffic_light_green: rgba(0x61c553ff).into(),
|
||||
border: rgba(0x3f4043ff).into(),
|
||||
border_variant: rgba(0x3f4043ff).into(),
|
||||
border_focused: rgba(0x1b4a6eff).into(),
|
||||
border_transparent: rgba(0x00000000).into(),
|
||||
elevated_surface: rgba(0x313337ff).into(),
|
||||
surface: rgba(0x1f2127ff).into(),
|
||||
background: rgba(0x313337ff).into(),
|
||||
filled_element: rgba(0x313337ff).into(),
|
||||
filled_element_hover: rgba(0xffffff1e).into(),
|
||||
filled_element_active: rgba(0xffffff28).into(),
|
||||
filled_element_selected: rgba(0x0d2f4eff).into(),
|
||||
filled_element_disabled: rgba(0x00000000).into(),
|
||||
ghost_element: rgba(0x00000000).into(),
|
||||
ghost_element_hover: rgba(0xffffff14).into(),
|
||||
ghost_element_active: rgba(0xffffff1e).into(),
|
||||
ghost_element_selected: rgba(0x0d2f4eff).into(),
|
||||
ghost_element_disabled: rgba(0x00000000).into(),
|
||||
text: rgba(0xbfbdb6ff).into(),
|
||||
text_muted: rgba(0x8a8986ff).into(),
|
||||
text_placeholder: rgba(0xef7177ff).into(),
|
||||
text_disabled: rgba(0x696a6aff).into(),
|
||||
text_accent: rgba(0x5ac1feff).into(),
|
||||
icon_muted: rgba(0x8a8986ff).into(),
|
||||
syntax: SyntaxTheme {
|
||||
highlights: vec![
|
||||
("emphasis".into(), rgba(0x5ac1feff).into()),
|
||||
("punctuation.bracket".into(), rgba(0xa6a5a0ff).into()),
|
||||
("constructor".into(), rgba(0x5ac1feff).into()),
|
||||
("predictive".into(), rgba(0x5a728bff).into()),
|
||||
("emphasis.strong".into(), rgba(0x5ac1feff).into()),
|
||||
("string.regex".into(), rgba(0x95e6cbff).into()),
|
||||
("tag".into(), rgba(0x5ac1feff).into()),
|
||||
("punctuation".into(), rgba(0xa6a5a0ff).into()),
|
||||
("number".into(), rgba(0xd2a6ffff).into()),
|
||||
("punctuation.special".into(), rgba(0xd2a6ffff).into()),
|
||||
("primary".into(), rgba(0xbfbdb6ff).into()),
|
||||
("boolean".into(), rgba(0xd2a6ffff).into()),
|
||||
("variant".into(), rgba(0x5ac1feff).into()),
|
||||
("link_uri".into(), rgba(0xaad84cff).into()),
|
||||
("comment.doc".into(), rgba(0x8c8b88ff).into()),
|
||||
("title".into(), rgba(0xbfbdb6ff).into()),
|
||||
("text.literal".into(), rgba(0xfe8f40ff).into()),
|
||||
("link_text".into(), rgba(0xfe8f40ff).into()),
|
||||
("punctuation.delimiter".into(), rgba(0xa6a5a0ff).into()),
|
||||
("string.escape".into(), rgba(0x8c8b88ff).into()),
|
||||
("hint".into(), rgba(0x628b80ff).into()),
|
||||
("type".into(), rgba(0x59c2ffff).into()),
|
||||
("variable".into(), rgba(0xbfbdb6ff).into()),
|
||||
("label".into(), rgba(0x5ac1feff).into()),
|
||||
("enum".into(), rgba(0xfe8f40ff).into()),
|
||||
("operator".into(), rgba(0xf29668ff).into()),
|
||||
("function".into(), rgba(0xffb353ff).into()),
|
||||
("preproc".into(), rgba(0xbfbdb6ff).into()),
|
||||
("embedded".into(), rgba(0xbfbdb6ff).into()),
|
||||
("string".into(), rgba(0xa9d94bff).into()),
|
||||
("attribute".into(), rgba(0x5ac1feff).into()),
|
||||
("keyword".into(), rgba(0xff8f3fff).into()),
|
||||
("string.special.symbol".into(), rgba(0xfe8f40ff).into()),
|
||||
("comment".into(), rgba(0xabb5be8c).into()),
|
||||
("property".into(), rgba(0x5ac1feff).into()),
|
||||
("punctuation.list_marker".into(), rgba(0xa6a5a0ff).into()),
|
||||
("constant".into(), rgba(0xd2a6ffff).into()),
|
||||
("string.special".into(), rgba(0xe5b572ff).into()),
|
||||
],
|
||||
},
|
||||
status_bar: rgba(0x313337ff).into(),
|
||||
title_bar: rgba(0x313337ff).into(),
|
||||
toolbar: rgba(0x0d1016ff).into(),
|
||||
tab_bar: rgba(0x1f2127ff).into(),
|
||||
editor: rgba(0x0d1016ff).into(),
|
||||
editor_subheader: rgba(0x1f2127ff).into(),
|
||||
editor_active_line: rgba(0x1f2127ff).into(),
|
||||
terminal: rgba(0x0d1016ff).into(),
|
||||
image_fallback_background: rgba(0x313337ff).into(),
|
||||
git_created: rgba(0xaad84cff).into(),
|
||||
git_modified: rgba(0x5ac1feff).into(),
|
||||
git_deleted: rgba(0xef7177ff).into(),
|
||||
git_conflict: rgba(0xfeb454ff).into(),
|
||||
git_ignored: rgba(0x696a6aff).into(),
|
||||
git_renamed: rgba(0xfeb454ff).into(),
|
||||
players: [
|
||||
PlayerTheme {
|
||||
cursor: rgba(0x5ac1feff).into(),
|
||||
selection: rgba(0x5ac1fe3d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0xaad84cff).into(),
|
||||
selection: rgba(0xaad84c3d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0x39bae5ff).into(),
|
||||
selection: rgba(0x39bae53d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0xfe8f40ff).into(),
|
||||
selection: rgba(0xfe8f403d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0xd2a6feff).into(),
|
||||
selection: rgba(0xd2a6fe3d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0x95e5cbff).into(),
|
||||
selection: rgba(0x95e5cb3d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0xef7177ff).into(),
|
||||
selection: rgba(0xef71773d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0xfeb454ff).into(),
|
||||
selection: rgba(0xfeb4543d).into(),
|
||||
},
|
||||
],
|
||||
}
|
||||
}
|
||||
@@ -1,130 +0,0 @@
|
||||
use gpui2::rgba;
|
||||
|
||||
use crate::{PlayerTheme, SyntaxTheme, Theme, ThemeMetadata};
|
||||
|
||||
pub fn ayu_light() -> Theme {
|
||||
Theme {
|
||||
metadata: ThemeMetadata {
|
||||
name: "Ayu Light".into(),
|
||||
is_light: true,
|
||||
},
|
||||
transparent: rgba(0x00000000).into(),
|
||||
mac_os_traffic_light_red: rgba(0xec695eff).into(),
|
||||
mac_os_traffic_light_yellow: rgba(0xf4bf4eff).into(),
|
||||
mac_os_traffic_light_green: rgba(0x61c553ff).into(),
|
||||
border: rgba(0xcfd1d2ff).into(),
|
||||
border_variant: rgba(0xcfd1d2ff).into(),
|
||||
border_focused: rgba(0xc4daf6ff).into(),
|
||||
border_transparent: rgba(0x00000000).into(),
|
||||
elevated_surface: rgba(0xdcdddeff).into(),
|
||||
surface: rgba(0xececedff).into(),
|
||||
background: rgba(0xdcdddeff).into(),
|
||||
filled_element: rgba(0xdcdddeff).into(),
|
||||
filled_element_hover: rgba(0xffffff1e).into(),
|
||||
filled_element_active: rgba(0xffffff28).into(),
|
||||
filled_element_selected: rgba(0xdeebfaff).into(),
|
||||
filled_element_disabled: rgba(0x00000000).into(),
|
||||
ghost_element: rgba(0x00000000).into(),
|
||||
ghost_element_hover: rgba(0xffffff14).into(),
|
||||
ghost_element_active: rgba(0xffffff1e).into(),
|
||||
ghost_element_selected: rgba(0xdeebfaff).into(),
|
||||
ghost_element_disabled: rgba(0x00000000).into(),
|
||||
text: rgba(0x5c6166ff).into(),
|
||||
text_muted: rgba(0x8b8e92ff).into(),
|
||||
text_placeholder: rgba(0xef7271ff).into(),
|
||||
text_disabled: rgba(0xa9acaeff).into(),
|
||||
text_accent: rgba(0x3b9ee5ff).into(),
|
||||
icon_muted: rgba(0x8b8e92ff).into(),
|
||||
syntax: SyntaxTheme {
|
||||
highlights: vec![
|
||||
("string".into(), rgba(0x86b300ff).into()),
|
||||
("enum".into(), rgba(0xf98d3fff).into()),
|
||||
("comment".into(), rgba(0x787b8099).into()),
|
||||
("comment.doc".into(), rgba(0x898d90ff).into()),
|
||||
("emphasis".into(), rgba(0x3b9ee5ff).into()),
|
||||
("keyword".into(), rgba(0xfa8d3eff).into()),
|
||||
("string.regex".into(), rgba(0x4bbf98ff).into()),
|
||||
("text.literal".into(), rgba(0xf98d3fff).into()),
|
||||
("string.escape".into(), rgba(0x898d90ff).into()),
|
||||
("link_text".into(), rgba(0xf98d3fff).into()),
|
||||
("punctuation".into(), rgba(0x73777bff).into()),
|
||||
("constructor".into(), rgba(0x3b9ee5ff).into()),
|
||||
("constant".into(), rgba(0xa37accff).into()),
|
||||
("variable".into(), rgba(0x5c6166ff).into()),
|
||||
("primary".into(), rgba(0x5c6166ff).into()),
|
||||
("emphasis.strong".into(), rgba(0x3b9ee5ff).into()),
|
||||
("string.special".into(), rgba(0xe6ba7eff).into()),
|
||||
("number".into(), rgba(0xa37accff).into()),
|
||||
("preproc".into(), rgba(0x5c6166ff).into()),
|
||||
("punctuation.delimiter".into(), rgba(0x73777bff).into()),
|
||||
("string.special.symbol".into(), rgba(0xf98d3fff).into()),
|
||||
("boolean".into(), rgba(0xa37accff).into()),
|
||||
("property".into(), rgba(0x3b9ee5ff).into()),
|
||||
("title".into(), rgba(0x5c6166ff).into()),
|
||||
("hint".into(), rgba(0x8ca7c2ff).into()),
|
||||
("predictive".into(), rgba(0x9eb9d3ff).into()),
|
||||
("operator".into(), rgba(0xed9365ff).into()),
|
||||
("type".into(), rgba(0x389ee6ff).into()),
|
||||
("function".into(), rgba(0xf2ad48ff).into()),
|
||||
("variant".into(), rgba(0x3b9ee5ff).into()),
|
||||
("label".into(), rgba(0x3b9ee5ff).into()),
|
||||
("punctuation.list_marker".into(), rgba(0x73777bff).into()),
|
||||
("punctuation.bracket".into(), rgba(0x73777bff).into()),
|
||||
("embedded".into(), rgba(0x5c6166ff).into()),
|
||||
("punctuation.special".into(), rgba(0xa37accff).into()),
|
||||
("attribute".into(), rgba(0x3b9ee5ff).into()),
|
||||
("tag".into(), rgba(0x3b9ee5ff).into()),
|
||||
("link_uri".into(), rgba(0x85b304ff).into()),
|
||||
],
|
||||
},
|
||||
status_bar: rgba(0xdcdddeff).into(),
|
||||
title_bar: rgba(0xdcdddeff).into(),
|
||||
toolbar: rgba(0xfcfcfcff).into(),
|
||||
tab_bar: rgba(0xececedff).into(),
|
||||
editor: rgba(0xfcfcfcff).into(),
|
||||
editor_subheader: rgba(0xececedff).into(),
|
||||
editor_active_line: rgba(0xececedff).into(),
|
||||
terminal: rgba(0xfcfcfcff).into(),
|
||||
image_fallback_background: rgba(0xdcdddeff).into(),
|
||||
git_created: rgba(0x85b304ff).into(),
|
||||
git_modified: rgba(0x3b9ee5ff).into(),
|
||||
git_deleted: rgba(0xef7271ff).into(),
|
||||
git_conflict: rgba(0xf1ad49ff).into(),
|
||||
git_ignored: rgba(0xa9acaeff).into(),
|
||||
git_renamed: rgba(0xf1ad49ff).into(),
|
||||
players: [
|
||||
PlayerTheme {
|
||||
cursor: rgba(0x3b9ee5ff).into(),
|
||||
selection: rgba(0x3b9ee53d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0x85b304ff).into(),
|
||||
selection: rgba(0x85b3043d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0x55b4d3ff).into(),
|
||||
selection: rgba(0x55b4d33d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0xf98d3fff).into(),
|
||||
selection: rgba(0xf98d3f3d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0xa37accff).into(),
|
||||
selection: rgba(0xa37acc3d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0x4dbf99ff).into(),
|
||||
selection: rgba(0x4dbf993d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0xef7271ff).into(),
|
||||
selection: rgba(0xef72713d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0xf1ad49ff).into(),
|
||||
selection: rgba(0xf1ad493d).into(),
|
||||
},
|
||||
],
|
||||
}
|
||||
}
|
||||
@@ -1,130 +0,0 @@
|
||||
use gpui2::rgba;
|
||||
|
||||
use crate::{PlayerTheme, SyntaxTheme, Theme, ThemeMetadata};
|
||||
|
||||
pub fn ayu_mirage() -> Theme {
|
||||
Theme {
|
||||
metadata: ThemeMetadata {
|
||||
name: "Ayu Mirage".into(),
|
||||
is_light: false,
|
||||
},
|
||||
transparent: rgba(0x00000000).into(),
|
||||
mac_os_traffic_light_red: rgba(0xec695eff).into(),
|
||||
mac_os_traffic_light_yellow: rgba(0xf4bf4eff).into(),
|
||||
mac_os_traffic_light_green: rgba(0x61c553ff).into(),
|
||||
border: rgba(0x53565dff).into(),
|
||||
border_variant: rgba(0x53565dff).into(),
|
||||
border_focused: rgba(0x24556fff).into(),
|
||||
border_transparent: rgba(0x00000000).into(),
|
||||
elevated_surface: rgba(0x464a52ff).into(),
|
||||
surface: rgba(0x353944ff).into(),
|
||||
background: rgba(0x464a52ff).into(),
|
||||
filled_element: rgba(0x464a52ff).into(),
|
||||
filled_element_hover: rgba(0xffffff1e).into(),
|
||||
filled_element_active: rgba(0xffffff28).into(),
|
||||
filled_element_selected: rgba(0x123950ff).into(),
|
||||
filled_element_disabled: rgba(0x00000000).into(),
|
||||
ghost_element: rgba(0x00000000).into(),
|
||||
ghost_element_hover: rgba(0xffffff14).into(),
|
||||
ghost_element_active: rgba(0xffffff1e).into(),
|
||||
ghost_element_selected: rgba(0x123950ff).into(),
|
||||
ghost_element_disabled: rgba(0x00000000).into(),
|
||||
text: rgba(0xcccac2ff).into(),
|
||||
text_muted: rgba(0x9a9a98ff).into(),
|
||||
text_placeholder: rgba(0xf18779ff).into(),
|
||||
text_disabled: rgba(0x7b7d7fff).into(),
|
||||
text_accent: rgba(0x72cffeff).into(),
|
||||
icon_muted: rgba(0x9a9a98ff).into(),
|
||||
syntax: SyntaxTheme {
|
||||
highlights: vec![
|
||||
("text.literal".into(), rgba(0xfead66ff).into()),
|
||||
("link_text".into(), rgba(0xfead66ff).into()),
|
||||
("function".into(), rgba(0xffd173ff).into()),
|
||||
("punctuation.delimiter".into(), rgba(0xb4b3aeff).into()),
|
||||
("property".into(), rgba(0x72cffeff).into()),
|
||||
("title".into(), rgba(0xcccac2ff).into()),
|
||||
("boolean".into(), rgba(0xdfbfffff).into()),
|
||||
("link_uri".into(), rgba(0xd5fe80ff).into()),
|
||||
("label".into(), rgba(0x72cffeff).into()),
|
||||
("primary".into(), rgba(0xcccac2ff).into()),
|
||||
("number".into(), rgba(0xdfbfffff).into()),
|
||||
("variant".into(), rgba(0x72cffeff).into()),
|
||||
("enum".into(), rgba(0xfead66ff).into()),
|
||||
("string.special.symbol".into(), rgba(0xfead66ff).into()),
|
||||
("operator".into(), rgba(0xf29e74ff).into()),
|
||||
("punctuation.special".into(), rgba(0xdfbfffff).into()),
|
||||
("constructor".into(), rgba(0x72cffeff).into()),
|
||||
("type".into(), rgba(0x73cfffff).into()),
|
||||
("emphasis.strong".into(), rgba(0x72cffeff).into()),
|
||||
("embedded".into(), rgba(0xcccac2ff).into()),
|
||||
("comment".into(), rgba(0xb8cfe680).into()),
|
||||
("tag".into(), rgba(0x72cffeff).into()),
|
||||
("keyword".into(), rgba(0xffad65ff).into()),
|
||||
("punctuation".into(), rgba(0xb4b3aeff).into()),
|
||||
("preproc".into(), rgba(0xcccac2ff).into()),
|
||||
("hint".into(), rgba(0x7399a3ff).into()),
|
||||
("string.special".into(), rgba(0xffdfb3ff).into()),
|
||||
("attribute".into(), rgba(0x72cffeff).into()),
|
||||
("string.regex".into(), rgba(0x95e6cbff).into()),
|
||||
("predictive".into(), rgba(0x6d839bff).into()),
|
||||
("comment.doc".into(), rgba(0x9b9b99ff).into()),
|
||||
("emphasis".into(), rgba(0x72cffeff).into()),
|
||||
("string".into(), rgba(0xd4fe7fff).into()),
|
||||
("constant".into(), rgba(0xdfbfffff).into()),
|
||||
("string.escape".into(), rgba(0x9b9b99ff).into()),
|
||||
("variable".into(), rgba(0xcccac2ff).into()),
|
||||
("punctuation.bracket".into(), rgba(0xb4b3aeff).into()),
|
||||
("punctuation.list_marker".into(), rgba(0xb4b3aeff).into()),
|
||||
],
|
||||
},
|
||||
status_bar: rgba(0x464a52ff).into(),
|
||||
title_bar: rgba(0x464a52ff).into(),
|
||||
toolbar: rgba(0x242835ff).into(),
|
||||
tab_bar: rgba(0x353944ff).into(),
|
||||
editor: rgba(0x242835ff).into(),
|
||||
editor_subheader: rgba(0x353944ff).into(),
|
||||
editor_active_line: rgba(0x353944ff).into(),
|
||||
terminal: rgba(0x242835ff).into(),
|
||||
image_fallback_background: rgba(0x464a52ff).into(),
|
||||
git_created: rgba(0xd5fe80ff).into(),
|
||||
git_modified: rgba(0x72cffeff).into(),
|
||||
git_deleted: rgba(0xf18779ff).into(),
|
||||
git_conflict: rgba(0xfecf72ff).into(),
|
||||
git_ignored: rgba(0x7b7d7fff).into(),
|
||||
git_renamed: rgba(0xfecf72ff).into(),
|
||||
players: [
|
||||
PlayerTheme {
|
||||
cursor: rgba(0x72cffeff).into(),
|
||||
selection: rgba(0x72cffe3d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0xd5fe80ff).into(),
|
||||
selection: rgba(0xd5fe803d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0x5bcde5ff).into(),
|
||||
selection: rgba(0x5bcde53d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0xfead66ff).into(),
|
||||
selection: rgba(0xfead663d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0xdebffeff).into(),
|
||||
selection: rgba(0xdebffe3d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0x95e5cbff).into(),
|
||||
selection: rgba(0x95e5cb3d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0xf18779ff).into(),
|
||||
selection: rgba(0xf187793d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0xfecf72ff).into(),
|
||||
selection: rgba(0xfecf723d).into(),
|
||||
},
|
||||
],
|
||||
}
|
||||
}
|
||||
@@ -1,131 +0,0 @@
|
||||
use gpui2::rgba;
|
||||
|
||||
use crate::{PlayerTheme, SyntaxTheme, Theme, ThemeMetadata};
|
||||
|
||||
pub fn gruvbox_dark() -> Theme {
|
||||
Theme {
|
||||
metadata: ThemeMetadata {
|
||||
name: "Gruvbox Dark".into(),
|
||||
is_light: false,
|
||||
},
|
||||
transparent: rgba(0x00000000).into(),
|
||||
mac_os_traffic_light_red: rgba(0xec695eff).into(),
|
||||
mac_os_traffic_light_yellow: rgba(0xf4bf4eff).into(),
|
||||
mac_os_traffic_light_green: rgba(0x61c553ff).into(),
|
||||
border: rgba(0x5b534dff).into(),
|
||||
border_variant: rgba(0x5b534dff).into(),
|
||||
border_focused: rgba(0x303a36ff).into(),
|
||||
border_transparent: rgba(0x00000000).into(),
|
||||
elevated_surface: rgba(0x4c4642ff).into(),
|
||||
surface: rgba(0x3a3735ff).into(),
|
||||
background: rgba(0x4c4642ff).into(),
|
||||
filled_element: rgba(0x4c4642ff).into(),
|
||||
filled_element_hover: rgba(0xffffff1e).into(),
|
||||
filled_element_active: rgba(0xffffff28).into(),
|
||||
filled_element_selected: rgba(0x1e2321ff).into(),
|
||||
filled_element_disabled: rgba(0x00000000).into(),
|
||||
ghost_element: rgba(0x00000000).into(),
|
||||
ghost_element_hover: rgba(0xffffff14).into(),
|
||||
ghost_element_active: rgba(0xffffff1e).into(),
|
||||
ghost_element_selected: rgba(0x1e2321ff).into(),
|
||||
ghost_element_disabled: rgba(0x00000000).into(),
|
||||
text: rgba(0xfbf1c7ff).into(),
|
||||
text_muted: rgba(0xc5b597ff).into(),
|
||||
text_placeholder: rgba(0xfb4a35ff).into(),
|
||||
text_disabled: rgba(0x998b78ff).into(),
|
||||
text_accent: rgba(0x83a598ff).into(),
|
||||
icon_muted: rgba(0xc5b597ff).into(),
|
||||
syntax: SyntaxTheme {
|
||||
highlights: vec![
|
||||
("operator".into(), rgba(0x8ec07cff).into()),
|
||||
("string.special.symbol".into(), rgba(0x8ec07cff).into()),
|
||||
("emphasis.strong".into(), rgba(0x83a598ff).into()),
|
||||
("attribute".into(), rgba(0x83a598ff).into()),
|
||||
("property".into(), rgba(0xebdbb2ff).into()),
|
||||
("comment.doc".into(), rgba(0xc6b697ff).into()),
|
||||
("emphasis".into(), rgba(0x83a598ff).into()),
|
||||
("variant".into(), rgba(0x83a598ff).into()),
|
||||
("text.literal".into(), rgba(0x83a598ff).into()),
|
||||
("keyword".into(), rgba(0xfb4833ff).into()),
|
||||
("primary".into(), rgba(0xebdbb2ff).into()),
|
||||
("variable".into(), rgba(0x83a598ff).into()),
|
||||
("enum".into(), rgba(0xfe7f18ff).into()),
|
||||
("constructor".into(), rgba(0x83a598ff).into()),
|
||||
("punctuation".into(), rgba(0xd5c4a1ff).into()),
|
||||
("link_uri".into(), rgba(0xd3869bff).into()),
|
||||
("hint".into(), rgba(0x8c957dff).into()),
|
||||
("string.regex".into(), rgba(0xfe7f18ff).into()),
|
||||
("punctuation.delimiter".into(), rgba(0xe5d5adff).into()),
|
||||
("string".into(), rgba(0xb8bb25ff).into()),
|
||||
("punctuation.special".into(), rgba(0xe5d5adff).into()),
|
||||
("link_text".into(), rgba(0x8ec07cff).into()),
|
||||
("tag".into(), rgba(0x8ec07cff).into()),
|
||||
("string.escape".into(), rgba(0xc6b697ff).into()),
|
||||
("label".into(), rgba(0x83a598ff).into()),
|
||||
("constant".into(), rgba(0xfabd2eff).into()),
|
||||
("type".into(), rgba(0xfabd2eff).into()),
|
||||
("number".into(), rgba(0xd3869bff).into()),
|
||||
("string.special".into(), rgba(0xd3869bff).into()),
|
||||
("function.builtin".into(), rgba(0xfb4833ff).into()),
|
||||
("boolean".into(), rgba(0xd3869bff).into()),
|
||||
("embedded".into(), rgba(0x8ec07cff).into()),
|
||||
("title".into(), rgba(0xb8bb25ff).into()),
|
||||
("function".into(), rgba(0xb8bb25ff).into()),
|
||||
("punctuation.bracket".into(), rgba(0xa89984ff).into()),
|
||||
("comment".into(), rgba(0xa89984ff).into()),
|
||||
("preproc".into(), rgba(0xfbf1c7ff).into()),
|
||||
("predictive".into(), rgba(0x717363ff).into()),
|
||||
("punctuation.list_marker".into(), rgba(0xebdbb2ff).into()),
|
||||
],
|
||||
},
|
||||
status_bar: rgba(0x4c4642ff).into(),
|
||||
title_bar: rgba(0x4c4642ff).into(),
|
||||
toolbar: rgba(0x282828ff).into(),
|
||||
tab_bar: rgba(0x3a3735ff).into(),
|
||||
editor: rgba(0x282828ff).into(),
|
||||
editor_subheader: rgba(0x3a3735ff).into(),
|
||||
editor_active_line: rgba(0x3a3735ff).into(),
|
||||
terminal: rgba(0x282828ff).into(),
|
||||
image_fallback_background: rgba(0x4c4642ff).into(),
|
||||
git_created: rgba(0xb7bb26ff).into(),
|
||||
git_modified: rgba(0x83a598ff).into(),
|
||||
git_deleted: rgba(0xfb4a35ff).into(),
|
||||
git_conflict: rgba(0xf9bd2fff).into(),
|
||||
git_ignored: rgba(0x998b78ff).into(),
|
||||
git_renamed: rgba(0xf9bd2fff).into(),
|
||||
players: [
|
||||
PlayerTheme {
|
||||
cursor: rgba(0x83a598ff).into(),
|
||||
selection: rgba(0x83a5983d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0xb7bb26ff).into(),
|
||||
selection: rgba(0xb7bb263d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0xa89984ff).into(),
|
||||
selection: rgba(0xa899843d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0xfd801bff).into(),
|
||||
selection: rgba(0xfd801b3d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0xd3869bff).into(),
|
||||
selection: rgba(0xd3869b3d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0x8ec07cff).into(),
|
||||
selection: rgba(0x8ec07c3d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0xfb4a35ff).into(),
|
||||
selection: rgba(0xfb4a353d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0xf9bd2fff).into(),
|
||||
selection: rgba(0xf9bd2f3d).into(),
|
||||
},
|
||||
],
|
||||
}
|
||||
}
|
||||
@@ -1,131 +0,0 @@
|
||||
use gpui2::rgba;
|
||||
|
||||
use crate::{PlayerTheme, SyntaxTheme, Theme, ThemeMetadata};
|
||||
|
||||
pub fn gruvbox_dark_hard() -> Theme {
|
||||
Theme {
|
||||
metadata: ThemeMetadata {
|
||||
name: "Gruvbox Dark Hard".into(),
|
||||
is_light: false,
|
||||
},
|
||||
transparent: rgba(0x00000000).into(),
|
||||
mac_os_traffic_light_red: rgba(0xec695eff).into(),
|
||||
mac_os_traffic_light_yellow: rgba(0xf4bf4eff).into(),
|
||||
mac_os_traffic_light_green: rgba(0x61c553ff).into(),
|
||||
border: rgba(0x5b534dff).into(),
|
||||
border_variant: rgba(0x5b534dff).into(),
|
||||
border_focused: rgba(0x303a36ff).into(),
|
||||
border_transparent: rgba(0x00000000).into(),
|
||||
elevated_surface: rgba(0x4c4642ff).into(),
|
||||
surface: rgba(0x393634ff).into(),
|
||||
background: rgba(0x4c4642ff).into(),
|
||||
filled_element: rgba(0x4c4642ff).into(),
|
||||
filled_element_hover: rgba(0xffffff1e).into(),
|
||||
filled_element_active: rgba(0xffffff28).into(),
|
||||
filled_element_selected: rgba(0x1e2321ff).into(),
|
||||
filled_element_disabled: rgba(0x00000000).into(),
|
||||
ghost_element: rgba(0x00000000).into(),
|
||||
ghost_element_hover: rgba(0xffffff14).into(),
|
||||
ghost_element_active: rgba(0xffffff1e).into(),
|
||||
ghost_element_selected: rgba(0x1e2321ff).into(),
|
||||
ghost_element_disabled: rgba(0x00000000).into(),
|
||||
text: rgba(0xfbf1c7ff).into(),
|
||||
text_muted: rgba(0xc5b597ff).into(),
|
||||
text_placeholder: rgba(0xfb4a35ff).into(),
|
||||
text_disabled: rgba(0x998b78ff).into(),
|
||||
text_accent: rgba(0x83a598ff).into(),
|
||||
icon_muted: rgba(0xc5b597ff).into(),
|
||||
syntax: SyntaxTheme {
|
||||
highlights: vec![
|
||||
("primary".into(), rgba(0xebdbb2ff).into()),
|
||||
("label".into(), rgba(0x83a598ff).into()),
|
||||
("punctuation.delimiter".into(), rgba(0xe5d5adff).into()),
|
||||
("variant".into(), rgba(0x83a598ff).into()),
|
||||
("type".into(), rgba(0xfabd2eff).into()),
|
||||
("string.regex".into(), rgba(0xfe7f18ff).into()),
|
||||
("function.builtin".into(), rgba(0xfb4833ff).into()),
|
||||
("title".into(), rgba(0xb8bb25ff).into()),
|
||||
("string".into(), rgba(0xb8bb25ff).into()),
|
||||
("operator".into(), rgba(0x8ec07cff).into()),
|
||||
("embedded".into(), rgba(0x8ec07cff).into()),
|
||||
("punctuation.bracket".into(), rgba(0xa89984ff).into()),
|
||||
("string.special".into(), rgba(0xd3869bff).into()),
|
||||
("attribute".into(), rgba(0x83a598ff).into()),
|
||||
("comment".into(), rgba(0xa89984ff).into()),
|
||||
("link_text".into(), rgba(0x8ec07cff).into()),
|
||||
("punctuation.special".into(), rgba(0xe5d5adff).into()),
|
||||
("punctuation.list_marker".into(), rgba(0xebdbb2ff).into()),
|
||||
("comment.doc".into(), rgba(0xc6b697ff).into()),
|
||||
("preproc".into(), rgba(0xfbf1c7ff).into()),
|
||||
("text.literal".into(), rgba(0x83a598ff).into()),
|
||||
("function".into(), rgba(0xb8bb25ff).into()),
|
||||
("predictive".into(), rgba(0x717363ff).into()),
|
||||
("emphasis.strong".into(), rgba(0x83a598ff).into()),
|
||||
("punctuation".into(), rgba(0xd5c4a1ff).into()),
|
||||
("string.special.symbol".into(), rgba(0x8ec07cff).into()),
|
||||
("property".into(), rgba(0xebdbb2ff).into()),
|
||||
("keyword".into(), rgba(0xfb4833ff).into()),
|
||||
("constructor".into(), rgba(0x83a598ff).into()),
|
||||
("tag".into(), rgba(0x8ec07cff).into()),
|
||||
("variable".into(), rgba(0x83a598ff).into()),
|
||||
("enum".into(), rgba(0xfe7f18ff).into()),
|
||||
("hint".into(), rgba(0x8c957dff).into()),
|
||||
("number".into(), rgba(0xd3869bff).into()),
|
||||
("constant".into(), rgba(0xfabd2eff).into()),
|
||||
("boolean".into(), rgba(0xd3869bff).into()),
|
||||
("link_uri".into(), rgba(0xd3869bff).into()),
|
||||
("string.escape".into(), rgba(0xc6b697ff).into()),
|
||||
("emphasis".into(), rgba(0x83a598ff).into()),
|
||||
],
|
||||
},
|
||||
status_bar: rgba(0x4c4642ff).into(),
|
||||
title_bar: rgba(0x4c4642ff).into(),
|
||||
toolbar: rgba(0x1d2021ff).into(),
|
||||
tab_bar: rgba(0x393634ff).into(),
|
||||
editor: rgba(0x1d2021ff).into(),
|
||||
editor_subheader: rgba(0x393634ff).into(),
|
||||
editor_active_line: rgba(0x393634ff).into(),
|
||||
terminal: rgba(0x1d2021ff).into(),
|
||||
image_fallback_background: rgba(0x4c4642ff).into(),
|
||||
git_created: rgba(0xb7bb26ff).into(),
|
||||
git_modified: rgba(0x83a598ff).into(),
|
||||
git_deleted: rgba(0xfb4a35ff).into(),
|
||||
git_conflict: rgba(0xf9bd2fff).into(),
|
||||
git_ignored: rgba(0x998b78ff).into(),
|
||||
git_renamed: rgba(0xf9bd2fff).into(),
|
||||
players: [
|
||||
PlayerTheme {
|
||||
cursor: rgba(0x83a598ff).into(),
|
||||
selection: rgba(0x83a5983d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0xb7bb26ff).into(),
|
||||
selection: rgba(0xb7bb263d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0xa89984ff).into(),
|
||||
selection: rgba(0xa899843d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0xfd801bff).into(),
|
||||
selection: rgba(0xfd801b3d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0xd3869bff).into(),
|
||||
selection: rgba(0xd3869b3d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0x8ec07cff).into(),
|
||||
selection: rgba(0x8ec07c3d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0xfb4a35ff).into(),
|
||||
selection: rgba(0xfb4a353d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0xf9bd2fff).into(),
|
||||
selection: rgba(0xf9bd2f3d).into(),
|
||||
},
|
||||
],
|
||||
}
|
||||
}
|
||||
@@ -1,131 +0,0 @@
|
||||
use gpui2::rgba;
|
||||
|
||||
use crate::{PlayerTheme, SyntaxTheme, Theme, ThemeMetadata};
|
||||
|
||||
pub fn gruvbox_dark_soft() -> Theme {
|
||||
Theme {
|
||||
metadata: ThemeMetadata {
|
||||
name: "Gruvbox Dark Soft".into(),
|
||||
is_light: false,
|
||||
},
|
||||
transparent: rgba(0x00000000).into(),
|
||||
mac_os_traffic_light_red: rgba(0xec695eff).into(),
|
||||
mac_os_traffic_light_yellow: rgba(0xf4bf4eff).into(),
|
||||
mac_os_traffic_light_green: rgba(0x61c553ff).into(),
|
||||
border: rgba(0x5b534dff).into(),
|
||||
border_variant: rgba(0x5b534dff).into(),
|
||||
border_focused: rgba(0x303a36ff).into(),
|
||||
border_transparent: rgba(0x00000000).into(),
|
||||
elevated_surface: rgba(0x4c4642ff).into(),
|
||||
surface: rgba(0x3b3735ff).into(),
|
||||
background: rgba(0x4c4642ff).into(),
|
||||
filled_element: rgba(0x4c4642ff).into(),
|
||||
filled_element_hover: rgba(0xffffff1e).into(),
|
||||
filled_element_active: rgba(0xffffff28).into(),
|
||||
filled_element_selected: rgba(0x1e2321ff).into(),
|
||||
filled_element_disabled: rgba(0x00000000).into(),
|
||||
ghost_element: rgba(0x00000000).into(),
|
||||
ghost_element_hover: rgba(0xffffff14).into(),
|
||||
ghost_element_active: rgba(0xffffff1e).into(),
|
||||
ghost_element_selected: rgba(0x1e2321ff).into(),
|
||||
ghost_element_disabled: rgba(0x00000000).into(),
|
||||
text: rgba(0xfbf1c7ff).into(),
|
||||
text_muted: rgba(0xc5b597ff).into(),
|
||||
text_placeholder: rgba(0xfb4a35ff).into(),
|
||||
text_disabled: rgba(0x998b78ff).into(),
|
||||
text_accent: rgba(0x83a598ff).into(),
|
||||
icon_muted: rgba(0xc5b597ff).into(),
|
||||
syntax: SyntaxTheme {
|
||||
highlights: vec![
|
||||
("punctuation.special".into(), rgba(0xe5d5adff).into()),
|
||||
("attribute".into(), rgba(0x83a598ff).into()),
|
||||
("preproc".into(), rgba(0xfbf1c7ff).into()),
|
||||
("keyword".into(), rgba(0xfb4833ff).into()),
|
||||
("emphasis".into(), rgba(0x83a598ff).into()),
|
||||
("punctuation.delimiter".into(), rgba(0xe5d5adff).into()),
|
||||
("punctuation.bracket".into(), rgba(0xa89984ff).into()),
|
||||
("comment".into(), rgba(0xa89984ff).into()),
|
||||
("text.literal".into(), rgba(0x83a598ff).into()),
|
||||
("predictive".into(), rgba(0x717363ff).into()),
|
||||
("link_text".into(), rgba(0x8ec07cff).into()),
|
||||
("variant".into(), rgba(0x83a598ff).into()),
|
||||
("label".into(), rgba(0x83a598ff).into()),
|
||||
("function".into(), rgba(0xb8bb25ff).into()),
|
||||
("string.regex".into(), rgba(0xfe7f18ff).into()),
|
||||
("boolean".into(), rgba(0xd3869bff).into()),
|
||||
("number".into(), rgba(0xd3869bff).into()),
|
||||
("string.escape".into(), rgba(0xc6b697ff).into()),
|
||||
("constructor".into(), rgba(0x83a598ff).into()),
|
||||
("link_uri".into(), rgba(0xd3869bff).into()),
|
||||
("string.special.symbol".into(), rgba(0x8ec07cff).into()),
|
||||
("type".into(), rgba(0xfabd2eff).into()),
|
||||
("function.builtin".into(), rgba(0xfb4833ff).into()),
|
||||
("title".into(), rgba(0xb8bb25ff).into()),
|
||||
("primary".into(), rgba(0xebdbb2ff).into()),
|
||||
("tag".into(), rgba(0x8ec07cff).into()),
|
||||
("constant".into(), rgba(0xfabd2eff).into()),
|
||||
("emphasis.strong".into(), rgba(0x83a598ff).into()),
|
||||
("string.special".into(), rgba(0xd3869bff).into()),
|
||||
("hint".into(), rgba(0x8c957dff).into()),
|
||||
("comment.doc".into(), rgba(0xc6b697ff).into()),
|
||||
("property".into(), rgba(0xebdbb2ff).into()),
|
||||
("embedded".into(), rgba(0x8ec07cff).into()),
|
||||
("operator".into(), rgba(0x8ec07cff).into()),
|
||||
("punctuation".into(), rgba(0xd5c4a1ff).into()),
|
||||
("variable".into(), rgba(0x83a598ff).into()),
|
||||
("enum".into(), rgba(0xfe7f18ff).into()),
|
||||
("punctuation.list_marker".into(), rgba(0xebdbb2ff).into()),
|
||||
("string".into(), rgba(0xb8bb25ff).into()),
|
||||
],
|
||||
},
|
||||
status_bar: rgba(0x4c4642ff).into(),
|
||||
title_bar: rgba(0x4c4642ff).into(),
|
||||
toolbar: rgba(0x32302fff).into(),
|
||||
tab_bar: rgba(0x3b3735ff).into(),
|
||||
editor: rgba(0x32302fff).into(),
|
||||
editor_subheader: rgba(0x3b3735ff).into(),
|
||||
editor_active_line: rgba(0x3b3735ff).into(),
|
||||
terminal: rgba(0x32302fff).into(),
|
||||
image_fallback_background: rgba(0x4c4642ff).into(),
|
||||
git_created: rgba(0xb7bb26ff).into(),
|
||||
git_modified: rgba(0x83a598ff).into(),
|
||||
git_deleted: rgba(0xfb4a35ff).into(),
|
||||
git_conflict: rgba(0xf9bd2fff).into(),
|
||||
git_ignored: rgba(0x998b78ff).into(),
|
||||
git_renamed: rgba(0xf9bd2fff).into(),
|
||||
players: [
|
||||
PlayerTheme {
|
||||
cursor: rgba(0x83a598ff).into(),
|
||||
selection: rgba(0x83a5983d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0xb7bb26ff).into(),
|
||||
selection: rgba(0xb7bb263d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0xa89984ff).into(),
|
||||
selection: rgba(0xa899843d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0xfd801bff).into(),
|
||||
selection: rgba(0xfd801b3d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0xd3869bff).into(),
|
||||
selection: rgba(0xd3869b3d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0x8ec07cff).into(),
|
||||
selection: rgba(0x8ec07c3d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0xfb4a35ff).into(),
|
||||
selection: rgba(0xfb4a353d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0xf9bd2fff).into(),
|
||||
selection: rgba(0xf9bd2f3d).into(),
|
||||
},
|
||||
],
|
||||
}
|
||||
}
|
||||
@@ -1,131 +0,0 @@
|
||||
use gpui2::rgba;
|
||||
|
||||
use crate::{PlayerTheme, SyntaxTheme, Theme, ThemeMetadata};
|
||||
|
||||
pub fn gruvbox_light() -> Theme {
|
||||
Theme {
|
||||
metadata: ThemeMetadata {
|
||||
name: "Gruvbox Light".into(),
|
||||
is_light: true,
|
||||
},
|
||||
transparent: rgba(0x00000000).into(),
|
||||
mac_os_traffic_light_red: rgba(0xec695eff).into(),
|
||||
mac_os_traffic_light_yellow: rgba(0xf4bf4eff).into(),
|
||||
mac_os_traffic_light_green: rgba(0x61c553ff).into(),
|
||||
border: rgba(0xc8b899ff).into(),
|
||||
border_variant: rgba(0xc8b899ff).into(),
|
||||
border_focused: rgba(0xadc5ccff).into(),
|
||||
border_transparent: rgba(0x00000000).into(),
|
||||
elevated_surface: rgba(0xd9c8a4ff).into(),
|
||||
surface: rgba(0xecddb4ff).into(),
|
||||
background: rgba(0xd9c8a4ff).into(),
|
||||
filled_element: rgba(0xd9c8a4ff).into(),
|
||||
filled_element_hover: rgba(0xffffff1e).into(),
|
||||
filled_element_active: rgba(0xffffff28).into(),
|
||||
filled_element_selected: rgba(0xd2dee2ff).into(),
|
||||
filled_element_disabled: rgba(0x00000000).into(),
|
||||
ghost_element: rgba(0x00000000).into(),
|
||||
ghost_element_hover: rgba(0xffffff14).into(),
|
||||
ghost_element_active: rgba(0xffffff1e).into(),
|
||||
ghost_element_selected: rgba(0xd2dee2ff).into(),
|
||||
ghost_element_disabled: rgba(0x00000000).into(),
|
||||
text: rgba(0x282828ff).into(),
|
||||
text_muted: rgba(0x5f5650ff).into(),
|
||||
text_placeholder: rgba(0x9d0308ff).into(),
|
||||
text_disabled: rgba(0x897b6eff).into(),
|
||||
text_accent: rgba(0x0b6678ff).into(),
|
||||
icon_muted: rgba(0x5f5650ff).into(),
|
||||
syntax: SyntaxTheme {
|
||||
highlights: vec![
|
||||
("number".into(), rgba(0x8f3e71ff).into()),
|
||||
("link_text".into(), rgba(0x427b58ff).into()),
|
||||
("string.special".into(), rgba(0x8f3e71ff).into()),
|
||||
("string.special.symbol".into(), rgba(0x427b58ff).into()),
|
||||
("function".into(), rgba(0x79740eff).into()),
|
||||
("title".into(), rgba(0x79740eff).into()),
|
||||
("emphasis".into(), rgba(0x0b6678ff).into()),
|
||||
("punctuation".into(), rgba(0x3c3836ff).into()),
|
||||
("string.escape".into(), rgba(0x5d544eff).into()),
|
||||
("type".into(), rgba(0xb57613ff).into()),
|
||||
("string".into(), rgba(0x79740eff).into()),
|
||||
("keyword".into(), rgba(0x9d0006ff).into()),
|
||||
("tag".into(), rgba(0x427b58ff).into()),
|
||||
("primary".into(), rgba(0x282828ff).into()),
|
||||
("link_uri".into(), rgba(0x8f3e71ff).into()),
|
||||
("comment.doc".into(), rgba(0x5d544eff).into()),
|
||||
("boolean".into(), rgba(0x8f3e71ff).into()),
|
||||
("embedded".into(), rgba(0x427b58ff).into()),
|
||||
("hint".into(), rgba(0x677562ff).into()),
|
||||
("emphasis.strong".into(), rgba(0x0b6678ff).into()),
|
||||
("operator".into(), rgba(0x427b58ff).into()),
|
||||
("label".into(), rgba(0x0b6678ff).into()),
|
||||
("comment".into(), rgba(0x7c6f64ff).into()),
|
||||
("function.builtin".into(), rgba(0x9d0006ff).into()),
|
||||
("punctuation.bracket".into(), rgba(0x665c54ff).into()),
|
||||
("text.literal".into(), rgba(0x066578ff).into()),
|
||||
("string.regex".into(), rgba(0xaf3a02ff).into()),
|
||||
("property".into(), rgba(0x282828ff).into()),
|
||||
("attribute".into(), rgba(0x0b6678ff).into()),
|
||||
("punctuation.delimiter".into(), rgba(0x413d3aff).into()),
|
||||
("constructor".into(), rgba(0x0b6678ff).into()),
|
||||
("variable".into(), rgba(0x066578ff).into()),
|
||||
("constant".into(), rgba(0xb57613ff).into()),
|
||||
("preproc".into(), rgba(0x282828ff).into()),
|
||||
("punctuation.special".into(), rgba(0x413d3aff).into()),
|
||||
("punctuation.list_marker".into(), rgba(0x282828ff).into()),
|
||||
("variant".into(), rgba(0x0b6678ff).into()),
|
||||
("predictive".into(), rgba(0x7c9780ff).into()),
|
||||
("enum".into(), rgba(0xaf3a02ff).into()),
|
||||
],
|
||||
},
|
||||
status_bar: rgba(0xd9c8a4ff).into(),
|
||||
title_bar: rgba(0xd9c8a4ff).into(),
|
||||
toolbar: rgba(0xfbf1c7ff).into(),
|
||||
tab_bar: rgba(0xecddb4ff).into(),
|
||||
editor: rgba(0xfbf1c7ff).into(),
|
||||
editor_subheader: rgba(0xecddb4ff).into(),
|
||||
editor_active_line: rgba(0xecddb4ff).into(),
|
||||
terminal: rgba(0xfbf1c7ff).into(),
|
||||
image_fallback_background: rgba(0xd9c8a4ff).into(),
|
||||
git_created: rgba(0x797410ff).into(),
|
||||
git_modified: rgba(0x0b6678ff).into(),
|
||||
git_deleted: rgba(0x9d0308ff).into(),
|
||||
git_conflict: rgba(0xb57615ff).into(),
|
||||
git_ignored: rgba(0x897b6eff).into(),
|
||||
git_renamed: rgba(0xb57615ff).into(),
|
||||
players: [
|
||||
PlayerTheme {
|
||||
cursor: rgba(0x0b6678ff).into(),
|
||||
selection: rgba(0x0b66783d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0x797410ff).into(),
|
||||
selection: rgba(0x7974103d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0x7c6f64ff).into(),
|
||||
selection: rgba(0x7c6f643d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0xaf3a04ff).into(),
|
||||
selection: rgba(0xaf3a043d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0x8f3f70ff).into(),
|
||||
selection: rgba(0x8f3f703d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0x437b59ff).into(),
|
||||
selection: rgba(0x437b593d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0x9d0308ff).into(),
|
||||
selection: rgba(0x9d03083d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0xb57615ff).into(),
|
||||
selection: rgba(0xb576153d).into(),
|
||||
},
|
||||
],
|
||||
}
|
||||
}
|
||||
@@ -1,131 +0,0 @@
|
||||
use gpui2::rgba;
|
||||
|
||||
use crate::{PlayerTheme, SyntaxTheme, Theme, ThemeMetadata};
|
||||
|
||||
pub fn gruvbox_light_hard() -> Theme {
|
||||
Theme {
|
||||
metadata: ThemeMetadata {
|
||||
name: "Gruvbox Light Hard".into(),
|
||||
is_light: true,
|
||||
},
|
||||
transparent: rgba(0x00000000).into(),
|
||||
mac_os_traffic_light_red: rgba(0xec695eff).into(),
|
||||
mac_os_traffic_light_yellow: rgba(0xf4bf4eff).into(),
|
||||
mac_os_traffic_light_green: rgba(0x61c553ff).into(),
|
||||
border: rgba(0xc8b899ff).into(),
|
||||
border_variant: rgba(0xc8b899ff).into(),
|
||||
border_focused: rgba(0xadc5ccff).into(),
|
||||
border_transparent: rgba(0x00000000).into(),
|
||||
elevated_surface: rgba(0xd9c8a4ff).into(),
|
||||
surface: rgba(0xecddb5ff).into(),
|
||||
background: rgba(0xd9c8a4ff).into(),
|
||||
filled_element: rgba(0xd9c8a4ff).into(),
|
||||
filled_element_hover: rgba(0xffffff1e).into(),
|
||||
filled_element_active: rgba(0xffffff28).into(),
|
||||
filled_element_selected: rgba(0xd2dee2ff).into(),
|
||||
filled_element_disabled: rgba(0x00000000).into(),
|
||||
ghost_element: rgba(0x00000000).into(),
|
||||
ghost_element_hover: rgba(0xffffff14).into(),
|
||||
ghost_element_active: rgba(0xffffff1e).into(),
|
||||
ghost_element_selected: rgba(0xd2dee2ff).into(),
|
||||
ghost_element_disabled: rgba(0x00000000).into(),
|
||||
text: rgba(0x282828ff).into(),
|
||||
text_muted: rgba(0x5f5650ff).into(),
|
||||
text_placeholder: rgba(0x9d0308ff).into(),
|
||||
text_disabled: rgba(0x897b6eff).into(),
|
||||
text_accent: rgba(0x0b6678ff).into(),
|
||||
icon_muted: rgba(0x5f5650ff).into(),
|
||||
syntax: SyntaxTheme {
|
||||
highlights: vec![
|
||||
("label".into(), rgba(0x0b6678ff).into()),
|
||||
("hint".into(), rgba(0x677562ff).into()),
|
||||
("boolean".into(), rgba(0x8f3e71ff).into()),
|
||||
("function.builtin".into(), rgba(0x9d0006ff).into()),
|
||||
("constant".into(), rgba(0xb57613ff).into()),
|
||||
("preproc".into(), rgba(0x282828ff).into()),
|
||||
("predictive".into(), rgba(0x7c9780ff).into()),
|
||||
("string".into(), rgba(0x79740eff).into()),
|
||||
("comment.doc".into(), rgba(0x5d544eff).into()),
|
||||
("function".into(), rgba(0x79740eff).into()),
|
||||
("title".into(), rgba(0x79740eff).into()),
|
||||
("text.literal".into(), rgba(0x066578ff).into()),
|
||||
("punctuation.bracket".into(), rgba(0x665c54ff).into()),
|
||||
("string.escape".into(), rgba(0x5d544eff).into()),
|
||||
("punctuation.delimiter".into(), rgba(0x413d3aff).into()),
|
||||
("string.special.symbol".into(), rgba(0x427b58ff).into()),
|
||||
("type".into(), rgba(0xb57613ff).into()),
|
||||
("constructor".into(), rgba(0x0b6678ff).into()),
|
||||
("property".into(), rgba(0x282828ff).into()),
|
||||
("comment".into(), rgba(0x7c6f64ff).into()),
|
||||
("enum".into(), rgba(0xaf3a02ff).into()),
|
||||
("emphasis".into(), rgba(0x0b6678ff).into()),
|
||||
("embedded".into(), rgba(0x427b58ff).into()),
|
||||
("operator".into(), rgba(0x427b58ff).into()),
|
||||
("attribute".into(), rgba(0x0b6678ff).into()),
|
||||
("emphasis.strong".into(), rgba(0x0b6678ff).into()),
|
||||
("link_text".into(), rgba(0x427b58ff).into()),
|
||||
("punctuation.special".into(), rgba(0x413d3aff).into()),
|
||||
("punctuation.list_marker".into(), rgba(0x282828ff).into()),
|
||||
("variant".into(), rgba(0x0b6678ff).into()),
|
||||
("primary".into(), rgba(0x282828ff).into()),
|
||||
("number".into(), rgba(0x8f3e71ff).into()),
|
||||
("tag".into(), rgba(0x427b58ff).into()),
|
||||
("keyword".into(), rgba(0x9d0006ff).into()),
|
||||
("link_uri".into(), rgba(0x8f3e71ff).into()),
|
||||
("string.regex".into(), rgba(0xaf3a02ff).into()),
|
||||
("variable".into(), rgba(0x066578ff).into()),
|
||||
("string.special".into(), rgba(0x8f3e71ff).into()),
|
||||
("punctuation".into(), rgba(0x3c3836ff).into()),
|
||||
],
|
||||
},
|
||||
status_bar: rgba(0xd9c8a4ff).into(),
|
||||
title_bar: rgba(0xd9c8a4ff).into(),
|
||||
toolbar: rgba(0xf9f5d7ff).into(),
|
||||
tab_bar: rgba(0xecddb5ff).into(),
|
||||
editor: rgba(0xf9f5d7ff).into(),
|
||||
editor_subheader: rgba(0xecddb5ff).into(),
|
||||
editor_active_line: rgba(0xecddb5ff).into(),
|
||||
terminal: rgba(0xf9f5d7ff).into(),
|
||||
image_fallback_background: rgba(0xd9c8a4ff).into(),
|
||||
git_created: rgba(0x797410ff).into(),
|
||||
git_modified: rgba(0x0b6678ff).into(),
|
||||
git_deleted: rgba(0x9d0308ff).into(),
|
||||
git_conflict: rgba(0xb57615ff).into(),
|
||||
git_ignored: rgba(0x897b6eff).into(),
|
||||
git_renamed: rgba(0xb57615ff).into(),
|
||||
players: [
|
||||
PlayerTheme {
|
||||
cursor: rgba(0x0b6678ff).into(),
|
||||
selection: rgba(0x0b66783d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0x797410ff).into(),
|
||||
selection: rgba(0x7974103d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0x7c6f64ff).into(),
|
||||
selection: rgba(0x7c6f643d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0xaf3a04ff).into(),
|
||||
selection: rgba(0xaf3a043d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0x8f3f70ff).into(),
|
||||
selection: rgba(0x8f3f703d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0x437b59ff).into(),
|
||||
selection: rgba(0x437b593d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0x9d0308ff).into(),
|
||||
selection: rgba(0x9d03083d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0xb57615ff).into(),
|
||||
selection: rgba(0xb576153d).into(),
|
||||
},
|
||||
],
|
||||
}
|
||||
}
|
||||
@@ -1,131 +0,0 @@
|
||||
use gpui2::rgba;
|
||||
|
||||
use crate::{PlayerTheme, SyntaxTheme, Theme, ThemeMetadata};
|
||||
|
||||
pub fn gruvbox_light_soft() -> Theme {
|
||||
Theme {
|
||||
metadata: ThemeMetadata {
|
||||
name: "Gruvbox Light Soft".into(),
|
||||
is_light: true,
|
||||
},
|
||||
transparent: rgba(0x00000000).into(),
|
||||
mac_os_traffic_light_red: rgba(0xec695eff).into(),
|
||||
mac_os_traffic_light_yellow: rgba(0xf4bf4eff).into(),
|
||||
mac_os_traffic_light_green: rgba(0x61c553ff).into(),
|
||||
border: rgba(0xc8b899ff).into(),
|
||||
border_variant: rgba(0xc8b899ff).into(),
|
||||
border_focused: rgba(0xadc5ccff).into(),
|
||||
border_transparent: rgba(0x00000000).into(),
|
||||
elevated_surface: rgba(0xd9c8a4ff).into(),
|
||||
surface: rgba(0xecdcb3ff).into(),
|
||||
background: rgba(0xd9c8a4ff).into(),
|
||||
filled_element: rgba(0xd9c8a4ff).into(),
|
||||
filled_element_hover: rgba(0xffffff1e).into(),
|
||||
filled_element_active: rgba(0xffffff28).into(),
|
||||
filled_element_selected: rgba(0xd2dee2ff).into(),
|
||||
filled_element_disabled: rgba(0x00000000).into(),
|
||||
ghost_element: rgba(0x00000000).into(),
|
||||
ghost_element_hover: rgba(0xffffff14).into(),
|
||||
ghost_element_active: rgba(0xffffff1e).into(),
|
||||
ghost_element_selected: rgba(0xd2dee2ff).into(),
|
||||
ghost_element_disabled: rgba(0x00000000).into(),
|
||||
text: rgba(0x282828ff).into(),
|
||||
text_muted: rgba(0x5f5650ff).into(),
|
||||
text_placeholder: rgba(0x9d0308ff).into(),
|
||||
text_disabled: rgba(0x897b6eff).into(),
|
||||
text_accent: rgba(0x0b6678ff).into(),
|
||||
icon_muted: rgba(0x5f5650ff).into(),
|
||||
syntax: SyntaxTheme {
|
||||
highlights: vec![
|
||||
("preproc".into(), rgba(0x282828ff).into()),
|
||||
("punctuation.list_marker".into(), rgba(0x282828ff).into()),
|
||||
("string".into(), rgba(0x79740eff).into()),
|
||||
("constant".into(), rgba(0xb57613ff).into()),
|
||||
("keyword".into(), rgba(0x9d0006ff).into()),
|
||||
("string.special.symbol".into(), rgba(0x427b58ff).into()),
|
||||
("comment.doc".into(), rgba(0x5d544eff).into()),
|
||||
("hint".into(), rgba(0x677562ff).into()),
|
||||
("number".into(), rgba(0x8f3e71ff).into()),
|
||||
("enum".into(), rgba(0xaf3a02ff).into()),
|
||||
("emphasis".into(), rgba(0x0b6678ff).into()),
|
||||
("operator".into(), rgba(0x427b58ff).into()),
|
||||
("comment".into(), rgba(0x7c6f64ff).into()),
|
||||
("embedded".into(), rgba(0x427b58ff).into()),
|
||||
("type".into(), rgba(0xb57613ff).into()),
|
||||
("title".into(), rgba(0x79740eff).into()),
|
||||
("constructor".into(), rgba(0x0b6678ff).into()),
|
||||
("punctuation.delimiter".into(), rgba(0x413d3aff).into()),
|
||||
("function".into(), rgba(0x79740eff).into()),
|
||||
("link_uri".into(), rgba(0x8f3e71ff).into()),
|
||||
("emphasis.strong".into(), rgba(0x0b6678ff).into()),
|
||||
("boolean".into(), rgba(0x8f3e71ff).into()),
|
||||
("function.builtin".into(), rgba(0x9d0006ff).into()),
|
||||
("predictive".into(), rgba(0x7c9780ff).into()),
|
||||
("string.regex".into(), rgba(0xaf3a02ff).into()),
|
||||
("tag".into(), rgba(0x427b58ff).into()),
|
||||
("text.literal".into(), rgba(0x066578ff).into()),
|
||||
("punctuation".into(), rgba(0x3c3836ff).into()),
|
||||
("punctuation.bracket".into(), rgba(0x665c54ff).into()),
|
||||
("variable".into(), rgba(0x066578ff).into()),
|
||||
("attribute".into(), rgba(0x0b6678ff).into()),
|
||||
("string.special".into(), rgba(0x8f3e71ff).into()),
|
||||
("label".into(), rgba(0x0b6678ff).into()),
|
||||
("string.escape".into(), rgba(0x5d544eff).into()),
|
||||
("link_text".into(), rgba(0x427b58ff).into()),
|
||||
("punctuation.special".into(), rgba(0x413d3aff).into()),
|
||||
("property".into(), rgba(0x282828ff).into()),
|
||||
("variant".into(), rgba(0x0b6678ff).into()),
|
||||
("primary".into(), rgba(0x282828ff).into()),
|
||||
],
|
||||
},
|
||||
status_bar: rgba(0xd9c8a4ff).into(),
|
||||
title_bar: rgba(0xd9c8a4ff).into(),
|
||||
toolbar: rgba(0xf2e5bcff).into(),
|
||||
tab_bar: rgba(0xecdcb3ff).into(),
|
||||
editor: rgba(0xf2e5bcff).into(),
|
||||
editor_subheader: rgba(0xecdcb3ff).into(),
|
||||
editor_active_line: rgba(0xecdcb3ff).into(),
|
||||
terminal: rgba(0xf2e5bcff).into(),
|
||||
image_fallback_background: rgba(0xd9c8a4ff).into(),
|
||||
git_created: rgba(0x797410ff).into(),
|
||||
git_modified: rgba(0x0b6678ff).into(),
|
||||
git_deleted: rgba(0x9d0308ff).into(),
|
||||
git_conflict: rgba(0xb57615ff).into(),
|
||||
git_ignored: rgba(0x897b6eff).into(),
|
||||
git_renamed: rgba(0xb57615ff).into(),
|
||||
players: [
|
||||
PlayerTheme {
|
||||
cursor: rgba(0x0b6678ff).into(),
|
||||
selection: rgba(0x0b66783d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0x797410ff).into(),
|
||||
selection: rgba(0x7974103d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0x7c6f64ff).into(),
|
||||
selection: rgba(0x7c6f643d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0xaf3a04ff).into(),
|
||||
selection: rgba(0xaf3a043d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0x8f3f70ff).into(),
|
||||
selection: rgba(0x8f3f703d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0x437b59ff).into(),
|
||||
selection: rgba(0x437b593d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0x9d0308ff).into(),
|
||||
selection: rgba(0x9d03083d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0xb57615ff).into(),
|
||||
selection: rgba(0xb576153d).into(),
|
||||
},
|
||||
],
|
||||
}
|
||||
}
|
||||
@@ -1,79 +0,0 @@
|
||||
mod andromeda;
|
||||
mod atelier_cave_dark;
|
||||
mod atelier_cave_light;
|
||||
mod atelier_dune_dark;
|
||||
mod atelier_dune_light;
|
||||
mod atelier_estuary_dark;
|
||||
mod atelier_estuary_light;
|
||||
mod atelier_forest_dark;
|
||||
mod atelier_forest_light;
|
||||
mod atelier_heath_dark;
|
||||
mod atelier_heath_light;
|
||||
mod atelier_lakeside_dark;
|
||||
mod atelier_lakeside_light;
|
||||
mod atelier_plateau_dark;
|
||||
mod atelier_plateau_light;
|
||||
mod atelier_savanna_dark;
|
||||
mod atelier_savanna_light;
|
||||
mod atelier_seaside_dark;
|
||||
mod atelier_seaside_light;
|
||||
mod atelier_sulphurpool_dark;
|
||||
mod atelier_sulphurpool_light;
|
||||
mod ayu_dark;
|
||||
mod ayu_light;
|
||||
mod ayu_mirage;
|
||||
mod gruvbox_dark;
|
||||
mod gruvbox_dark_hard;
|
||||
mod gruvbox_dark_soft;
|
||||
mod gruvbox_light;
|
||||
mod gruvbox_light_hard;
|
||||
mod gruvbox_light_soft;
|
||||
mod one_dark;
|
||||
mod one_light;
|
||||
mod rose_pine;
|
||||
mod rose_pine_dawn;
|
||||
mod rose_pine_moon;
|
||||
mod sandcastle;
|
||||
mod solarized_dark;
|
||||
mod solarized_light;
|
||||
mod summercamp;
|
||||
|
||||
pub use andromeda::*;
|
||||
pub use atelier_cave_dark::*;
|
||||
pub use atelier_cave_light::*;
|
||||
pub use atelier_dune_dark::*;
|
||||
pub use atelier_dune_light::*;
|
||||
pub use atelier_estuary_dark::*;
|
||||
pub use atelier_estuary_light::*;
|
||||
pub use atelier_forest_dark::*;
|
||||
pub use atelier_forest_light::*;
|
||||
pub use atelier_heath_dark::*;
|
||||
pub use atelier_heath_light::*;
|
||||
pub use atelier_lakeside_dark::*;
|
||||
pub use atelier_lakeside_light::*;
|
||||
pub use atelier_plateau_dark::*;
|
||||
pub use atelier_plateau_light::*;
|
||||
pub use atelier_savanna_dark::*;
|
||||
pub use atelier_savanna_light::*;
|
||||
pub use atelier_seaside_dark::*;
|
||||
pub use atelier_seaside_light::*;
|
||||
pub use atelier_sulphurpool_dark::*;
|
||||
pub use atelier_sulphurpool_light::*;
|
||||
pub use ayu_dark::*;
|
||||
pub use ayu_light::*;
|
||||
pub use ayu_mirage::*;
|
||||
pub use gruvbox_dark::*;
|
||||
pub use gruvbox_dark_hard::*;
|
||||
pub use gruvbox_dark_soft::*;
|
||||
pub use gruvbox_light::*;
|
||||
pub use gruvbox_light_hard::*;
|
||||
pub use gruvbox_light_soft::*;
|
||||
pub use one_dark::*;
|
||||
pub use one_light::*;
|
||||
pub use rose_pine::*;
|
||||
pub use rose_pine_dawn::*;
|
||||
pub use rose_pine_moon::*;
|
||||
pub use sandcastle::*;
|
||||
pub use solarized_dark::*;
|
||||
pub use solarized_light::*;
|
||||
pub use summercamp::*;
|
||||
@@ -1,131 +0,0 @@
|
||||
use gpui2::rgba;
|
||||
|
||||
use crate::{PlayerTheme, SyntaxTheme, Theme, ThemeMetadata};
|
||||
|
||||
pub fn one_dark() -> Theme {
|
||||
Theme {
|
||||
metadata: ThemeMetadata {
|
||||
name: "One Dark".into(),
|
||||
is_light: false,
|
||||
},
|
||||
transparent: rgba(0x00000000).into(),
|
||||
mac_os_traffic_light_red: rgba(0xec695eff).into(),
|
||||
mac_os_traffic_light_yellow: rgba(0xf4bf4eff).into(),
|
||||
mac_os_traffic_light_green: rgba(0x61c553ff).into(),
|
||||
border: rgba(0x464b57ff).into(),
|
||||
border_variant: rgba(0x464b57ff).into(),
|
||||
border_focused: rgba(0x293b5bff).into(),
|
||||
border_transparent: rgba(0x00000000).into(),
|
||||
elevated_surface: rgba(0x3b414dff).into(),
|
||||
surface: rgba(0x2f343eff).into(),
|
||||
background: rgba(0x3b414dff).into(),
|
||||
filled_element: rgba(0x3b414dff).into(),
|
||||
filled_element_hover: rgba(0xffffff1e).into(),
|
||||
filled_element_active: rgba(0xffffff28).into(),
|
||||
filled_element_selected: rgba(0x18243dff).into(),
|
||||
filled_element_disabled: rgba(0x00000000).into(),
|
||||
ghost_element: rgba(0x00000000).into(),
|
||||
ghost_element_hover: rgba(0xffffff14).into(),
|
||||
ghost_element_active: rgba(0xffffff1e).into(),
|
||||
ghost_element_selected: rgba(0x18243dff).into(),
|
||||
ghost_element_disabled: rgba(0x00000000).into(),
|
||||
text: rgba(0xc8ccd4ff).into(),
|
||||
text_muted: rgba(0x838994ff).into(),
|
||||
text_placeholder: rgba(0xd07277ff).into(),
|
||||
text_disabled: rgba(0x555a63ff).into(),
|
||||
text_accent: rgba(0x74ade8ff).into(),
|
||||
icon_muted: rgba(0x838994ff).into(),
|
||||
syntax: SyntaxTheme {
|
||||
highlights: vec![
|
||||
("keyword".into(), rgba(0xb477cfff).into()),
|
||||
("comment.doc".into(), rgba(0x878e98ff).into()),
|
||||
("variant".into(), rgba(0x73ade9ff).into()),
|
||||
("property".into(), rgba(0xd07277ff).into()),
|
||||
("function".into(), rgba(0x73ade9ff).into()),
|
||||
("type".into(), rgba(0x6eb4bfff).into()),
|
||||
("tag".into(), rgba(0x74ade8ff).into()),
|
||||
("string.escape".into(), rgba(0x878e98ff).into()),
|
||||
("punctuation.bracket".into(), rgba(0xb2b9c6ff).into()),
|
||||
("hint".into(), rgba(0x5a6f89ff).into()),
|
||||
("punctuation".into(), rgba(0xacb2beff).into()),
|
||||
("comment".into(), rgba(0x5d636fff).into()),
|
||||
("emphasis".into(), rgba(0x74ade8ff).into()),
|
||||
("punctuation.special".into(), rgba(0xb1574bff).into()),
|
||||
("link_uri".into(), rgba(0x6eb4bfff).into()),
|
||||
("string.regex".into(), rgba(0xbf956aff).into()),
|
||||
("constructor".into(), rgba(0x73ade9ff).into()),
|
||||
("operator".into(), rgba(0x6eb4bfff).into()),
|
||||
("constant".into(), rgba(0xdfc184ff).into()),
|
||||
("string.special".into(), rgba(0xbf956aff).into()),
|
||||
("emphasis.strong".into(), rgba(0xbf956aff).into()),
|
||||
("string.special.symbol".into(), rgba(0xbf956aff).into()),
|
||||
("primary".into(), rgba(0xacb2beff).into()),
|
||||
("preproc".into(), rgba(0xc8ccd4ff).into()),
|
||||
("string".into(), rgba(0xa1c181ff).into()),
|
||||
("punctuation.delimiter".into(), rgba(0xb2b9c6ff).into()),
|
||||
("embedded".into(), rgba(0xc8ccd4ff).into()),
|
||||
("enum".into(), rgba(0xd07277ff).into()),
|
||||
("variable.special".into(), rgba(0xbf956aff).into()),
|
||||
("text.literal".into(), rgba(0xa1c181ff).into()),
|
||||
("attribute".into(), rgba(0x74ade8ff).into()),
|
||||
("link_text".into(), rgba(0x73ade9ff).into()),
|
||||
("title".into(), rgba(0xd07277ff).into()),
|
||||
("predictive".into(), rgba(0x5a6a87ff).into()),
|
||||
("number".into(), rgba(0xbf956aff).into()),
|
||||
("label".into(), rgba(0x74ade8ff).into()),
|
||||
("variable".into(), rgba(0xc8ccd4ff).into()),
|
||||
("boolean".into(), rgba(0xbf956aff).into()),
|
||||
("punctuation.list_marker".into(), rgba(0xd07277ff).into()),
|
||||
],
|
||||
},
|
||||
status_bar: rgba(0x3b414dff).into(),
|
||||
title_bar: rgba(0x3b414dff).into(),
|
||||
toolbar: rgba(0x282c33ff).into(),
|
||||
tab_bar: rgba(0x2f343eff).into(),
|
||||
editor: rgba(0x282c33ff).into(),
|
||||
editor_subheader: rgba(0x2f343eff).into(),
|
||||
editor_active_line: rgba(0x2f343eff).into(),
|
||||
terminal: rgba(0x282c33ff).into(),
|
||||
image_fallback_background: rgba(0x3b414dff).into(),
|
||||
git_created: rgba(0xa1c181ff).into(),
|
||||
git_modified: rgba(0x74ade8ff).into(),
|
||||
git_deleted: rgba(0xd07277ff).into(),
|
||||
git_conflict: rgba(0xdec184ff).into(),
|
||||
git_ignored: rgba(0x555a63ff).into(),
|
||||
git_renamed: rgba(0xdec184ff).into(),
|
||||
players: [
|
||||
PlayerTheme {
|
||||
cursor: rgba(0x74ade8ff).into(),
|
||||
selection: rgba(0x74ade83d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0xa1c181ff).into(),
|
||||
selection: rgba(0xa1c1813d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0xbe5046ff).into(),
|
||||
selection: rgba(0xbe50463d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0xbf956aff).into(),
|
||||
selection: rgba(0xbf956a3d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0xb477cfff).into(),
|
||||
selection: rgba(0xb477cf3d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0x6eb4bfff).into(),
|
||||
selection: rgba(0x6eb4bf3d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0xd07277ff).into(),
|
||||
selection: rgba(0xd072773d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0xdec184ff).into(),
|
||||
selection: rgba(0xdec1843d).into(),
|
||||
},
|
||||
],
|
||||
}
|
||||
}
|
||||
@@ -1,131 +0,0 @@
|
||||
use gpui2::rgba;
|
||||
|
||||
use crate::{PlayerTheme, SyntaxTheme, Theme, ThemeMetadata};
|
||||
|
||||
pub fn one_light() -> Theme {
|
||||
Theme {
|
||||
metadata: ThemeMetadata {
|
||||
name: "One Light".into(),
|
||||
is_light: true,
|
||||
},
|
||||
transparent: rgba(0x00000000).into(),
|
||||
mac_os_traffic_light_red: rgba(0xec695eff).into(),
|
||||
mac_os_traffic_light_yellow: rgba(0xf4bf4eff).into(),
|
||||
mac_os_traffic_light_green: rgba(0x61c553ff).into(),
|
||||
border: rgba(0xc9c9caff).into(),
|
||||
border_variant: rgba(0xc9c9caff).into(),
|
||||
border_focused: rgba(0xcbcdf6ff).into(),
|
||||
border_transparent: rgba(0x00000000).into(),
|
||||
elevated_surface: rgba(0xdcdcddff).into(),
|
||||
surface: rgba(0xebebecff).into(),
|
||||
background: rgba(0xdcdcddff).into(),
|
||||
filled_element: rgba(0xdcdcddff).into(),
|
||||
filled_element_hover: rgba(0xffffff1e).into(),
|
||||
filled_element_active: rgba(0xffffff28).into(),
|
||||
filled_element_selected: rgba(0xe2e2faff).into(),
|
||||
filled_element_disabled: rgba(0x00000000).into(),
|
||||
ghost_element: rgba(0x00000000).into(),
|
||||
ghost_element_hover: rgba(0xffffff14).into(),
|
||||
ghost_element_active: rgba(0xffffff1e).into(),
|
||||
ghost_element_selected: rgba(0xe2e2faff).into(),
|
||||
ghost_element_disabled: rgba(0x00000000).into(),
|
||||
text: rgba(0x383a41ff).into(),
|
||||
text_muted: rgba(0x7e8087ff).into(),
|
||||
text_placeholder: rgba(0xd36151ff).into(),
|
||||
text_disabled: rgba(0xa1a1a3ff).into(),
|
||||
text_accent: rgba(0x5c78e2ff).into(),
|
||||
icon_muted: rgba(0x7e8087ff).into(),
|
||||
syntax: SyntaxTheme {
|
||||
highlights: vec![
|
||||
("string.special.symbol".into(), rgba(0xad6e26ff).into()),
|
||||
("hint".into(), rgba(0x9294beff).into()),
|
||||
("link_uri".into(), rgba(0x3882b7ff).into()),
|
||||
("type".into(), rgba(0x3882b7ff).into()),
|
||||
("string.regex".into(), rgba(0xad6e26ff).into()),
|
||||
("constant".into(), rgba(0x669f59ff).into()),
|
||||
("function".into(), rgba(0x5b79e3ff).into()),
|
||||
("string.special".into(), rgba(0xad6e26ff).into()),
|
||||
("punctuation.bracket".into(), rgba(0x4d4f52ff).into()),
|
||||
("variable".into(), rgba(0x383a41ff).into()),
|
||||
("punctuation".into(), rgba(0x383a41ff).into()),
|
||||
("property".into(), rgba(0xd3604fff).into()),
|
||||
("string".into(), rgba(0x649f57ff).into()),
|
||||
("predictive".into(), rgba(0x9b9ec6ff).into()),
|
||||
("attribute".into(), rgba(0x5c78e2ff).into()),
|
||||
("number".into(), rgba(0xad6e25ff).into()),
|
||||
("constructor".into(), rgba(0x5c78e2ff).into()),
|
||||
("embedded".into(), rgba(0x383a41ff).into()),
|
||||
("title".into(), rgba(0xd3604fff).into()),
|
||||
("tag".into(), rgba(0x5c78e2ff).into()),
|
||||
("boolean".into(), rgba(0xad6e25ff).into()),
|
||||
("punctuation.list_marker".into(), rgba(0xd3604fff).into()),
|
||||
("variant".into(), rgba(0x5b79e3ff).into()),
|
||||
("emphasis".into(), rgba(0x5c78e2ff).into()),
|
||||
("link_text".into(), rgba(0x5b79e3ff).into()),
|
||||
("comment".into(), rgba(0xa2a3a7ff).into()),
|
||||
("punctuation.special".into(), rgba(0xb92b46ff).into()),
|
||||
("emphasis.strong".into(), rgba(0xad6e25ff).into()),
|
||||
("primary".into(), rgba(0x383a41ff).into()),
|
||||
("punctuation.delimiter".into(), rgba(0x4d4f52ff).into()),
|
||||
("label".into(), rgba(0x5c78e2ff).into()),
|
||||
("keyword".into(), rgba(0xa449abff).into()),
|
||||
("string.escape".into(), rgba(0x7c7e86ff).into()),
|
||||
("text.literal".into(), rgba(0x649f57ff).into()),
|
||||
("variable.special".into(), rgba(0xad6e25ff).into()),
|
||||
("comment.doc".into(), rgba(0x7c7e86ff).into()),
|
||||
("enum".into(), rgba(0xd3604fff).into()),
|
||||
("operator".into(), rgba(0x3882b7ff).into()),
|
||||
("preproc".into(), rgba(0x383a41ff).into()),
|
||||
],
|
||||
},
|
||||
status_bar: rgba(0xdcdcddff).into(),
|
||||
title_bar: rgba(0xdcdcddff).into(),
|
||||
toolbar: rgba(0xfafafaff).into(),
|
||||
tab_bar: rgba(0xebebecff).into(),
|
||||
editor: rgba(0xfafafaff).into(),
|
||||
editor_subheader: rgba(0xebebecff).into(),
|
||||
editor_active_line: rgba(0xebebecff).into(),
|
||||
terminal: rgba(0xfafafaff).into(),
|
||||
image_fallback_background: rgba(0xdcdcddff).into(),
|
||||
git_created: rgba(0x669f59ff).into(),
|
||||
git_modified: rgba(0x5c78e2ff).into(),
|
||||
git_deleted: rgba(0xd36151ff).into(),
|
||||
git_conflict: rgba(0xdec184ff).into(),
|
||||
git_ignored: rgba(0xa1a1a3ff).into(),
|
||||
git_renamed: rgba(0xdec184ff).into(),
|
||||
players: [
|
||||
PlayerTheme {
|
||||
cursor: rgba(0x5c78e2ff).into(),
|
||||
selection: rgba(0x5c78e23d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0x669f59ff).into(),
|
||||
selection: rgba(0x669f593d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0x984ea5ff).into(),
|
||||
selection: rgba(0x984ea53d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0xad6e26ff).into(),
|
||||
selection: rgba(0xad6e263d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0xa349abff).into(),
|
||||
selection: rgba(0xa349ab3d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0x3a82b7ff).into(),
|
||||
selection: rgba(0x3a82b73d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0xd36151ff).into(),
|
||||
selection: rgba(0xd361513d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0xdec184ff).into(),
|
||||
selection: rgba(0xdec1843d).into(),
|
||||
},
|
||||
],
|
||||
}
|
||||
}
|
||||
@@ -1,132 +0,0 @@
|
||||
use gpui2::rgba;
|
||||
|
||||
use crate::{PlayerTheme, SyntaxTheme, Theme, ThemeMetadata};
|
||||
|
||||
pub fn rose_pine() -> Theme {
|
||||
Theme {
|
||||
metadata: ThemeMetadata {
|
||||
name: "Rosé Pine".into(),
|
||||
is_light: false,
|
||||
},
|
||||
transparent: rgba(0x00000000).into(),
|
||||
mac_os_traffic_light_red: rgba(0xec695eff).into(),
|
||||
mac_os_traffic_light_yellow: rgba(0xf4bf4eff).into(),
|
||||
mac_os_traffic_light_green: rgba(0x61c553ff).into(),
|
||||
border: rgba(0x423f55ff).into(),
|
||||
border_variant: rgba(0x423f55ff).into(),
|
||||
border_focused: rgba(0x435255ff).into(),
|
||||
border_transparent: rgba(0x00000000).into(),
|
||||
elevated_surface: rgba(0x292738ff).into(),
|
||||
surface: rgba(0x1c1b2aff).into(),
|
||||
background: rgba(0x292738ff).into(),
|
||||
filled_element: rgba(0x292738ff).into(),
|
||||
filled_element_hover: rgba(0xffffff1e).into(),
|
||||
filled_element_active: rgba(0xffffff28).into(),
|
||||
filled_element_selected: rgba(0x2f3639ff).into(),
|
||||
filled_element_disabled: rgba(0x00000000).into(),
|
||||
ghost_element: rgba(0x00000000).into(),
|
||||
ghost_element_hover: rgba(0xffffff14).into(),
|
||||
ghost_element_active: rgba(0xffffff1e).into(),
|
||||
ghost_element_selected: rgba(0x2f3639ff).into(),
|
||||
ghost_element_disabled: rgba(0x00000000).into(),
|
||||
text: rgba(0xe0def4ff).into(),
|
||||
text_muted: rgba(0x74708dff).into(),
|
||||
text_placeholder: rgba(0xea6e92ff).into(),
|
||||
text_disabled: rgba(0x2f2b43ff).into(),
|
||||
text_accent: rgba(0x9bced6ff).into(),
|
||||
icon_muted: rgba(0x74708dff).into(),
|
||||
syntax: SyntaxTheme {
|
||||
highlights: vec![
|
||||
("punctuation.delimiter".into(), rgba(0x9d99b6ff).into()),
|
||||
("number".into(), rgba(0x5cc1a3ff).into()),
|
||||
("punctuation.special".into(), rgba(0x9d99b6ff).into()),
|
||||
("string.escape".into(), rgba(0x76728fff).into()),
|
||||
("title".into(), rgba(0xf5c177ff).into()),
|
||||
("constant".into(), rgba(0x5cc1a3ff).into()),
|
||||
("string.regex".into(), rgba(0xc4a7e6ff).into()),
|
||||
("type.builtin".into(), rgba(0x9ccfd8ff).into()),
|
||||
("comment.doc".into(), rgba(0x76728fff).into()),
|
||||
("primary".into(), rgba(0xe0def4ff).into()),
|
||||
("string.special".into(), rgba(0xc4a7e6ff).into()),
|
||||
("punctuation".into(), rgba(0x908caaff).into()),
|
||||
("string.special.symbol".into(), rgba(0xc4a7e6ff).into()),
|
||||
("variant".into(), rgba(0x9bced6ff).into()),
|
||||
("function.method".into(), rgba(0xebbcbaff).into()),
|
||||
("comment".into(), rgba(0x6e6a86ff).into()),
|
||||
("boolean".into(), rgba(0xebbcbaff).into()),
|
||||
("preproc".into(), rgba(0xe0def4ff).into()),
|
||||
("link_uri".into(), rgba(0xebbcbaff).into()),
|
||||
("hint".into(), rgba(0x5e768cff).into()),
|
||||
("attribute".into(), rgba(0x9bced6ff).into()),
|
||||
("text.literal".into(), rgba(0xc4a7e6ff).into()),
|
||||
("punctuation.list_marker".into(), rgba(0x9d99b6ff).into()),
|
||||
("operator".into(), rgba(0x30738fff).into()),
|
||||
("emphasis.strong".into(), rgba(0x9bced6ff).into()),
|
||||
("keyword".into(), rgba(0x30738fff).into()),
|
||||
("enum".into(), rgba(0xc4a7e6ff).into()),
|
||||
("tag".into(), rgba(0x9ccfd8ff).into()),
|
||||
("constructor".into(), rgba(0x9bced6ff).into()),
|
||||
("function".into(), rgba(0xebbcbaff).into()),
|
||||
("string".into(), rgba(0xf5c177ff).into()),
|
||||
("type".into(), rgba(0x9ccfd8ff).into()),
|
||||
("emphasis".into(), rgba(0x9bced6ff).into()),
|
||||
("link_text".into(), rgba(0x9ccfd8ff).into()),
|
||||
("property".into(), rgba(0x9bced6ff).into()),
|
||||
("predictive".into(), rgba(0x556b81ff).into()),
|
||||
("punctuation.bracket".into(), rgba(0x9d99b6ff).into()),
|
||||
("embedded".into(), rgba(0xe0def4ff).into()),
|
||||
("variable".into(), rgba(0xe0def4ff).into()),
|
||||
("label".into(), rgba(0x9bced6ff).into()),
|
||||
],
|
||||
},
|
||||
status_bar: rgba(0x292738ff).into(),
|
||||
title_bar: rgba(0x292738ff).into(),
|
||||
toolbar: rgba(0x191724ff).into(),
|
||||
tab_bar: rgba(0x1c1b2aff).into(),
|
||||
editor: rgba(0x191724ff).into(),
|
||||
editor_subheader: rgba(0x1c1b2aff).into(),
|
||||
editor_active_line: rgba(0x1c1b2aff).into(),
|
||||
terminal: rgba(0x191724ff).into(),
|
||||
image_fallback_background: rgba(0x292738ff).into(),
|
||||
git_created: rgba(0x5cc1a3ff).into(),
|
||||
git_modified: rgba(0x9bced6ff).into(),
|
||||
git_deleted: rgba(0xea6e92ff).into(),
|
||||
git_conflict: rgba(0xf5c177ff).into(),
|
||||
git_ignored: rgba(0x2f2b43ff).into(),
|
||||
git_renamed: rgba(0xf5c177ff).into(),
|
||||
players: [
|
||||
PlayerTheme {
|
||||
cursor: rgba(0x9bced6ff).into(),
|
||||
selection: rgba(0x9bced63d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0x5cc1a3ff).into(),
|
||||
selection: rgba(0x5cc1a33d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0x9d7591ff).into(),
|
||||
selection: rgba(0x9d75913d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0xc4a7e6ff).into(),
|
||||
selection: rgba(0xc4a7e63d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0xc4a7e6ff).into(),
|
||||
selection: rgba(0xc4a7e63d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0x31738fff).into(),
|
||||
selection: rgba(0x31738f3d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0xea6e92ff).into(),
|
||||
selection: rgba(0xea6e923d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0xf5c177ff).into(),
|
||||
selection: rgba(0xf5c1773d).into(),
|
||||
},
|
||||
],
|
||||
}
|
||||
}
|
||||
@@ -1,132 +0,0 @@
|
||||
use gpui2::rgba;
|
||||
|
||||
use crate::{PlayerTheme, SyntaxTheme, Theme, ThemeMetadata};
|
||||
|
||||
pub fn rose_pine_dawn() -> Theme {
|
||||
Theme {
|
||||
metadata: ThemeMetadata {
|
||||
name: "Rosé Pine Dawn".into(),
|
||||
is_light: true,
|
||||
},
|
||||
transparent: rgba(0x00000000).into(),
|
||||
mac_os_traffic_light_red: rgba(0xec695eff).into(),
|
||||
mac_os_traffic_light_yellow: rgba(0xf4bf4eff).into(),
|
||||
mac_os_traffic_light_green: rgba(0x61c553ff).into(),
|
||||
border: rgba(0xdcd6d5ff).into(),
|
||||
border_variant: rgba(0xdcd6d5ff).into(),
|
||||
border_focused: rgba(0xc3d7dbff).into(),
|
||||
border_transparent: rgba(0x00000000).into(),
|
||||
elevated_surface: rgba(0xdcd8d8ff).into(),
|
||||
surface: rgba(0xfef9f2ff).into(),
|
||||
background: rgba(0xdcd8d8ff).into(),
|
||||
filled_element: rgba(0xdcd8d8ff).into(),
|
||||
filled_element_hover: rgba(0xffffff1e).into(),
|
||||
filled_element_active: rgba(0xffffff28).into(),
|
||||
filled_element_selected: rgba(0xdde9ebff).into(),
|
||||
filled_element_disabled: rgba(0x00000000).into(),
|
||||
ghost_element: rgba(0x00000000).into(),
|
||||
ghost_element_hover: rgba(0xffffff14).into(),
|
||||
ghost_element_active: rgba(0xffffff1e).into(),
|
||||
ghost_element_selected: rgba(0xdde9ebff).into(),
|
||||
ghost_element_disabled: rgba(0x00000000).into(),
|
||||
text: rgba(0x575279ff).into(),
|
||||
text_muted: rgba(0x706c8cff).into(),
|
||||
text_placeholder: rgba(0xb4647aff).into(),
|
||||
text_disabled: rgba(0x938fa3ff).into(),
|
||||
text_accent: rgba(0x57949fff).into(),
|
||||
icon_muted: rgba(0x706c8cff).into(),
|
||||
syntax: SyntaxTheme {
|
||||
highlights: vec![
|
||||
("primary".into(), rgba(0x575279ff).into()),
|
||||
("attribute".into(), rgba(0x57949fff).into()),
|
||||
("operator".into(), rgba(0x276983ff).into()),
|
||||
("boolean".into(), rgba(0xd7827dff).into()),
|
||||
("tag".into(), rgba(0x55949fff).into()),
|
||||
("enum".into(), rgba(0x9079a9ff).into()),
|
||||
("embedded".into(), rgba(0x575279ff).into()),
|
||||
("label".into(), rgba(0x57949fff).into()),
|
||||
("function.method".into(), rgba(0xd7827dff).into()),
|
||||
("punctuation.list_marker".into(), rgba(0x635e82ff).into()),
|
||||
("punctuation.delimiter".into(), rgba(0x635e82ff).into()),
|
||||
("string".into(), rgba(0xea9d34ff).into()),
|
||||
("type".into(), rgba(0x55949fff).into()),
|
||||
("string.regex".into(), rgba(0x9079a9ff).into()),
|
||||
("variable".into(), rgba(0x575279ff).into()),
|
||||
("constructor".into(), rgba(0x57949fff).into()),
|
||||
("punctuation.bracket".into(), rgba(0x635e82ff).into()),
|
||||
("emphasis".into(), rgba(0x57949fff).into()),
|
||||
("comment.doc".into(), rgba(0x6e6a8bff).into()),
|
||||
("comment".into(), rgba(0x9893a5ff).into()),
|
||||
("keyword".into(), rgba(0x276983ff).into()),
|
||||
("preproc".into(), rgba(0x575279ff).into()),
|
||||
("string.special".into(), rgba(0x9079a9ff).into()),
|
||||
("string.escape".into(), rgba(0x6e6a8bff).into()),
|
||||
("constant".into(), rgba(0x3daa8eff).into()),
|
||||
("property".into(), rgba(0x57949fff).into()),
|
||||
("punctuation.special".into(), rgba(0x635e82ff).into()),
|
||||
("text.literal".into(), rgba(0x9079a9ff).into()),
|
||||
("type.builtin".into(), rgba(0x55949fff).into()),
|
||||
("string.special.symbol".into(), rgba(0x9079a9ff).into()),
|
||||
("link_uri".into(), rgba(0xd7827dff).into()),
|
||||
("number".into(), rgba(0x3daa8eff).into()),
|
||||
("emphasis.strong".into(), rgba(0x57949fff).into()),
|
||||
("function".into(), rgba(0xd7827dff).into()),
|
||||
("title".into(), rgba(0xea9d34ff).into()),
|
||||
("punctuation".into(), rgba(0x797593ff).into()),
|
||||
("link_text".into(), rgba(0x55949fff).into()),
|
||||
("variant".into(), rgba(0x57949fff).into()),
|
||||
("predictive".into(), rgba(0xa2acbeff).into()),
|
||||
("hint".into(), rgba(0x7a92aaff).into()),
|
||||
],
|
||||
},
|
||||
status_bar: rgba(0xdcd8d8ff).into(),
|
||||
title_bar: rgba(0xdcd8d8ff).into(),
|
||||
toolbar: rgba(0xfaf4edff).into(),
|
||||
tab_bar: rgba(0xfef9f2ff).into(),
|
||||
editor: rgba(0xfaf4edff).into(),
|
||||
editor_subheader: rgba(0xfef9f2ff).into(),
|
||||
editor_active_line: rgba(0xfef9f2ff).into(),
|
||||
terminal: rgba(0xfaf4edff).into(),
|
||||
image_fallback_background: rgba(0xdcd8d8ff).into(),
|
||||
git_created: rgba(0x3daa8eff).into(),
|
||||
git_modified: rgba(0x57949fff).into(),
|
||||
git_deleted: rgba(0xb4647aff).into(),
|
||||
git_conflict: rgba(0xe99d35ff).into(),
|
||||
git_ignored: rgba(0x938fa3ff).into(),
|
||||
git_renamed: rgba(0xe99d35ff).into(),
|
||||
players: [
|
||||
PlayerTheme {
|
||||
cursor: rgba(0x57949fff).into(),
|
||||
selection: rgba(0x57949f3d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0x3daa8eff).into(),
|
||||
selection: rgba(0x3daa8e3d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0x7c697fff).into(),
|
||||
selection: rgba(0x7c697f3d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0x9079a9ff).into(),
|
||||
selection: rgba(0x9079a93d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0x9079a9ff).into(),
|
||||
selection: rgba(0x9079a93d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0x296983ff).into(),
|
||||
selection: rgba(0x2969833d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0xb4647aff).into(),
|
||||
selection: rgba(0xb4647a3d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0xe99d35ff).into(),
|
||||
selection: rgba(0xe99d353d).into(),
|
||||
},
|
||||
],
|
||||
}
|
||||
}
|
||||
@@ -1,132 +0,0 @@
|
||||
use gpui2::rgba;
|
||||
|
||||
use crate::{PlayerTheme, SyntaxTheme, Theme, ThemeMetadata};
|
||||
|
||||
pub fn rose_pine_moon() -> Theme {
|
||||
Theme {
|
||||
metadata: ThemeMetadata {
|
||||
name: "Rosé Pine Moon".into(),
|
||||
is_light: false,
|
||||
},
|
||||
transparent: rgba(0x00000000).into(),
|
||||
mac_os_traffic_light_red: rgba(0xec695eff).into(),
|
||||
mac_os_traffic_light_yellow: rgba(0xf4bf4eff).into(),
|
||||
mac_os_traffic_light_green: rgba(0x61c553ff).into(),
|
||||
border: rgba(0x504c68ff).into(),
|
||||
border_variant: rgba(0x504c68ff).into(),
|
||||
border_focused: rgba(0x435255ff).into(),
|
||||
border_transparent: rgba(0x00000000).into(),
|
||||
elevated_surface: rgba(0x38354eff).into(),
|
||||
surface: rgba(0x28253cff).into(),
|
||||
background: rgba(0x38354eff).into(),
|
||||
filled_element: rgba(0x38354eff).into(),
|
||||
filled_element_hover: rgba(0xffffff1e).into(),
|
||||
filled_element_active: rgba(0xffffff28).into(),
|
||||
filled_element_selected: rgba(0x2f3639ff).into(),
|
||||
filled_element_disabled: rgba(0x00000000).into(),
|
||||
ghost_element: rgba(0x00000000).into(),
|
||||
ghost_element_hover: rgba(0xffffff14).into(),
|
||||
ghost_element_active: rgba(0xffffff1e).into(),
|
||||
ghost_element_selected: rgba(0x2f3639ff).into(),
|
||||
ghost_element_disabled: rgba(0x00000000).into(),
|
||||
text: rgba(0xe0def4ff).into(),
|
||||
text_muted: rgba(0x85819eff).into(),
|
||||
text_placeholder: rgba(0xea6e92ff).into(),
|
||||
text_disabled: rgba(0x605d7aff).into(),
|
||||
text_accent: rgba(0x9bced6ff).into(),
|
||||
icon_muted: rgba(0x85819eff).into(),
|
||||
syntax: SyntaxTheme {
|
||||
highlights: vec![
|
||||
("type.builtin".into(), rgba(0x9ccfd8ff).into()),
|
||||
("variable".into(), rgba(0xe0def4ff).into()),
|
||||
("punctuation".into(), rgba(0x908caaff).into()),
|
||||
("number".into(), rgba(0x5cc1a3ff).into()),
|
||||
("comment".into(), rgba(0x6e6a86ff).into()),
|
||||
("string.special".into(), rgba(0xc4a7e6ff).into()),
|
||||
("string.escape".into(), rgba(0x8682a0ff).into()),
|
||||
("function.method".into(), rgba(0xea9a97ff).into()),
|
||||
("predictive".into(), rgba(0x516b83ff).into()),
|
||||
("punctuation.delimiter".into(), rgba(0xaeabc6ff).into()),
|
||||
("primary".into(), rgba(0xe0def4ff).into()),
|
||||
("link_text".into(), rgba(0x9ccfd8ff).into()),
|
||||
("string.regex".into(), rgba(0xc4a7e6ff).into()),
|
||||
("constructor".into(), rgba(0x9bced6ff).into()),
|
||||
("constant".into(), rgba(0x5cc1a3ff).into()),
|
||||
("emphasis.strong".into(), rgba(0x9bced6ff).into()),
|
||||
("function".into(), rgba(0xea9a97ff).into()),
|
||||
("hint".into(), rgba(0x728aa2ff).into()),
|
||||
("preproc".into(), rgba(0xe0def4ff).into()),
|
||||
("property".into(), rgba(0x9bced6ff).into()),
|
||||
("punctuation.list_marker".into(), rgba(0xaeabc6ff).into()),
|
||||
("emphasis".into(), rgba(0x9bced6ff).into()),
|
||||
("attribute".into(), rgba(0x9bced6ff).into()),
|
||||
("title".into(), rgba(0xf5c177ff).into()),
|
||||
("keyword".into(), rgba(0x3d8fb0ff).into()),
|
||||
("string".into(), rgba(0xf5c177ff).into()),
|
||||
("text.literal".into(), rgba(0xc4a7e6ff).into()),
|
||||
("embedded".into(), rgba(0xe0def4ff).into()),
|
||||
("comment.doc".into(), rgba(0x8682a0ff).into()),
|
||||
("variant".into(), rgba(0x9bced6ff).into()),
|
||||
("label".into(), rgba(0x9bced6ff).into()),
|
||||
("punctuation.special".into(), rgba(0xaeabc6ff).into()),
|
||||
("string.special.symbol".into(), rgba(0xc4a7e6ff).into()),
|
||||
("tag".into(), rgba(0x9ccfd8ff).into()),
|
||||
("enum".into(), rgba(0xc4a7e6ff).into()),
|
||||
("boolean".into(), rgba(0xea9a97ff).into()),
|
||||
("punctuation.bracket".into(), rgba(0xaeabc6ff).into()),
|
||||
("operator".into(), rgba(0x3d8fb0ff).into()),
|
||||
("type".into(), rgba(0x9ccfd8ff).into()),
|
||||
("link_uri".into(), rgba(0xea9a97ff).into()),
|
||||
],
|
||||
},
|
||||
status_bar: rgba(0x38354eff).into(),
|
||||
title_bar: rgba(0x38354eff).into(),
|
||||
toolbar: rgba(0x232136ff).into(),
|
||||
tab_bar: rgba(0x28253cff).into(),
|
||||
editor: rgba(0x232136ff).into(),
|
||||
editor_subheader: rgba(0x28253cff).into(),
|
||||
editor_active_line: rgba(0x28253cff).into(),
|
||||
terminal: rgba(0x232136ff).into(),
|
||||
image_fallback_background: rgba(0x38354eff).into(),
|
||||
git_created: rgba(0x5cc1a3ff).into(),
|
||||
git_modified: rgba(0x9bced6ff).into(),
|
||||
git_deleted: rgba(0xea6e92ff).into(),
|
||||
git_conflict: rgba(0xf5c177ff).into(),
|
||||
git_ignored: rgba(0x605d7aff).into(),
|
||||
git_renamed: rgba(0xf5c177ff).into(),
|
||||
players: [
|
||||
PlayerTheme {
|
||||
cursor: rgba(0x9bced6ff).into(),
|
||||
selection: rgba(0x9bced63d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0x5cc1a3ff).into(),
|
||||
selection: rgba(0x5cc1a33d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0xa683a0ff).into(),
|
||||
selection: rgba(0xa683a03d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0xc4a7e6ff).into(),
|
||||
selection: rgba(0xc4a7e63d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0xc4a7e6ff).into(),
|
||||
selection: rgba(0xc4a7e63d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0x3e8fb0ff).into(),
|
||||
selection: rgba(0x3e8fb03d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0xea6e92ff).into(),
|
||||
selection: rgba(0xea6e923d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0xf5c177ff).into(),
|
||||
selection: rgba(0xf5c1773d).into(),
|
||||
},
|
||||
],
|
||||
}
|
||||
}
|
||||
@@ -1,130 +0,0 @@
|
||||
use gpui2::rgba;
|
||||
|
||||
use crate::{PlayerTheme, SyntaxTheme, Theme, ThemeMetadata};
|
||||
|
||||
pub fn sandcastle() -> Theme {
|
||||
Theme {
|
||||
metadata: ThemeMetadata {
|
||||
name: "Sandcastle".into(),
|
||||
is_light: false,
|
||||
},
|
||||
transparent: rgba(0x00000000).into(),
|
||||
mac_os_traffic_light_red: rgba(0xec695eff).into(),
|
||||
mac_os_traffic_light_yellow: rgba(0xf4bf4eff).into(),
|
||||
mac_os_traffic_light_green: rgba(0x61c553ff).into(),
|
||||
border: rgba(0x3d4350ff).into(),
|
||||
border_variant: rgba(0x3d4350ff).into(),
|
||||
border_focused: rgba(0x223131ff).into(),
|
||||
border_transparent: rgba(0x00000000).into(),
|
||||
elevated_surface: rgba(0x333944ff).into(),
|
||||
surface: rgba(0x2b3038ff).into(),
|
||||
background: rgba(0x333944ff).into(),
|
||||
filled_element: rgba(0x333944ff).into(),
|
||||
filled_element_hover: rgba(0xffffff1e).into(),
|
||||
filled_element_active: rgba(0xffffff28).into(),
|
||||
filled_element_selected: rgba(0x171e1eff).into(),
|
||||
filled_element_disabled: rgba(0x00000000).into(),
|
||||
ghost_element: rgba(0x00000000).into(),
|
||||
ghost_element_hover: rgba(0xffffff14).into(),
|
||||
ghost_element_active: rgba(0xffffff1e).into(),
|
||||
ghost_element_selected: rgba(0x171e1eff).into(),
|
||||
ghost_element_disabled: rgba(0x00000000).into(),
|
||||
text: rgba(0xfdf4c1ff).into(),
|
||||
text_muted: rgba(0xa69782ff).into(),
|
||||
text_placeholder: rgba(0xb3627aff).into(),
|
||||
text_disabled: rgba(0x827568ff).into(),
|
||||
text_accent: rgba(0x518b8bff).into(),
|
||||
icon_muted: rgba(0xa69782ff).into(),
|
||||
syntax: SyntaxTheme {
|
||||
highlights: vec![
|
||||
("comment".into(), rgba(0xa89984ff).into()),
|
||||
("type".into(), rgba(0x83a598ff).into()),
|
||||
("preproc".into(), rgba(0xfdf4c1ff).into()),
|
||||
("punctuation.bracket".into(), rgba(0xd5c5a1ff).into()),
|
||||
("hint".into(), rgba(0x727d68ff).into()),
|
||||
("link_uri".into(), rgba(0x83a598ff).into()),
|
||||
("text.literal".into(), rgba(0xa07d3aff).into()),
|
||||
("enum".into(), rgba(0xa07d3aff).into()),
|
||||
("string.special".into(), rgba(0xa07d3aff).into()),
|
||||
("string".into(), rgba(0xa07d3aff).into()),
|
||||
("punctuation.special".into(), rgba(0xd5c5a1ff).into()),
|
||||
("keyword".into(), rgba(0x518b8bff).into()),
|
||||
("constructor".into(), rgba(0x518b8bff).into()),
|
||||
("predictive".into(), rgba(0x5c6152ff).into()),
|
||||
("title".into(), rgba(0xfdf4c1ff).into()),
|
||||
("variable".into(), rgba(0xfdf4c1ff).into()),
|
||||
("emphasis.strong".into(), rgba(0x518b8bff).into()),
|
||||
("primary".into(), rgba(0xfdf4c1ff).into()),
|
||||
("emphasis".into(), rgba(0x518b8bff).into()),
|
||||
("punctuation".into(), rgba(0xd5c5a1ff).into()),
|
||||
("constant".into(), rgba(0x83a598ff).into()),
|
||||
("link_text".into(), rgba(0xa07d3aff).into()),
|
||||
("punctuation.delimiter".into(), rgba(0xd5c5a1ff).into()),
|
||||
("embedded".into(), rgba(0xfdf4c1ff).into()),
|
||||
("string.special.symbol".into(), rgba(0xa07d3aff).into()),
|
||||
("tag".into(), rgba(0x518b8bff).into()),
|
||||
("punctuation.list_marker".into(), rgba(0xd5c5a1ff).into()),
|
||||
("operator".into(), rgba(0xa07d3aff).into()),
|
||||
("boolean".into(), rgba(0x83a598ff).into()),
|
||||
("function".into(), rgba(0xa07d3aff).into()),
|
||||
("attribute".into(), rgba(0x518b8bff).into()),
|
||||
("number".into(), rgba(0x83a598ff).into()),
|
||||
("string.escape".into(), rgba(0xa89984ff).into()),
|
||||
("comment.doc".into(), rgba(0xa89984ff).into()),
|
||||
("label".into(), rgba(0x518b8bff).into()),
|
||||
("string.regex".into(), rgba(0xa07d3aff).into()),
|
||||
("property".into(), rgba(0x518b8bff).into()),
|
||||
("variant".into(), rgba(0x518b8bff).into()),
|
||||
],
|
||||
},
|
||||
status_bar: rgba(0x333944ff).into(),
|
||||
title_bar: rgba(0x333944ff).into(),
|
||||
toolbar: rgba(0x282c33ff).into(),
|
||||
tab_bar: rgba(0x2b3038ff).into(),
|
||||
editor: rgba(0x282c33ff).into(),
|
||||
editor_subheader: rgba(0x2b3038ff).into(),
|
||||
editor_active_line: rgba(0x2b3038ff).into(),
|
||||
terminal: rgba(0x282c33ff).into(),
|
||||
image_fallback_background: rgba(0x333944ff).into(),
|
||||
git_created: rgba(0x83a598ff).into(),
|
||||
git_modified: rgba(0x518b8bff).into(),
|
||||
git_deleted: rgba(0xb3627aff).into(),
|
||||
git_conflict: rgba(0xa07d3aff).into(),
|
||||
git_ignored: rgba(0x827568ff).into(),
|
||||
git_renamed: rgba(0xa07d3aff).into(),
|
||||
players: [
|
||||
PlayerTheme {
|
||||
cursor: rgba(0x518b8bff).into(),
|
||||
selection: rgba(0x518b8b3d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0x83a598ff).into(),
|
||||
selection: rgba(0x83a5983d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0xa87222ff).into(),
|
||||
selection: rgba(0xa872223d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0xa07d3aff).into(),
|
||||
selection: rgba(0xa07d3a3d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0xd75f5fff).into(),
|
||||
selection: rgba(0xd75f5f3d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0x83a598ff).into(),
|
||||
selection: rgba(0x83a5983d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0xb3627aff).into(),
|
||||
selection: rgba(0xb3627a3d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0xa07d3aff).into(),
|
||||
selection: rgba(0xa07d3a3d).into(),
|
||||
},
|
||||
],
|
||||
}
|
||||
}
|
||||
@@ -1,130 +0,0 @@
|
||||
use gpui2::rgba;
|
||||
|
||||
use crate::{PlayerTheme, SyntaxTheme, Theme, ThemeMetadata};
|
||||
|
||||
pub fn solarized_dark() -> Theme {
|
||||
Theme {
|
||||
metadata: ThemeMetadata {
|
||||
name: "Solarized Dark".into(),
|
||||
is_light: false,
|
||||
},
|
||||
transparent: rgba(0x00000000).into(),
|
||||
mac_os_traffic_light_red: rgba(0xec695eff).into(),
|
||||
mac_os_traffic_light_yellow: rgba(0xf4bf4eff).into(),
|
||||
mac_os_traffic_light_green: rgba(0x61c553ff).into(),
|
||||
border: rgba(0x2b4e58ff).into(),
|
||||
border_variant: rgba(0x2b4e58ff).into(),
|
||||
border_focused: rgba(0x1b3149ff).into(),
|
||||
border_transparent: rgba(0x00000000).into(),
|
||||
elevated_surface: rgba(0x073743ff).into(),
|
||||
surface: rgba(0x04313bff).into(),
|
||||
background: rgba(0x073743ff).into(),
|
||||
filled_element: rgba(0x073743ff).into(),
|
||||
filled_element_hover: rgba(0xffffff1e).into(),
|
||||
filled_element_active: rgba(0xffffff28).into(),
|
||||
filled_element_selected: rgba(0x141f2cff).into(),
|
||||
filled_element_disabled: rgba(0x00000000).into(),
|
||||
ghost_element: rgba(0x00000000).into(),
|
||||
ghost_element_hover: rgba(0xffffff14).into(),
|
||||
ghost_element_active: rgba(0xffffff1e).into(),
|
||||
ghost_element_selected: rgba(0x141f2cff).into(),
|
||||
ghost_element_disabled: rgba(0x00000000).into(),
|
||||
text: rgba(0xfdf6e3ff).into(),
|
||||
text_muted: rgba(0x93a1a1ff).into(),
|
||||
text_placeholder: rgba(0xdc3330ff).into(),
|
||||
text_disabled: rgba(0x6f8389ff).into(),
|
||||
text_accent: rgba(0x278ad1ff).into(),
|
||||
icon_muted: rgba(0x93a1a1ff).into(),
|
||||
syntax: SyntaxTheme {
|
||||
highlights: vec![
|
||||
("punctuation.special".into(), rgba(0xefe9d6ff).into()),
|
||||
("string".into(), rgba(0xcb4b16ff).into()),
|
||||
("variant".into(), rgba(0x278ad1ff).into()),
|
||||
("variable".into(), rgba(0xfdf6e3ff).into()),
|
||||
("string.special.symbol".into(), rgba(0xcb4b16ff).into()),
|
||||
("primary".into(), rgba(0xfdf6e3ff).into()),
|
||||
("type".into(), rgba(0x2ba198ff).into()),
|
||||
("boolean".into(), rgba(0x849903ff).into()),
|
||||
("string.special".into(), rgba(0xcb4b16ff).into()),
|
||||
("label".into(), rgba(0x278ad1ff).into()),
|
||||
("link_uri".into(), rgba(0x849903ff).into()),
|
||||
("constructor".into(), rgba(0x278ad1ff).into()),
|
||||
("hint".into(), rgba(0x4f8297ff).into()),
|
||||
("preproc".into(), rgba(0xfdf6e3ff).into()),
|
||||
("text.literal".into(), rgba(0xcb4b16ff).into()),
|
||||
("string.escape".into(), rgba(0x99a5a4ff).into()),
|
||||
("link_text".into(), rgba(0xcb4b16ff).into()),
|
||||
("comment".into(), rgba(0x99a5a4ff).into()),
|
||||
("enum".into(), rgba(0xcb4b16ff).into()),
|
||||
("constant".into(), rgba(0x849903ff).into()),
|
||||
("comment.doc".into(), rgba(0x99a5a4ff).into()),
|
||||
("emphasis".into(), rgba(0x278ad1ff).into()),
|
||||
("predictive".into(), rgba(0x3f718bff).into()),
|
||||
("attribute".into(), rgba(0x278ad1ff).into()),
|
||||
("punctuation.delimiter".into(), rgba(0xefe9d6ff).into()),
|
||||
("function".into(), rgba(0xb58902ff).into()),
|
||||
("emphasis.strong".into(), rgba(0x278ad1ff).into()),
|
||||
("tag".into(), rgba(0x278ad1ff).into()),
|
||||
("string.regex".into(), rgba(0xcb4b16ff).into()),
|
||||
("property".into(), rgba(0x278ad1ff).into()),
|
||||
("keyword".into(), rgba(0x278ad1ff).into()),
|
||||
("number".into(), rgba(0x849903ff).into()),
|
||||
("embedded".into(), rgba(0xfdf6e3ff).into()),
|
||||
("operator".into(), rgba(0xcb4b16ff).into()),
|
||||
("punctuation".into(), rgba(0xefe9d6ff).into()),
|
||||
("punctuation.bracket".into(), rgba(0xefe9d6ff).into()),
|
||||
("title".into(), rgba(0xfdf6e3ff).into()),
|
||||
("punctuation.list_marker".into(), rgba(0xefe9d6ff).into()),
|
||||
],
|
||||
},
|
||||
status_bar: rgba(0x073743ff).into(),
|
||||
title_bar: rgba(0x073743ff).into(),
|
||||
toolbar: rgba(0x002a35ff).into(),
|
||||
tab_bar: rgba(0x04313bff).into(),
|
||||
editor: rgba(0x002a35ff).into(),
|
||||
editor_subheader: rgba(0x04313bff).into(),
|
||||
editor_active_line: rgba(0x04313bff).into(),
|
||||
terminal: rgba(0x002a35ff).into(),
|
||||
image_fallback_background: rgba(0x073743ff).into(),
|
||||
git_created: rgba(0x849903ff).into(),
|
||||
git_modified: rgba(0x278ad1ff).into(),
|
||||
git_deleted: rgba(0xdc3330ff).into(),
|
||||
git_conflict: rgba(0xb58902ff).into(),
|
||||
git_ignored: rgba(0x6f8389ff).into(),
|
||||
git_renamed: rgba(0xb58902ff).into(),
|
||||
players: [
|
||||
PlayerTheme {
|
||||
cursor: rgba(0x278ad1ff).into(),
|
||||
selection: rgba(0x278ad13d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0x849903ff).into(),
|
||||
selection: rgba(0x8499033d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0xd33781ff).into(),
|
||||
selection: rgba(0xd337813d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0xcb4b16ff).into(),
|
||||
selection: rgba(0xcb4b163d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0x6c71c4ff).into(),
|
||||
selection: rgba(0x6c71c43d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0x2ba198ff).into(),
|
||||
selection: rgba(0x2ba1983d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0xdc3330ff).into(),
|
||||
selection: rgba(0xdc33303d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0xb58902ff).into(),
|
||||
selection: rgba(0xb589023d).into(),
|
||||
},
|
||||
],
|
||||
}
|
||||
}
|
||||
@@ -1,130 +0,0 @@
|
||||
use gpui2::rgba;
|
||||
|
||||
use crate::{PlayerTheme, SyntaxTheme, Theme, ThemeMetadata};
|
||||
|
||||
pub fn solarized_light() -> Theme {
|
||||
Theme {
|
||||
metadata: ThemeMetadata {
|
||||
name: "Solarized Light".into(),
|
||||
is_light: true,
|
||||
},
|
||||
transparent: rgba(0x00000000).into(),
|
||||
mac_os_traffic_light_red: rgba(0xec695eff).into(),
|
||||
mac_os_traffic_light_yellow: rgba(0xf4bf4eff).into(),
|
||||
mac_os_traffic_light_green: rgba(0x61c553ff).into(),
|
||||
border: rgba(0x9faaa8ff).into(),
|
||||
border_variant: rgba(0x9faaa8ff).into(),
|
||||
border_focused: rgba(0xbfd3efff).into(),
|
||||
border_transparent: rgba(0x00000000).into(),
|
||||
elevated_surface: rgba(0xcfd0c4ff).into(),
|
||||
surface: rgba(0xf3eddaff).into(),
|
||||
background: rgba(0xcfd0c4ff).into(),
|
||||
filled_element: rgba(0xcfd0c4ff).into(),
|
||||
filled_element_hover: rgba(0xffffff1e).into(),
|
||||
filled_element_active: rgba(0xffffff28).into(),
|
||||
filled_element_selected: rgba(0xdbe6f6ff).into(),
|
||||
filled_element_disabled: rgba(0x00000000).into(),
|
||||
ghost_element: rgba(0x00000000).into(),
|
||||
ghost_element_hover: rgba(0xffffff14).into(),
|
||||
ghost_element_active: rgba(0xffffff1e).into(),
|
||||
ghost_element_selected: rgba(0xdbe6f6ff).into(),
|
||||
ghost_element_disabled: rgba(0x00000000).into(),
|
||||
text: rgba(0x002a35ff).into(),
|
||||
text_muted: rgba(0x34555eff).into(),
|
||||
text_placeholder: rgba(0xdc3330ff).into(),
|
||||
text_disabled: rgba(0x6a7f86ff).into(),
|
||||
text_accent: rgba(0x288bd1ff).into(),
|
||||
icon_muted: rgba(0x34555eff).into(),
|
||||
syntax: SyntaxTheme {
|
||||
highlights: vec![
|
||||
("string.escape".into(), rgba(0x30525bff).into()),
|
||||
("boolean".into(), rgba(0x849903ff).into()),
|
||||
("comment.doc".into(), rgba(0x30525bff).into()),
|
||||
("string.special".into(), rgba(0xcb4b17ff).into()),
|
||||
("punctuation".into(), rgba(0x04333eff).into()),
|
||||
("emphasis".into(), rgba(0x288bd1ff).into()),
|
||||
("type".into(), rgba(0x2ba198ff).into()),
|
||||
("preproc".into(), rgba(0x002a35ff).into()),
|
||||
("emphasis.strong".into(), rgba(0x288bd1ff).into()),
|
||||
("constant".into(), rgba(0x849903ff).into()),
|
||||
("title".into(), rgba(0x002a35ff).into()),
|
||||
("operator".into(), rgba(0xcb4b17ff).into()),
|
||||
("punctuation.bracket".into(), rgba(0x04333eff).into()),
|
||||
("link_uri".into(), rgba(0x849903ff).into()),
|
||||
("label".into(), rgba(0x288bd1ff).into()),
|
||||
("enum".into(), rgba(0xcb4b17ff).into()),
|
||||
("property".into(), rgba(0x288bd1ff).into()),
|
||||
("predictive".into(), rgba(0x679aafff).into()),
|
||||
("punctuation.special".into(), rgba(0x04333eff).into()),
|
||||
("text.literal".into(), rgba(0xcb4b17ff).into()),
|
||||
("string".into(), rgba(0xcb4b17ff).into()),
|
||||
("string.regex".into(), rgba(0xcb4b17ff).into()),
|
||||
("variable".into(), rgba(0x002a35ff).into()),
|
||||
("tag".into(), rgba(0x288bd1ff).into()),
|
||||
("string.special.symbol".into(), rgba(0xcb4b17ff).into()),
|
||||
("link_text".into(), rgba(0xcb4b17ff).into()),
|
||||
("punctuation.list_marker".into(), rgba(0x04333eff).into()),
|
||||
("keyword".into(), rgba(0x288bd1ff).into()),
|
||||
("constructor".into(), rgba(0x288bd1ff).into()),
|
||||
("attribute".into(), rgba(0x288bd1ff).into()),
|
||||
("variant".into(), rgba(0x288bd1ff).into()),
|
||||
("function".into(), rgba(0xb58903ff).into()),
|
||||
("primary".into(), rgba(0x002a35ff).into()),
|
||||
("hint".into(), rgba(0x5789a3ff).into()),
|
||||
("comment".into(), rgba(0x30525bff).into()),
|
||||
("number".into(), rgba(0x849903ff).into()),
|
||||
("punctuation.delimiter".into(), rgba(0x04333eff).into()),
|
||||
("embedded".into(), rgba(0x002a35ff).into()),
|
||||
],
|
||||
},
|
||||
status_bar: rgba(0xcfd0c4ff).into(),
|
||||
title_bar: rgba(0xcfd0c4ff).into(),
|
||||
toolbar: rgba(0xfdf6e3ff).into(),
|
||||
tab_bar: rgba(0xf3eddaff).into(),
|
||||
editor: rgba(0xfdf6e3ff).into(),
|
||||
editor_subheader: rgba(0xf3eddaff).into(),
|
||||
editor_active_line: rgba(0xf3eddaff).into(),
|
||||
terminal: rgba(0xfdf6e3ff).into(),
|
||||
image_fallback_background: rgba(0xcfd0c4ff).into(),
|
||||
git_created: rgba(0x849903ff).into(),
|
||||
git_modified: rgba(0x288bd1ff).into(),
|
||||
git_deleted: rgba(0xdc3330ff).into(),
|
||||
git_conflict: rgba(0xb58903ff).into(),
|
||||
git_ignored: rgba(0x6a7f86ff).into(),
|
||||
git_renamed: rgba(0xb58903ff).into(),
|
||||
players: [
|
||||
PlayerTheme {
|
||||
cursor: rgba(0x288bd1ff).into(),
|
||||
selection: rgba(0x288bd13d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0x849903ff).into(),
|
||||
selection: rgba(0x8499033d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0xd33781ff).into(),
|
||||
selection: rgba(0xd337813d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0xcb4b17ff).into(),
|
||||
selection: rgba(0xcb4b173d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0x6c71c3ff).into(),
|
||||
selection: rgba(0x6c71c33d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0x2ba198ff).into(),
|
||||
selection: rgba(0x2ba1983d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0xdc3330ff).into(),
|
||||
selection: rgba(0xdc33303d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0xb58903ff).into(),
|
||||
selection: rgba(0xb589033d).into(),
|
||||
},
|
||||
],
|
||||
}
|
||||
}
|
||||
@@ -1,130 +0,0 @@
|
||||
use gpui2::rgba;
|
||||
|
||||
use crate::{PlayerTheme, SyntaxTheme, Theme, ThemeMetadata};
|
||||
|
||||
pub fn summercamp() -> Theme {
|
||||
Theme {
|
||||
metadata: ThemeMetadata {
|
||||
name: "Summercamp".into(),
|
||||
is_light: false,
|
||||
},
|
||||
transparent: rgba(0x00000000).into(),
|
||||
mac_os_traffic_light_red: rgba(0xec695eff).into(),
|
||||
mac_os_traffic_light_yellow: rgba(0xf4bf4eff).into(),
|
||||
mac_os_traffic_light_green: rgba(0x61c553ff).into(),
|
||||
border: rgba(0x302c21ff).into(),
|
||||
border_variant: rgba(0x302c21ff).into(),
|
||||
border_focused: rgba(0x193760ff).into(),
|
||||
border_transparent: rgba(0x00000000).into(),
|
||||
elevated_surface: rgba(0x2a261cff).into(),
|
||||
surface: rgba(0x231f16ff).into(),
|
||||
background: rgba(0x2a261cff).into(),
|
||||
filled_element: rgba(0x2a261cff).into(),
|
||||
filled_element_hover: rgba(0xffffff1e).into(),
|
||||
filled_element_active: rgba(0xffffff28).into(),
|
||||
filled_element_selected: rgba(0x0e2242ff).into(),
|
||||
filled_element_disabled: rgba(0x00000000).into(),
|
||||
ghost_element: rgba(0x00000000).into(),
|
||||
ghost_element_hover: rgba(0xffffff14).into(),
|
||||
ghost_element_active: rgba(0xffffff1e).into(),
|
||||
ghost_element_selected: rgba(0x0e2242ff).into(),
|
||||
ghost_element_disabled: rgba(0x00000000).into(),
|
||||
text: rgba(0xf8f5deff).into(),
|
||||
text_muted: rgba(0x736e55ff).into(),
|
||||
text_placeholder: rgba(0xe35041ff).into(),
|
||||
text_disabled: rgba(0x4c4735ff).into(),
|
||||
text_accent: rgba(0x499befff).into(),
|
||||
icon_muted: rgba(0x736e55ff).into(),
|
||||
syntax: SyntaxTheme {
|
||||
highlights: vec![
|
||||
("predictive".into(), rgba(0x78434aff).into()),
|
||||
("title".into(), rgba(0xf8f5deff).into()),
|
||||
("primary".into(), rgba(0xf8f5deff).into()),
|
||||
("punctuation.special".into(), rgba(0xbfbb9bff).into()),
|
||||
("constant".into(), rgba(0x5dea5aff).into()),
|
||||
("string.regex".into(), rgba(0xfaa11cff).into()),
|
||||
("tag".into(), rgba(0x499befff).into()),
|
||||
("preproc".into(), rgba(0xf8f5deff).into()),
|
||||
("comment".into(), rgba(0x777159ff).into()),
|
||||
("punctuation.bracket".into(), rgba(0xbfbb9bff).into()),
|
||||
("constructor".into(), rgba(0x499befff).into()),
|
||||
("type".into(), rgba(0x5aeabbff).into()),
|
||||
("variable".into(), rgba(0xf8f5deff).into()),
|
||||
("operator".into(), rgba(0xfaa11cff).into()),
|
||||
("boolean".into(), rgba(0x5dea5aff).into()),
|
||||
("attribute".into(), rgba(0x499befff).into()),
|
||||
("link_text".into(), rgba(0xfaa11cff).into()),
|
||||
("string.escape".into(), rgba(0x777159ff).into()),
|
||||
("string.special".into(), rgba(0xfaa11cff).into()),
|
||||
("string.special.symbol".into(), rgba(0xfaa11cff).into()),
|
||||
("hint".into(), rgba(0x246e61ff).into()),
|
||||
("link_uri".into(), rgba(0x5dea5aff).into()),
|
||||
("comment.doc".into(), rgba(0x777159ff).into()),
|
||||
("emphasis".into(), rgba(0x499befff).into()),
|
||||
("punctuation".into(), rgba(0xbfbb9bff).into()),
|
||||
("text.literal".into(), rgba(0xfaa11cff).into()),
|
||||
("number".into(), rgba(0x5dea5aff).into()),
|
||||
("punctuation.delimiter".into(), rgba(0xbfbb9bff).into()),
|
||||
("label".into(), rgba(0x499befff).into()),
|
||||
("function".into(), rgba(0xf1fe28ff).into()),
|
||||
("property".into(), rgba(0x499befff).into()),
|
||||
("keyword".into(), rgba(0x499befff).into()),
|
||||
("embedded".into(), rgba(0xf8f5deff).into()),
|
||||
("string".into(), rgba(0xfaa11cff).into()),
|
||||
("punctuation.list_marker".into(), rgba(0xbfbb9bff).into()),
|
||||
("enum".into(), rgba(0xfaa11cff).into()),
|
||||
("emphasis.strong".into(), rgba(0x499befff).into()),
|
||||
("variant".into(), rgba(0x499befff).into()),
|
||||
],
|
||||
},
|
||||
status_bar: rgba(0x2a261cff).into(),
|
||||
title_bar: rgba(0x2a261cff).into(),
|
||||
toolbar: rgba(0x1b1810ff).into(),
|
||||
tab_bar: rgba(0x231f16ff).into(),
|
||||
editor: rgba(0x1b1810ff).into(),
|
||||
editor_subheader: rgba(0x231f16ff).into(),
|
||||
editor_active_line: rgba(0x231f16ff).into(),
|
||||
terminal: rgba(0x1b1810ff).into(),
|
||||
image_fallback_background: rgba(0x2a261cff).into(),
|
||||
git_created: rgba(0x5dea5aff).into(),
|
||||
git_modified: rgba(0x499befff).into(),
|
||||
git_deleted: rgba(0xe35041ff).into(),
|
||||
git_conflict: rgba(0xf1fe28ff).into(),
|
||||
git_ignored: rgba(0x4c4735ff).into(),
|
||||
git_renamed: rgba(0xf1fe28ff).into(),
|
||||
players: [
|
||||
PlayerTheme {
|
||||
cursor: rgba(0x499befff).into(),
|
||||
selection: rgba(0x499bef3d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0x5dea5aff).into(),
|
||||
selection: rgba(0x5dea5a3d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0xf59be6ff).into(),
|
||||
selection: rgba(0xf59be63d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0xfaa11cff).into(),
|
||||
selection: rgba(0xfaa11c3d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0xfe8080ff).into(),
|
||||
selection: rgba(0xfe80803d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0x5aeabbff).into(),
|
||||
selection: rgba(0x5aeabb3d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0xe35041ff).into(),
|
||||
selection: rgba(0xe350413d).into(),
|
||||
},
|
||||
PlayerTheme {
|
||||
cursor: rgba(0xf1fe28ff).into(),
|
||||
selection: rgba(0xf1fe283d).into(),
|
||||
},
|
||||
],
|
||||
}
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
[package]
|
||||
name = "theme_converter"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
publish = false
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
anyhow.workspace = true
|
||||
clap = { version = "4.4", features = ["derive", "string"] }
|
||||
convert_case = "0.6.0"
|
||||
gpui2 = { path = "../gpui2" }
|
||||
log.workspace = true
|
||||
rust-embed.workspace = true
|
||||
serde.workspace = true
|
||||
simplelog = "0.9"
|
||||
theme2 = { path = "../theme2" }
|
||||
@@ -1,390 +0,0 @@
|
||||
mod theme_printer;
|
||||
|
||||
use std::borrow::Cow;
|
||||
use std::collections::HashMap;
|
||||
use std::fmt::{self, Debug};
|
||||
use std::fs::File;
|
||||
use std::io::Write;
|
||||
use std::path::PathBuf;
|
||||
use std::str::FromStr;
|
||||
|
||||
use anyhow::{anyhow, Context, Result};
|
||||
use clap::Parser;
|
||||
use convert_case::{Case, Casing};
|
||||
use gpui2::{hsla, rgb, serde_json, AssetSource, Hsla, SharedString};
|
||||
use log::LevelFilter;
|
||||
use rust_embed::RustEmbed;
|
||||
use serde::de::Visitor;
|
||||
use serde::{Deserialize, Deserializer};
|
||||
use simplelog::SimpleLogger;
|
||||
use theme2::{PlayerTheme, SyntaxTheme};
|
||||
|
||||
use crate::theme_printer::ThemePrinter;
|
||||
|
||||
#[derive(Parser)]
|
||||
#[command(author, version, about, long_about = None)]
|
||||
struct Args {
|
||||
/// The name of the theme to convert.
|
||||
theme: String,
|
||||
}
|
||||
|
||||
fn main() -> Result<()> {
|
||||
SimpleLogger::init(LevelFilter::Info, Default::default()).expect("could not initialize logger");
|
||||
|
||||
// let args = Args::parse();
|
||||
|
||||
let themes_path = PathBuf::from_str("crates/theme2/src/themes")?;
|
||||
|
||||
let mut theme_modules = Vec::new();
|
||||
|
||||
for theme_path in Assets.list("themes/")? {
|
||||
let (_, theme_name) = theme_path.split_once("themes/").unwrap();
|
||||
|
||||
if theme_name == ".gitkeep" {
|
||||
continue;
|
||||
}
|
||||
|
||||
let (json_theme, legacy_theme) = load_theme(&theme_path)?;
|
||||
|
||||
let theme = convert_theme(json_theme, legacy_theme)?;
|
||||
|
||||
let theme_slug = theme
|
||||
.metadata
|
||||
.name
|
||||
.as_ref()
|
||||
.replace("é", "e")
|
||||
.to_case(Case::Snake);
|
||||
|
||||
let mut output_file = File::create(themes_path.join(format!("{theme_slug}.rs")))?;
|
||||
|
||||
let theme_module = format!(
|
||||
r#"
|
||||
use gpui2::rgba;
|
||||
|
||||
use crate::{{PlayerTheme, SyntaxTheme, Theme, ThemeMetadata}};
|
||||
|
||||
pub fn {theme_slug}() -> Theme {{
|
||||
{theme_definition}
|
||||
}}
|
||||
"#,
|
||||
theme_definition = format!("{:#?}", ThemePrinter::new(theme))
|
||||
);
|
||||
|
||||
output_file.write_all(theme_module.as_bytes())?;
|
||||
|
||||
theme_modules.push(theme_slug);
|
||||
}
|
||||
|
||||
let mut mod_rs_file = File::create(themes_path.join(format!("mod.rs")))?;
|
||||
|
||||
let mod_rs_contents = format!(
|
||||
r#"
|
||||
{mod_statements}
|
||||
|
||||
{use_statements}
|
||||
"#,
|
||||
mod_statements = theme_modules
|
||||
.iter()
|
||||
.map(|module| format!("mod {module};"))
|
||||
.collect::<Vec<_>>()
|
||||
.join("\n"),
|
||||
use_statements = theme_modules
|
||||
.iter()
|
||||
.map(|module| format!("pub use {module}::*;"))
|
||||
.collect::<Vec<_>>()
|
||||
.join("\n")
|
||||
);
|
||||
|
||||
mod_rs_file.write_all(mod_rs_contents.as_bytes())?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[derive(RustEmbed)]
|
||||
#[folder = "../../assets"]
|
||||
#[include = "fonts/**/*"]
|
||||
#[include = "icons/**/*"]
|
||||
#[include = "themes/**/*"]
|
||||
#[include = "sounds/**/*"]
|
||||
#[include = "*.md"]
|
||||
#[exclude = "*.DS_Store"]
|
||||
pub struct Assets;
|
||||
|
||||
impl AssetSource for Assets {
|
||||
fn load(&self, path: &str) -> Result<Cow<[u8]>> {
|
||||
Self::get(path)
|
||||
.map(|f| f.data)
|
||||
.ok_or_else(|| anyhow!("could not find asset at path \"{}\"", path))
|
||||
}
|
||||
|
||||
fn list(&self, path: &str) -> Result<Vec<SharedString>> {
|
||||
Ok(Self::iter()
|
||||
.filter(|p| p.starts_with(path))
|
||||
.map(SharedString::from)
|
||||
.collect())
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy)]
|
||||
pub struct PlayerThemeColors {
|
||||
pub cursor: Hsla,
|
||||
pub selection: Hsla,
|
||||
}
|
||||
|
||||
impl PlayerThemeColors {
|
||||
pub fn new(theme: &LegacyTheme, ix: usize) -> Self {
|
||||
if ix < theme.players.len() {
|
||||
Self {
|
||||
cursor: theme.players[ix].cursor,
|
||||
selection: theme.players[ix].selection,
|
||||
}
|
||||
} else {
|
||||
Self {
|
||||
cursor: rgb::<Hsla>(0xff00ff),
|
||||
selection: rgb::<Hsla>(0xff00ff),
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<PlayerThemeColors> for PlayerTheme {
|
||||
fn from(value: PlayerThemeColors) -> Self {
|
||||
Self {
|
||||
cursor: value.cursor,
|
||||
selection: value.selection,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn convert_theme(json_theme: JsonTheme, legacy_theme: LegacyTheme) -> Result<theme2::Theme> {
|
||||
let transparent = hsla(0.0, 0.0, 0.0, 0.0);
|
||||
|
||||
let players: [PlayerTheme; 8] = [
|
||||
PlayerThemeColors::new(&legacy_theme, 0).into(),
|
||||
PlayerThemeColors::new(&legacy_theme, 1).into(),
|
||||
PlayerThemeColors::new(&legacy_theme, 2).into(),
|
||||
PlayerThemeColors::new(&legacy_theme, 3).into(),
|
||||
PlayerThemeColors::new(&legacy_theme, 4).into(),
|
||||
PlayerThemeColors::new(&legacy_theme, 5).into(),
|
||||
PlayerThemeColors::new(&legacy_theme, 6).into(),
|
||||
PlayerThemeColors::new(&legacy_theme, 7).into(),
|
||||
];
|
||||
|
||||
let theme = theme2::Theme {
|
||||
metadata: theme2::ThemeMetadata {
|
||||
name: legacy_theme.name.clone().into(),
|
||||
is_light: legacy_theme.is_light,
|
||||
},
|
||||
transparent,
|
||||
mac_os_traffic_light_red: rgb::<Hsla>(0xEC695E),
|
||||
mac_os_traffic_light_yellow: rgb::<Hsla>(0xF4BF4F),
|
||||
mac_os_traffic_light_green: rgb::<Hsla>(0x62C554),
|
||||
border: legacy_theme.lowest.base.default.border,
|
||||
border_variant: legacy_theme.lowest.variant.default.border,
|
||||
border_focused: legacy_theme.lowest.accent.default.border,
|
||||
border_transparent: transparent,
|
||||
elevated_surface: legacy_theme.lowest.base.default.background,
|
||||
surface: legacy_theme.middle.base.default.background,
|
||||
background: legacy_theme.lowest.base.default.background,
|
||||
filled_element: legacy_theme.lowest.base.default.background,
|
||||
filled_element_hover: hsla(0.0, 0.0, 100.0, 0.12),
|
||||
filled_element_active: hsla(0.0, 0.0, 100.0, 0.16),
|
||||
filled_element_selected: legacy_theme.lowest.accent.default.background,
|
||||
filled_element_disabled: transparent,
|
||||
ghost_element: transparent,
|
||||
ghost_element_hover: hsla(0.0, 0.0, 100.0, 0.08),
|
||||
ghost_element_active: hsla(0.0, 0.0, 100.0, 0.12),
|
||||
ghost_element_selected: legacy_theme.lowest.accent.default.background,
|
||||
ghost_element_disabled: transparent,
|
||||
text: legacy_theme.lowest.base.default.foreground,
|
||||
text_muted: legacy_theme.lowest.variant.default.foreground,
|
||||
/// TODO: map this to a real value
|
||||
text_placeholder: legacy_theme.lowest.negative.default.foreground,
|
||||
text_disabled: legacy_theme.lowest.base.disabled.foreground,
|
||||
text_accent: legacy_theme.lowest.accent.default.foreground,
|
||||
icon_muted: legacy_theme.lowest.variant.default.foreground,
|
||||
syntax: SyntaxTheme {
|
||||
highlights: json_theme
|
||||
.editor
|
||||
.syntax
|
||||
.iter()
|
||||
.map(|(token, style)| (token.clone(), style.color.clone().into()))
|
||||
.collect(),
|
||||
},
|
||||
status_bar: legacy_theme.lowest.base.default.background,
|
||||
title_bar: legacy_theme.lowest.base.default.background,
|
||||
toolbar: legacy_theme.highest.base.default.background,
|
||||
tab_bar: legacy_theme.middle.base.default.background,
|
||||
editor: legacy_theme.highest.base.default.background,
|
||||
editor_subheader: legacy_theme.middle.base.default.background,
|
||||
terminal: legacy_theme.highest.base.default.background,
|
||||
editor_active_line: legacy_theme.highest.on.default.background,
|
||||
image_fallback_background: legacy_theme.lowest.base.default.background,
|
||||
|
||||
git_created: legacy_theme.lowest.positive.default.foreground,
|
||||
git_modified: legacy_theme.lowest.accent.default.foreground,
|
||||
git_deleted: legacy_theme.lowest.negative.default.foreground,
|
||||
git_conflict: legacy_theme.lowest.warning.default.foreground,
|
||||
git_ignored: legacy_theme.lowest.base.disabled.foreground,
|
||||
git_renamed: legacy_theme.lowest.warning.default.foreground,
|
||||
|
||||
players,
|
||||
};
|
||||
|
||||
Ok(theme)
|
||||
}
|
||||
|
||||
#[derive(Deserialize)]
|
||||
struct JsonTheme {
|
||||
pub editor: JsonEditorTheme,
|
||||
pub base_theme: serde_json::Value,
|
||||
}
|
||||
|
||||
#[derive(Deserialize)]
|
||||
struct JsonEditorTheme {
|
||||
pub syntax: HashMap<String, JsonSyntaxStyle>,
|
||||
}
|
||||
|
||||
#[derive(Deserialize)]
|
||||
struct JsonSyntaxStyle {
|
||||
pub color: Hsla,
|
||||
}
|
||||
|
||||
/// Loads the [`Theme`] with the given name.
|
||||
fn load_theme(theme_path: &str) -> Result<(JsonTheme, LegacyTheme)> {
|
||||
let theme_contents =
|
||||
Assets::get(theme_path).with_context(|| format!("theme file not found: '{theme_path}'"))?;
|
||||
|
||||
let json_theme: JsonTheme = serde_json::from_str(std::str::from_utf8(&theme_contents.data)?)
|
||||
.context("failed to parse legacy theme")?;
|
||||
|
||||
let legacy_theme: LegacyTheme = serde_json::from_value(json_theme.base_theme.clone())
|
||||
.context("failed to parse `base_theme`")?;
|
||||
|
||||
Ok((json_theme, legacy_theme))
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Clone, Default, Debug)]
|
||||
pub struct LegacyTheme {
|
||||
pub name: String,
|
||||
pub is_light: bool,
|
||||
pub lowest: Layer,
|
||||
pub middle: Layer,
|
||||
pub highest: Layer,
|
||||
pub popover_shadow: Shadow,
|
||||
pub modal_shadow: Shadow,
|
||||
#[serde(deserialize_with = "deserialize_player_colors")]
|
||||
pub players: Vec<PlayerColors>,
|
||||
#[serde(deserialize_with = "deserialize_syntax_colors")]
|
||||
pub syntax: HashMap<String, Hsla>,
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Clone, Default, Debug)]
|
||||
pub struct Layer {
|
||||
pub base: StyleSet,
|
||||
pub variant: StyleSet,
|
||||
pub on: StyleSet,
|
||||
pub accent: StyleSet,
|
||||
pub positive: StyleSet,
|
||||
pub warning: StyleSet,
|
||||
pub negative: StyleSet,
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Clone, Default, Debug)]
|
||||
pub struct StyleSet {
|
||||
#[serde(rename = "default")]
|
||||
pub default: ContainerColors,
|
||||
pub hovered: ContainerColors,
|
||||
pub pressed: ContainerColors,
|
||||
pub active: ContainerColors,
|
||||
pub disabled: ContainerColors,
|
||||
pub inverted: ContainerColors,
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Clone, Default, Debug)]
|
||||
pub struct ContainerColors {
|
||||
pub background: Hsla,
|
||||
pub foreground: Hsla,
|
||||
pub border: Hsla,
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Clone, Default, Debug)]
|
||||
pub struct PlayerColors {
|
||||
pub selection: Hsla,
|
||||
pub cursor: Hsla,
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Clone, Default, Debug)]
|
||||
pub struct Shadow {
|
||||
pub blur: u8,
|
||||
pub color: Hsla,
|
||||
pub offset: Vec<u8>,
|
||||
}
|
||||
|
||||
fn deserialize_player_colors<'de, D>(deserializer: D) -> Result<Vec<PlayerColors>, D::Error>
|
||||
where
|
||||
D: Deserializer<'de>,
|
||||
{
|
||||
struct PlayerArrayVisitor;
|
||||
|
||||
impl<'de> Visitor<'de> for PlayerArrayVisitor {
|
||||
type Value = Vec<PlayerColors>;
|
||||
|
||||
fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
|
||||
formatter.write_str("an object with integer keys")
|
||||
}
|
||||
|
||||
fn visit_map<A: serde::de::MapAccess<'de>>(
|
||||
self,
|
||||
mut map: A,
|
||||
) -> Result<Self::Value, A::Error> {
|
||||
let mut players = Vec::with_capacity(8);
|
||||
while let Some((key, value)) = map.next_entry::<usize, PlayerColors>()? {
|
||||
if key < 8 {
|
||||
players.push(value);
|
||||
} else {
|
||||
return Err(serde::de::Error::invalid_value(
|
||||
serde::de::Unexpected::Unsigned(key as u64),
|
||||
&"a key in range 0..7",
|
||||
));
|
||||
}
|
||||
}
|
||||
Ok(players)
|
||||
}
|
||||
}
|
||||
|
||||
deserializer.deserialize_map(PlayerArrayVisitor)
|
||||
}
|
||||
|
||||
fn deserialize_syntax_colors<'de, D>(deserializer: D) -> Result<HashMap<String, Hsla>, D::Error>
|
||||
where
|
||||
D: serde::Deserializer<'de>,
|
||||
{
|
||||
#[derive(Deserialize)]
|
||||
struct ColorWrapper {
|
||||
color: Hsla,
|
||||
}
|
||||
|
||||
struct SyntaxVisitor;
|
||||
|
||||
impl<'de> Visitor<'de> for SyntaxVisitor {
|
||||
type Value = HashMap<String, Hsla>;
|
||||
|
||||
fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
|
||||
formatter.write_str("a map with keys and objects with a single color field as values")
|
||||
}
|
||||
|
||||
fn visit_map<M>(self, mut map: M) -> Result<HashMap<String, Hsla>, M::Error>
|
||||
where
|
||||
M: serde::de::MapAccess<'de>,
|
||||
{
|
||||
let mut result = HashMap::new();
|
||||
while let Some(key) = map.next_key()? {
|
||||
let wrapper: ColorWrapper = map.next_value()?; // Deserialize values as Hsla
|
||||
result.insert(key, wrapper.color);
|
||||
}
|
||||
Ok(result)
|
||||
}
|
||||
}
|
||||
deserializer.deserialize_map(SyntaxVisitor)
|
||||
}
|
||||
@@ -1,174 +0,0 @@
|
||||
use std::fmt::{self, Debug};
|
||||
|
||||
use gpui2::{Hsla, Rgba};
|
||||
use theme2::{PlayerTheme, SyntaxTheme, Theme, ThemeMetadata};
|
||||
|
||||
pub struct ThemePrinter(Theme);
|
||||
|
||||
impl ThemePrinter {
|
||||
pub fn new(theme: Theme) -> Self {
|
||||
Self(theme)
|
||||
}
|
||||
}
|
||||
|
||||
struct HslaPrinter(Hsla);
|
||||
|
||||
impl Debug for HslaPrinter {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
write!(f, "{:?}", IntoPrinter(&Rgba::from(self.0)))
|
||||
}
|
||||
}
|
||||
|
||||
struct IntoPrinter<'a, D: Debug>(&'a D);
|
||||
|
||||
impl<'a, D: Debug> Debug for IntoPrinter<'a, D> {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
write!(f, "{:?}.into()", self.0)
|
||||
}
|
||||
}
|
||||
|
||||
impl Debug for ThemePrinter {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
f.debug_struct("Theme")
|
||||
.field("metadata", &ThemeMetadataPrinter(self.0.metadata.clone()))
|
||||
.field("transparent", &HslaPrinter(self.0.transparent))
|
||||
.field(
|
||||
"mac_os_traffic_light_red",
|
||||
&HslaPrinter(self.0.mac_os_traffic_light_red),
|
||||
)
|
||||
.field(
|
||||
"mac_os_traffic_light_yellow",
|
||||
&HslaPrinter(self.0.mac_os_traffic_light_yellow),
|
||||
)
|
||||
.field(
|
||||
"mac_os_traffic_light_green",
|
||||
&HslaPrinter(self.0.mac_os_traffic_light_green),
|
||||
)
|
||||
.field("border", &HslaPrinter(self.0.border))
|
||||
.field("border_variant", &HslaPrinter(self.0.border_variant))
|
||||
.field("border_focused", &HslaPrinter(self.0.border_focused))
|
||||
.field(
|
||||
"border_transparent",
|
||||
&HslaPrinter(self.0.border_transparent),
|
||||
)
|
||||
.field("elevated_surface", &HslaPrinter(self.0.elevated_surface))
|
||||
.field("surface", &HslaPrinter(self.0.surface))
|
||||
.field("background", &HslaPrinter(self.0.background))
|
||||
.field("filled_element", &HslaPrinter(self.0.filled_element))
|
||||
.field(
|
||||
"filled_element_hover",
|
||||
&HslaPrinter(self.0.filled_element_hover),
|
||||
)
|
||||
.field(
|
||||
"filled_element_active",
|
||||
&HslaPrinter(self.0.filled_element_active),
|
||||
)
|
||||
.field(
|
||||
"filled_element_selected",
|
||||
&HslaPrinter(self.0.filled_element_selected),
|
||||
)
|
||||
.field(
|
||||
"filled_element_disabled",
|
||||
&HslaPrinter(self.0.filled_element_disabled),
|
||||
)
|
||||
.field("ghost_element", &HslaPrinter(self.0.ghost_element))
|
||||
.field(
|
||||
"ghost_element_hover",
|
||||
&HslaPrinter(self.0.ghost_element_hover),
|
||||
)
|
||||
.field(
|
||||
"ghost_element_active",
|
||||
&HslaPrinter(self.0.ghost_element_active),
|
||||
)
|
||||
.field(
|
||||
"ghost_element_selected",
|
||||
&HslaPrinter(self.0.ghost_element_selected),
|
||||
)
|
||||
.field(
|
||||
"ghost_element_disabled",
|
||||
&HslaPrinter(self.0.ghost_element_disabled),
|
||||
)
|
||||
.field("text", &HslaPrinter(self.0.text))
|
||||
.field("text_muted", &HslaPrinter(self.0.text_muted))
|
||||
.field("text_placeholder", &HslaPrinter(self.0.text_placeholder))
|
||||
.field("text_disabled", &HslaPrinter(self.0.text_disabled))
|
||||
.field("text_accent", &HslaPrinter(self.0.text_accent))
|
||||
.field("icon_muted", &HslaPrinter(self.0.icon_muted))
|
||||
.field("syntax", &SyntaxThemePrinter(self.0.syntax.clone()))
|
||||
.field("status_bar", &HslaPrinter(self.0.status_bar))
|
||||
.field("title_bar", &HslaPrinter(self.0.title_bar))
|
||||
.field("toolbar", &HslaPrinter(self.0.toolbar))
|
||||
.field("tab_bar", &HslaPrinter(self.0.tab_bar))
|
||||
.field("editor", &HslaPrinter(self.0.editor))
|
||||
.field("editor_subheader", &HslaPrinter(self.0.editor_subheader))
|
||||
.field(
|
||||
"editor_active_line",
|
||||
&HslaPrinter(self.0.editor_active_line),
|
||||
)
|
||||
.field("terminal", &HslaPrinter(self.0.terminal))
|
||||
.field(
|
||||
"image_fallback_background",
|
||||
&HslaPrinter(self.0.image_fallback_background),
|
||||
)
|
||||
.field("git_created", &HslaPrinter(self.0.git_created))
|
||||
.field("git_modified", &HslaPrinter(self.0.git_modified))
|
||||
.field("git_deleted", &HslaPrinter(self.0.git_deleted))
|
||||
.field("git_conflict", &HslaPrinter(self.0.git_conflict))
|
||||
.field("git_ignored", &HslaPrinter(self.0.git_ignored))
|
||||
.field("git_renamed", &HslaPrinter(self.0.git_renamed))
|
||||
.field("players", &self.0.players.map(PlayerThemePrinter))
|
||||
.finish()
|
||||
}
|
||||
}
|
||||
|
||||
pub struct ThemeMetadataPrinter(ThemeMetadata);
|
||||
|
||||
impl Debug for ThemeMetadataPrinter {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
f.debug_struct("ThemeMetadata")
|
||||
.field("name", &IntoPrinter(&self.0.name))
|
||||
.field("is_light", &self.0.is_light)
|
||||
.finish()
|
||||
}
|
||||
}
|
||||
|
||||
pub struct SyntaxThemePrinter(SyntaxTheme);
|
||||
|
||||
impl Debug for SyntaxThemePrinter {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
f.debug_struct("SyntaxTheme")
|
||||
.field(
|
||||
"highlights",
|
||||
&VecPrinter(
|
||||
&self
|
||||
.0
|
||||
.highlights
|
||||
.iter()
|
||||
.map(|(token, highlight)| {
|
||||
(IntoPrinter(token), HslaPrinter(highlight.color.unwrap()))
|
||||
})
|
||||
.collect(),
|
||||
),
|
||||
)
|
||||
.finish()
|
||||
}
|
||||
}
|
||||
|
||||
pub struct VecPrinter<'a, T>(&'a Vec<T>);
|
||||
|
||||
impl<'a, T: Debug> Debug for VecPrinter<'a, T> {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
write!(f, "vec!{:?}", &self.0)
|
||||
}
|
||||
}
|
||||
|
||||
pub struct PlayerThemePrinter(PlayerTheme);
|
||||
|
||||
impl Debug for PlayerThemePrinter {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
f.debug_struct("PlayerTheme")
|
||||
.field("cursor", &HslaPrinter(self.0.cursor))
|
||||
.field("selection", &HslaPrinter(self.0.selection))
|
||||
.finish()
|
||||
}
|
||||
}
|
||||
@@ -10,6 +10,7 @@ chrono = "0.4"
|
||||
gpui2 = { path = "../gpui2" }
|
||||
itertools = { version = "0.11.0", optional = true }
|
||||
serde.workspace = true
|
||||
settings2 = { path = "../settings2" }
|
||||
smallvec.workspace = true
|
||||
strum = { version = "0.25.0", features = ["derive"] }
|
||||
theme2 = { path = "../theme2" }
|
||||
|
||||
@@ -19,24 +19,22 @@ impl Breadcrumb {
|
||||
}
|
||||
|
||||
fn render_separator<V: 'static>(&self, cx: &WindowContext) -> Div<V> {
|
||||
let theme = theme(cx);
|
||||
|
||||
div().child(" › ").text_color(theme.text_muted)
|
||||
div()
|
||||
.child(" › ")
|
||||
.text_color(cx.theme().colors().text_muted)
|
||||
}
|
||||
|
||||
fn render<V: 'static>(self, view_state: &mut V, cx: &mut ViewContext<V>) -> impl Component<V> {
|
||||
let theme = theme(cx);
|
||||
|
||||
let symbols_len = self.symbols.len();
|
||||
|
||||
h_stack()
|
||||
.id("breadcrumb")
|
||||
.px_1()
|
||||
.text_sm()
|
||||
.text_color(theme.text_muted)
|
||||
.text_color(cx.theme().colors().text_muted)
|
||||
.rounded_md()
|
||||
.hover(|style| style.bg(theme.ghost_element_hover))
|
||||
.active(|style| style.bg(theme.ghost_element_active))
|
||||
.hover(|style| style.bg(cx.theme().colors().ghost_element_hover))
|
||||
.active(|style| style.bg(cx.theme().colors().ghost_element_active))
|
||||
.child(self.path.clone().to_str().unwrap().to_string())
|
||||
.child(if !self.symbols.is_empty() {
|
||||
self.render_separator(cx)
|
||||
@@ -84,8 +82,6 @@ mod stories {
|
||||
type Element = Div<Self>;
|
||||
|
||||
fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Element {
|
||||
let theme = theme(cx);
|
||||
|
||||
Story::container(cx)
|
||||
.child(Story::title_for::<_, Breadcrumb>(cx))
|
||||
.child(Story::label(cx, "Default"))
|
||||
@@ -95,21 +91,21 @@ mod stories {
|
||||
Symbol(vec![
|
||||
HighlightedText {
|
||||
text: "impl ".to_string(),
|
||||
color: theme.syntax.color("keyword"),
|
||||
color: cx.theme().syntax_color("keyword"),
|
||||
},
|
||||
HighlightedText {
|
||||
text: "BreadcrumbStory".to_string(),
|
||||
color: theme.syntax.color("function"),
|
||||
color: cx.theme().syntax_color("function"),
|
||||
},
|
||||
]),
|
||||
Symbol(vec![
|
||||
HighlightedText {
|
||||
text: "fn ".to_string(),
|
||||
color: theme.syntax.color("keyword"),
|
||||
color: cx.theme().syntax_color("keyword"),
|
||||
},
|
||||
HighlightedText {
|
||||
text: "render".to_string(),
|
||||
color: theme.syntax.color("function"),
|
||||
color: cx.theme().syntax_color("function"),
|
||||
},
|
||||
]),
|
||||
],
|
||||
|
||||
@@ -155,18 +155,16 @@ impl Buffer {
|
||||
}
|
||||
|
||||
fn render_row<V: 'static>(row: BufferRow, cx: &WindowContext) -> impl Component<V> {
|
||||
let theme = theme(cx);
|
||||
|
||||
let line_background = if row.current {
|
||||
theme.editor_active_line
|
||||
cx.theme().colors().editor_active_line
|
||||
} else {
|
||||
theme.transparent
|
||||
cx.theme().styles.system.transparent
|
||||
};
|
||||
|
||||
let line_number_color = if row.current {
|
||||
theme.text
|
||||
cx.theme().colors().text
|
||||
} else {
|
||||
theme.syntax.get("comment").color.unwrap_or_default()
|
||||
cx.theme().syntax_color("comment")
|
||||
};
|
||||
|
||||
h_stack()
|
||||
@@ -216,14 +214,13 @@ impl Buffer {
|
||||
}
|
||||
|
||||
fn render<V: 'static>(self, _view: &mut V, cx: &mut ViewContext<V>) -> impl Component<V> {
|
||||
let theme = theme(cx);
|
||||
let rows = self.render_rows(cx);
|
||||
|
||||
v_stack()
|
||||
.flex_1()
|
||||
.w_full()
|
||||
.h_full()
|
||||
.bg(theme.editor)
|
||||
.bg(cx.theme().colors().editor)
|
||||
.children(rows)
|
||||
}
|
||||
}
|
||||
@@ -246,8 +243,6 @@ mod stories {
|
||||
type Element = Div<Self>;
|
||||
|
||||
fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Element {
|
||||
let theme = theme(cx);
|
||||
|
||||
Story::container(cx)
|
||||
.child(Story::title_for::<_, Buffer>(cx))
|
||||
.child(Story::label(cx, "Default"))
|
||||
@@ -257,14 +252,14 @@ mod stories {
|
||||
div()
|
||||
.w(rems(64.))
|
||||
.h_96()
|
||||
.child(hello_world_rust_buffer_example(&theme)),
|
||||
.child(hello_world_rust_buffer_example(cx)),
|
||||
)
|
||||
.child(Story::label(cx, "Hello World (Rust) with Status"))
|
||||
.child(
|
||||
div()
|
||||
.w(rems(64.))
|
||||
.h_96()
|
||||
.child(hello_world_rust_buffer_with_status_example(&theme)),
|
||||
.child(hello_world_rust_buffer_with_status_example(cx)),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,9 +30,7 @@ impl Render for BufferSearch {
|
||||
type Element = Div<Self>;
|
||||
|
||||
fn render(&mut self, cx: &mut ViewContext<Self>) -> Div<Self> {
|
||||
let theme = theme(cx);
|
||||
|
||||
h_stack().bg(theme.toolbar).p_2().child(
|
||||
h_stack().bg(cx.theme().colors().toolbar).p_2().child(
|
||||
h_stack().child(Input::new("Search")).child(
|
||||
IconButton::<Self>::new("replace", Icon::Replace)
|
||||
.when(self.is_replace_open, |this| this.color(IconColor::Accent))
|
||||
|
||||
@@ -15,27 +15,29 @@ impl CollabPanel {
|
||||
}
|
||||
|
||||
fn render<V: 'static>(self, _view: &mut V, cx: &mut ViewContext<V>) -> impl Component<V> {
|
||||
let theme = theme(cx);
|
||||
|
||||
v_stack()
|
||||
.id(self.id.clone())
|
||||
.h_full()
|
||||
.bg(theme.surface)
|
||||
.bg(cx.theme().colors().surface)
|
||||
.child(
|
||||
v_stack()
|
||||
.id("crdb")
|
||||
.w_full()
|
||||
.overflow_y_scroll()
|
||||
.child(
|
||||
div().pb_1().border_color(theme.border).border_b().child(
|
||||
List::new(static_collab_panel_current_call())
|
||||
.header(
|
||||
ListHeader::new("CRDB")
|
||||
.left_icon(Icon::Hash.into())
|
||||
.toggle(ToggleState::Toggled),
|
||||
)
|
||||
.toggle(ToggleState::Toggled),
|
||||
),
|
||||
div()
|
||||
.pb_1()
|
||||
.border_color(cx.theme().colors().border)
|
||||
.border_b()
|
||||
.child(
|
||||
List::new(static_collab_panel_current_call())
|
||||
.header(
|
||||
ListHeader::new("CRDB")
|
||||
.left_icon(Icon::Hash.into())
|
||||
.toggle(ToggleState::Toggled),
|
||||
)
|
||||
.toggle(ToggleState::Toggled),
|
||||
),
|
||||
)
|
||||
.child(
|
||||
v_stack().id("channels").py_1().child(
|
||||
@@ -71,13 +73,13 @@ impl CollabPanel {
|
||||
.h_7()
|
||||
.px_2()
|
||||
.border_t()
|
||||
.border_color(theme.border)
|
||||
.border_color(cx.theme().colors().border)
|
||||
.flex()
|
||||
.items_center()
|
||||
.child(
|
||||
div()
|
||||
.text_sm()
|
||||
.text_color(theme.text_placeholder)
|
||||
.text_color(cx.theme().colors().text_placeholder)
|
||||
.child("Find..."),
|
||||
),
|
||||
)
|
||||
|
||||
@@ -44,13 +44,11 @@ impl ContextMenu {
|
||||
}
|
||||
|
||||
fn render<V: 'static>(self, _view: &mut V, cx: &mut ViewContext<V>) -> impl Component<V> {
|
||||
let theme = theme(cx);
|
||||
|
||||
v_stack()
|
||||
.flex()
|
||||
.bg(theme.elevated_surface)
|
||||
.bg(cx.theme().colors().elevated_surface)
|
||||
.border()
|
||||
.border_color(theme.border)
|
||||
.border_color(cx.theme().colors().border)
|
||||
.child(
|
||||
List::new(
|
||||
self.items
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
use std::sync::Arc;
|
||||
|
||||
use gpui2::MouseButton;
|
||||
use gpui2::{rems, MouseButton};
|
||||
|
||||
use crate::{h_stack, prelude::*};
|
||||
use crate::{ClickHandler, Icon, IconColor, IconElement};
|
||||
@@ -66,8 +66,6 @@ impl<V: 'static> IconButton<V> {
|
||||
}
|
||||
|
||||
fn render(self, _view: &mut V, cx: &mut ViewContext<V>) -> impl Component<V> {
|
||||
let theme = theme(cx);
|
||||
|
||||
let icon_color = match (self.state, self.color) {
|
||||
(InteractionState::Disabled, _) => IconColor::Disabled,
|
||||
_ => self.color,
|
||||
@@ -75,14 +73,14 @@ impl<V: 'static> IconButton<V> {
|
||||
|
||||
let (bg_color, bg_hover_color, bg_active_color) = match self.variant {
|
||||
ButtonVariant::Filled => (
|
||||
theme.filled_element,
|
||||
theme.filled_element_hover,
|
||||
theme.filled_element_active,
|
||||
cx.theme().colors().element,
|
||||
cx.theme().colors().element_hover,
|
||||
cx.theme().colors().element_active,
|
||||
),
|
||||
ButtonVariant::Ghost => (
|
||||
theme.ghost_element,
|
||||
theme.ghost_element_hover,
|
||||
theme.ghost_element_active,
|
||||
cx.theme().colors().ghost_element,
|
||||
cx.theme().colors().ghost_element_hover,
|
||||
cx.theme().colors().ghost_element_active,
|
||||
),
|
||||
};
|
||||
|
||||
@@ -90,8 +88,8 @@ impl<V: 'static> IconButton<V> {
|
||||
.id(self.id.clone())
|
||||
.justify_center()
|
||||
.rounded_md()
|
||||
.py(ui_size(cx, 0.25))
|
||||
.px(ui_size(cx, 6. / 14.))
|
||||
.py(rems(0.21875))
|
||||
.px(rems(0.375))
|
||||
.bg(bg_color)
|
||||
.hover(|style| style.bg(bg_hover_color))
|
||||
.active(|style| style.bg(bg_active_color))
|
||||
|
||||
@@ -60,15 +60,13 @@ impl Key {
|
||||
}
|
||||
|
||||
fn render<V: 'static>(self, _view: &mut V, cx: &mut ViewContext<V>) -> impl Component<V> {
|
||||
let theme = theme(cx);
|
||||
|
||||
div()
|
||||
.px_2()
|
||||
.py_0()
|
||||
.rounded_md()
|
||||
.text_sm()
|
||||
.text_color(theme.text)
|
||||
.bg(theme.filled_element)
|
||||
.text_color(cx.theme().colors().text)
|
||||
.bg(cx.theme().colors().element)
|
||||
.child(self.key.clone())
|
||||
}
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user