Some checks failed
Update All Top Ranking Issues / update_top_ranking_issues (push) Has been cancelled
Triage Project Sync (#84) / Sync triage project (push) Has been cancelled
release_nightly / notify_on_failure (push) Has been cancelled
release_nightly / check_style (push) Has been cancelled
release_nightly / run_tests_windows (push) Has been cancelled
release_nightly / clippy_windows (push) Has been cancelled
release_nightly / bundle_linux_aarch64 (push) Has been cancelled
release_nightly / bundle_linux_x86_64 (push) Has been cancelled
release_nightly / bundle_mac_aarch64 (push) Has been cancelled
release_nightly / bundle_mac_x86_64 (push) Has been cancelled
release_nightly / bundle_windows_aarch64 (push) Has been cancelled
release_nightly / bundle_windows_x86_64 (push) Has been cancelled
release_nightly / build_nix_linux_x86_64 (push) Has been cancelled
release_nightly / build_nix_mac_aarch64 (push) Has been cancelled
release_nightly / update_nightly_tag (push) Has been cancelled
Hotfix Review Monitor / check-hotfix-reviews (push) Has been cancelled
Stale PR Review Reminder / check-stale-prs (push) Has been cancelled
Update Weekly Top Ranking Issues / update_top_ranking_issues (push) Has been cancelled
Bump collab-staging Tag / update-collab-staging-tag (push) Has been cancelled
compliance_check / scheduled_compliance_check (push) Has been cancelled
Single-commit orphan branch: full zed-industries/zed @ 8c74db0 source tree with a 3-file patch applied (no upstream history). Patch (crates/gpui_linux/src/linux/wayland/): - serial.rs: add SerialKind::KeyboardEnter - client.rs: store wl_keyboard.enter serial; add latest_serial_of() - window.rs: activate() uses keyboard-enter serial (Mutter focus gate) Mutter honors window activation only when the token carries the keyboard- focus serial from wl_keyboard.enter; GPUI used a stale mouse-press serial. See docs/tray-window-focus-wayland.md in logiguard. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
69 lines
2.0 KiB
Rust
69 lines
2.0 KiB
Rust
use std::sync::Arc;
|
|
|
|
use gpui::Hsla;
|
|
use serde::Deserialize;
|
|
|
|
use crate::{
|
|
amber, blue, cyan, gold, grass, indigo, iris, jade, lime, orange, pink, purple, tomato,
|
|
};
|
|
|
|
/// A collection of colors that are used to color indent aware lines in the editor.
|
|
#[derive(Clone, Debug, Deserialize, PartialEq)]
|
|
pub struct AccentColors(pub Arc<[Hsla]>);
|
|
|
|
impl Default for AccentColors {
|
|
/// Don't use this!
|
|
/// We have to have a default to be `[refineable::Refinable]`.
|
|
/// TODO "Find a way to not need this for Refinable"
|
|
fn default() -> Self {
|
|
Self::dark()
|
|
}
|
|
}
|
|
|
|
impl AccentColors {
|
|
/// Returns the set of dark accent colors.
|
|
pub fn dark() -> Self {
|
|
Self(Arc::from(vec![
|
|
blue().dark().step_9(),
|
|
orange().dark().step_9(),
|
|
pink().dark().step_9(),
|
|
lime().dark().step_9(),
|
|
purple().dark().step_9(),
|
|
amber().dark().step_9(),
|
|
jade().dark().step_9(),
|
|
tomato().dark().step_9(),
|
|
cyan().dark().step_9(),
|
|
gold().dark().step_9(),
|
|
grass().dark().step_9(),
|
|
indigo().dark().step_9(),
|
|
iris().dark().step_9(),
|
|
]))
|
|
}
|
|
|
|
/// Returns the set of light accent colors.
|
|
pub fn light() -> Self {
|
|
Self(Arc::from(vec![
|
|
blue().light().step_9(),
|
|
orange().light().step_9(),
|
|
pink().light().step_9(),
|
|
lime().light().step_9(),
|
|
purple().light().step_9(),
|
|
amber().light().step_9(),
|
|
jade().light().step_9(),
|
|
tomato().light().step_9(),
|
|
cyan().light().step_9(),
|
|
gold().light().step_9(),
|
|
grass().light().step_9(),
|
|
indigo().light().step_9(),
|
|
iris().light().step_9(),
|
|
]))
|
|
}
|
|
}
|
|
|
|
impl AccentColors {
|
|
/// Returns the color for the given index.
|
|
pub fn color_for_index(&self, index: u32) -> Hsla {
|
|
self.0[index as usize % self.0.len()]
|
|
}
|
|
}
|