audit select
This commit is contained in:
@@ -101,18 +101,18 @@ impl Default for Radius {
|
||||
pub struct Borders {
|
||||
/// Filled actions keep a border (Windows, KDE).
|
||||
pub buttons: bool,
|
||||
/// Text fields and selects keep a border (Windows, KDE; the macOS
|
||||
/// hairline bezel).
|
||||
/// Text fields and selects keep a border.
|
||||
pub fields: bool,
|
||||
/// Floating layers keep a border (Windows, KDE).
|
||||
/// Floating layers keep a border.
|
||||
pub overlays: bool,
|
||||
/// Keyboard focus paints an accent ring around the control (macOS,
|
||||
/// GNOME); otherwise focus re-colors the border (Windows, KDE).
|
||||
/// Keyboard focus paints an accent ring around the control.
|
||||
pub focus_ring: bool,
|
||||
}
|
||||
|
||||
impl Borders {
|
||||
pub(crate) fn for_platform(source: SourceKind) -> Self {
|
||||
pub(crate) fn for_platform(source: SourceKind, variant: ThemeVariant) -> Self {
|
||||
let overlays = variant == ThemeVariant::Dark;
|
||||
|
||||
match source {
|
||||
SourceKind::Windows | SourceKind::Kde => Self {
|
||||
buttons: true,
|
||||
@@ -123,13 +123,13 @@ impl Borders {
|
||||
SourceKind::Macos => Self {
|
||||
buttons: false,
|
||||
fields: true,
|
||||
overlays: false,
|
||||
overlays,
|
||||
focus_ring: true,
|
||||
},
|
||||
SourceKind::Omarchy | SourceKind::Gnome => Self {
|
||||
buttons: false,
|
||||
fields: false,
|
||||
overlays: false,
|
||||
overlays,
|
||||
focus_ring: true,
|
||||
},
|
||||
SourceKind::Fallback => Self {
|
||||
|
||||
@@ -275,7 +275,7 @@ pub(crate) fn resolve(
|
||||
},
|
||||
colors,
|
||||
radius,
|
||||
borders: Borders::for_platform(system.source),
|
||||
borders: Borders::for_platform(system.source, variant),
|
||||
spacing: Spacing {
|
||||
unit: system.source.spacing_unit(),
|
||||
},
|
||||
@@ -535,6 +535,19 @@ mod tests {
|
||||
assert_eq!(unit, px(4.));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn dark_mode_separates_overlays_by_border() {
|
||||
for source in [SourceKind::Macos, SourceKind::Gnome, SourceKind::Omarchy] {
|
||||
let mut stated = system(ThemeVariant::Dark, PartialPalette::default(), None);
|
||||
stated.source = source;
|
||||
let resolved = resolve(&stated, None, None);
|
||||
assert!(
|
||||
resolved.borders.overlays,
|
||||
"{source:?} frames floating layers in dark"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn overlay_is_translucent_and_overridable() {
|
||||
let light = resolve(
|
||||
|
||||
Reference in New Issue
Block a user