From b3bef345a55984d5b15f91d0cbaeabeae82734e8 Mon Sep 17 00:00:00 2001 From: Jonathan Johnson Date: Sun, 12 Nov 2023 07:24:59 -0800 Subject: [PATCH] Tweaking highlight color and focus ring drawing --- src/context.rs | 2 +- src/styles/components.rs | 4 ++-- src/widgets/mode_switch.rs | 2 +- src/widgets/themed.rs | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/context.rs b/src/context.rs index 834a5fec4..6f7de7bde 100644 --- a/src/context.rs +++ b/src/context.rs @@ -473,7 +473,7 @@ impl<'context, 'window, 'clip, 'gfx, 'pass> GraphicsContext<'context, 'window, ' } let color = styles.get(&HighlightColor, self); - self.stroke_outline::(color, StrokeOptions::default()); + self.stroke_outline::(color, StrokeOptions::lp_wide(Lp::points(2))); } /// Renders the default focus ring for this widget. diff --git a/src/styles/components.rs b/src/styles/components.rs index b077d9125..c30f49876 100644 --- a/src/styles/components.rs +++ b/src/styles/components.rs @@ -28,7 +28,7 @@ macro_rules! define_components { impl ComponentDefinition for $component { type ComponentType = $type; - + define_components!($type, $($default)*); } }; @@ -144,7 +144,7 @@ impl ComponentDefinition for HighlightColor { type ComponentType = Color; fn default_value(&self, context: &WidgetContext<'_, '_>) -> Color { - context.theme().primary.color + context.theme().primary.color.with_alpha(128) } } diff --git a/src/widgets/mode_switch.rs b/src/widgets/mode_switch.rs index a4bd1be58..238b56e98 100644 --- a/src/widgets/mode_switch.rs +++ b/src/widgets/mode_switch.rs @@ -3,7 +3,7 @@ use crate::value::{IntoValue, Value}; use crate::widget::{MakeWidget, WidgetRef, WrapperWidget}; use crate::window::ThemeMode; -/// A widget that applies a set of [`Styles`] to all contained widgets. +/// A widget that applies a set of [`ThemeMode`] to all contained widgets. #[derive(Debug)] pub struct ModeSwitch { mode: Value, diff --git a/src/widgets/themed.rs b/src/widgets/themed.rs index 4a60442f3..5a23fa8e9 100644 --- a/src/widgets/themed.rs +++ b/src/widgets/themed.rs @@ -3,7 +3,7 @@ use crate::styles::ThemePair; use crate::value::{IntoValue, Value}; use crate::widget::{MakeWidget, WidgetRef, WrapperWidget}; -/// A widget that applies a set of [`Styles`] to all contained widgets. +/// A widget that applies a [`ThemePair`] to all contained widgets. #[derive(Debug)] pub struct Themed { theme: Value,