add popover

This commit is contained in:
2026-10-29 18:13:39 +07:00
parent 2ecde30ae2
commit 8fffbdcecb
9 changed files with 198 additions and 5 deletions
+10 -1
View File
@@ -1,12 +1,17 @@
//! Semantic color roles. This module is the only place in the workspace
//! allowed to hold color literals.
use gpui::{Hsla, rgb};
use gpui::{Hsla, hsla, rgb};
fn hex(hex: u32) -> Hsla {
rgb(hex).into()
}
/// The dim scrim behind modal layers; always a translucent black.
pub(crate) fn scrim(alpha: f32) -> Hsla {
hsla(0., 0., 0., alpha)
}
/// The semantic color roles components paint from.
#[derive(Clone, Copy, Debug, PartialEq)]
pub struct ColorTokens {
@@ -28,6 +33,8 @@ pub struct ColorTokens {
pub input: Hsla,
pub ring: Hsla,
pub selection: Hsla,
/// The scrim behind modal layers; translucent in every theme.
pub overlay: Hsla,
}
impl ColorTokens {
@@ -52,6 +59,7 @@ impl ColorTokens {
input: hex(0xe4e4e7),
ring: hex(0x93c5fd),
selection: hex(0xdbeafe),
overlay: scrim(0.25),
}
}
@@ -76,6 +84,7 @@ impl ColorTokens {
input: hex(0x27272a),
ring: hex(0x1d4ed8),
selection: hex(0x1e3a8a),
overlay: scrim(0.45),
}
}
}