chore: audit all components (#2)
Reviewed-on: #2
This commit was merged in pull request #2.
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
//! The normalized snapshot a platform adapter produces.
|
||||
|
||||
use gpui::{Hsla, Pixels};
|
||||
use gpui::{Hsla, Pixels, px};
|
||||
|
||||
use crate::ThemeVariant;
|
||||
|
||||
@@ -43,6 +43,17 @@ impl SourceKind {
|
||||
pub fn scrollbar_autohide(self) -> bool {
|
||||
matches!(self, Self::Macos | Self::Omarchy | Self::Gnome)
|
||||
}
|
||||
|
||||
/// The base spacing unit:
|
||||
///
|
||||
/// - GNOME lays out on a 6px grid
|
||||
/// - Other platform on 4px grid
|
||||
pub fn spacing_unit(self) -> Pixels {
|
||||
match self {
|
||||
Self::Gnome | Self::Omarchy => px(6.),
|
||||
_ => px(4.),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// A partial palette with optional colors.
|
||||
@@ -83,8 +94,22 @@ pub struct SystemTheme {
|
||||
pub palette: PartialPalette,
|
||||
/// The platform's stated control corner radius, if it has one.
|
||||
pub control_radius: Option<Pixels>,
|
||||
/// The platform's stated menu/popover radius, if it has one.
|
||||
pub overlay_radius: Option<Pixels>,
|
||||
/// The platform's stated checkbox radius, if it has one.
|
||||
pub sm_radius: Option<Pixels>,
|
||||
/// The platform's stated control height, if it has one.
|
||||
pub control_height: Option<Pixels>,
|
||||
/// The platform's stated text-field height, if it has one.
|
||||
pub input_height: Option<Pixels>,
|
||||
/// The platform's stated menu row height, if it has one.
|
||||
pub menu_item_height: Option<Pixels>,
|
||||
/// The platform's stated switch track height, if it has one.
|
||||
pub switch_height: Option<Pixels>,
|
||||
/// The platform's stated switch track width, if it has one.
|
||||
pub switch_width: Option<Pixels>,
|
||||
/// The platform's stated switch knob size, if it has one.
|
||||
pub switch_knob: Option<Pixels>,
|
||||
/// The platform's native titlebar height, if it states one.
|
||||
pub titlebar_height: Option<Pixels>,
|
||||
/// The platform's native root font size, if it has one.
|
||||
@@ -100,7 +125,14 @@ impl SystemTheme {
|
||||
accent: None,
|
||||
palette: PartialPalette::default(),
|
||||
control_radius: None,
|
||||
overlay_radius: None,
|
||||
sm_radius: None,
|
||||
control_height: None,
|
||||
input_height: None,
|
||||
menu_item_height: None,
|
||||
switch_height: None,
|
||||
switch_width: None,
|
||||
switch_knob: None,
|
||||
titlebar_height: None,
|
||||
root_font_size: None,
|
||||
accessibility: AccessibilityPreferences::default(),
|
||||
|
||||
Reference in New Issue
Block a user