From 468014a1841fb89602248c7d95ad50b3a550859d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A9ctor=20Ram=C3=B3n=20Jim=C3=A9nez?= Date: Wed, 6 Aug 2025 02:42:51 +0200 Subject: [PATCH] Fix minor styling inconsistencies in some widgets --- core/src/theme/palette.rs | 4 +-- .../catppuccin_frappé-tiny-skia.sha256 | 2 +- .../catppuccin_latte-tiny-skia.sha256 | 2 +- .../catppuccin_macchiato-tiny-skia.sha256 | 2 +- .../catppuccin_mocha-tiny-skia.sha256 | 2 +- .../styling/snapshots/dark-tiny-skia.sha256 | 2 +- .../snapshots/dracula-tiny-skia.sha256 | 2 +- .../styling/snapshots/ferra-tiny-skia.sha256 | 2 +- .../snapshots/gruvbox_dark-tiny-skia.sha256 | 2 +- .../snapshots/gruvbox_light-tiny-skia.sha256 | 2 +- .../kanagawa_dragon-tiny-skia.sha256 | 2 +- .../snapshots/kanagawa_lotus-tiny-skia.sha256 | 2 +- .../snapshots/kanagawa_wave-tiny-skia.sha256 | 2 +- .../styling/snapshots/light-tiny-skia.sha256 | 2 +- .../snapshots/moonfly-tiny-skia.sha256 | 2 +- .../snapshots/nightfly-tiny-skia.sha256 | 2 +- .../styling/snapshots/nord-tiny-skia.sha256 | 2 +- .../snapshots/oxocarbon-tiny-skia.sha256 | 2 +- .../snapshots/solarized_dark-tiny-skia.sha256 | 2 +- .../solarized_light-tiny-skia.sha256 | 2 +- .../snapshots/tokyo_night-tiny-skia.sha256 | 2 +- .../tokyo_night_light-tiny-skia.sha256 | 2 +- .../tokyo_night_storm-tiny-skia.sha256 | 2 +- widget/src/checkbox.rs | 29 ++++++++++++++----- widget/src/pick_list.rs | 2 +- widget/src/scrollable.rs | 2 +- widget/src/toggler.rs | 2 +- 27 files changed, 48 insertions(+), 35 deletions(-) diff --git a/core/src/theme/palette.rs b/core/src/theme/palette.rs index 24e15a9e..08a80a26 100644 --- a/core/src/theme/palette.rs +++ b/core/src/theme/palette.rs @@ -623,9 +623,9 @@ fn darken(color: Color, amount: f32) -> Color { let mut oklch = to_oklch(color); // We try to bump the chroma a bit for more colorful palettes - if oklch.c > 0.0 { + if oklch.c > 0.0 && oklch.c < (1.0 - oklch.l) / 2.0 { // Formula empirically and cluelessly derived - oklch.c *= 1.0 + (0.3 / oklch.c).min(100.0) * amount; + oklch.c *= 1.0 + (0.2 / oklch.c).min(100.0) * amount; } oklch.l = if oklch.l - amount < 0.0 { diff --git a/examples/styling/snapshots/catppuccin_frappé-tiny-skia.sha256 b/examples/styling/snapshots/catppuccin_frappé-tiny-skia.sha256 index adb46a04..7be535ed 100644 --- a/examples/styling/snapshots/catppuccin_frappé-tiny-skia.sha256 +++ b/examples/styling/snapshots/catppuccin_frappé-tiny-skia.sha256 @@ -1 +1 @@ -a496cc09220283466d5eb3635f6b63d011ec1dc765726b81213a823825836e4a \ No newline at end of file +aeecd43f0921fe9f0ea3358cc3d55040e1b3117e43eb4490d621b0af71680899 \ No newline at end of file diff --git a/examples/styling/snapshots/catppuccin_latte-tiny-skia.sha256 b/examples/styling/snapshots/catppuccin_latte-tiny-skia.sha256 index 6e3df4fc..39882a5b 100644 --- a/examples/styling/snapshots/catppuccin_latte-tiny-skia.sha256 +++ b/examples/styling/snapshots/catppuccin_latte-tiny-skia.sha256 @@ -1 +1 @@ -045ee6f1580e728919431e5ae741b50277b96cb97089ad3bf2a0e2aefd9e0090 \ No newline at end of file +121fd6018015dbc5e6c8f5c2db1197a7dc769a916fb29ef9f42622b4cf63a96c \ No newline at end of file diff --git a/examples/styling/snapshots/catppuccin_macchiato-tiny-skia.sha256 b/examples/styling/snapshots/catppuccin_macchiato-tiny-skia.sha256 index 73859c52..2197655b 100644 --- a/examples/styling/snapshots/catppuccin_macchiato-tiny-skia.sha256 +++ b/examples/styling/snapshots/catppuccin_macchiato-tiny-skia.sha256 @@ -1 +1 @@ -a530ad9b59628d95e9aaa187af2681b26e7219786b5a114848f41690ed25ef21 \ No newline at end of file +56df225c9404745aae11734fcd13b062355a1d26198323711888c49b528bdfae \ No newline at end of file diff --git a/examples/styling/snapshots/catppuccin_mocha-tiny-skia.sha256 b/examples/styling/snapshots/catppuccin_mocha-tiny-skia.sha256 index 75e14cfd..542012dc 100644 --- a/examples/styling/snapshots/catppuccin_mocha-tiny-skia.sha256 +++ b/examples/styling/snapshots/catppuccin_mocha-tiny-skia.sha256 @@ -1 +1 @@ -f959b1b8ca2d7f87110e0decf63bf04bb685a8958de6879e008edb40415a84e8 \ No newline at end of file +a15a385aefc14ddd988536ee6eb81b7d6ececafbc7a7af4a5c282266c4f69d07 \ No newline at end of file diff --git a/examples/styling/snapshots/dark-tiny-skia.sha256 b/examples/styling/snapshots/dark-tiny-skia.sha256 index 59ea0058..5e28ca02 100644 --- a/examples/styling/snapshots/dark-tiny-skia.sha256 +++ b/examples/styling/snapshots/dark-tiny-skia.sha256 @@ -1 +1 @@ -043d53e59e66ed06105abac613ed49c6beaf57f5009e605107cb77307807790b \ No newline at end of file +95630596cd95dbe070c20d3eec0bb131f5b0b05e1afa8c07a38cedd4775cfff8 \ No newline at end of file diff --git a/examples/styling/snapshots/dracula-tiny-skia.sha256 b/examples/styling/snapshots/dracula-tiny-skia.sha256 index 3569448c..44ebe62e 100644 --- a/examples/styling/snapshots/dracula-tiny-skia.sha256 +++ b/examples/styling/snapshots/dracula-tiny-skia.sha256 @@ -1 +1 @@ -f7894c6738710e8054b41c2d958eb50182d9655d8651d1fd2371a9ed05f28ddc \ No newline at end of file +fe0a3defebea5e0d728abec9f7395cced9d5fe46d1e64523afe649774fb7dc3e \ No newline at end of file diff --git a/examples/styling/snapshots/ferra-tiny-skia.sha256 b/examples/styling/snapshots/ferra-tiny-skia.sha256 index 5caad7ab..657e0dd8 100644 --- a/examples/styling/snapshots/ferra-tiny-skia.sha256 +++ b/examples/styling/snapshots/ferra-tiny-skia.sha256 @@ -1 +1 @@ -e0ec3911121e303bdfe3956c72af423ec21a17a958768116ee452adcace02e15 \ No newline at end of file +840c1eff30f6dc63cf3e7f19e2cd0acd31b0b3eb2bf0773000aef5b9a46d9df6 \ No newline at end of file diff --git a/examples/styling/snapshots/gruvbox_dark-tiny-skia.sha256 b/examples/styling/snapshots/gruvbox_dark-tiny-skia.sha256 index 9c798964..1da1b8c7 100644 --- a/examples/styling/snapshots/gruvbox_dark-tiny-skia.sha256 +++ b/examples/styling/snapshots/gruvbox_dark-tiny-skia.sha256 @@ -1 +1 @@ -81e4f065fc985a2c5fc9d15fea941667e914dbc6fe7a5262dac5390955e34f67 \ No newline at end of file +7d4c6ae83e8436b1d4e850c82f19e97a911b4ce389a4ba75f8ea722ffc51329a \ No newline at end of file diff --git a/examples/styling/snapshots/gruvbox_light-tiny-skia.sha256 b/examples/styling/snapshots/gruvbox_light-tiny-skia.sha256 index 76b632c1..98e9dbfd 100644 --- a/examples/styling/snapshots/gruvbox_light-tiny-skia.sha256 +++ b/examples/styling/snapshots/gruvbox_light-tiny-skia.sha256 @@ -1 +1 @@ -09cb020de17de0695c3a383972af3562e49d87dcfc5bcf8f1459b19f8874834a \ No newline at end of file +36ab94c5f69c09ef60feb4524e0a593d2670e345d71139b783796496bdcbceb0 \ No newline at end of file diff --git a/examples/styling/snapshots/kanagawa_dragon-tiny-skia.sha256 b/examples/styling/snapshots/kanagawa_dragon-tiny-skia.sha256 index b02de3c1..cf6fbeac 100644 --- a/examples/styling/snapshots/kanagawa_dragon-tiny-skia.sha256 +++ b/examples/styling/snapshots/kanagawa_dragon-tiny-skia.sha256 @@ -1 +1 @@ -491041848f77c6e9b70b7e677d0809bff5ceae783326f6dbdd10bdcd45eb56e2 \ No newline at end of file +262314758d1facbc16b4949c92ba58dd95a10bdf1fe85fa7aa336dcdf536ab85 \ No newline at end of file diff --git a/examples/styling/snapshots/kanagawa_lotus-tiny-skia.sha256 b/examples/styling/snapshots/kanagawa_lotus-tiny-skia.sha256 index 49bace10..b0e8b1d5 100644 --- a/examples/styling/snapshots/kanagawa_lotus-tiny-skia.sha256 +++ b/examples/styling/snapshots/kanagawa_lotus-tiny-skia.sha256 @@ -1 +1 @@ -ddc366fdf1127014a47d18a8914b6e9967eada10fae48a03b10c9428c589c51f \ No newline at end of file +fbafd69c60962465f4e0759fc72b3f5bb13895e85821273fff4b51ad1994e7ba \ No newline at end of file diff --git a/examples/styling/snapshots/kanagawa_wave-tiny-skia.sha256 b/examples/styling/snapshots/kanagawa_wave-tiny-skia.sha256 index 2f1b3050..9a502d0f 100644 --- a/examples/styling/snapshots/kanagawa_wave-tiny-skia.sha256 +++ b/examples/styling/snapshots/kanagawa_wave-tiny-skia.sha256 @@ -1 +1 @@ -304163accbfcd947b5231beaeb4d8194aab02409df9e334862fe5eb79a835116 \ No newline at end of file +6a237b0387d6621c835521d560b1e56b2c63ca1ebca8256742b0afea3c71725c \ No newline at end of file diff --git a/examples/styling/snapshots/light-tiny-skia.sha256 b/examples/styling/snapshots/light-tiny-skia.sha256 index 0a1e8669..cd41d1b8 100644 --- a/examples/styling/snapshots/light-tiny-skia.sha256 +++ b/examples/styling/snapshots/light-tiny-skia.sha256 @@ -1 +1 @@ -b61b166bca3dce77002300e60ae778000ea00df5b5973f106ce58ce6d5e0b501 \ No newline at end of file +a1832dfc240eac78bafcdfdbe36fc66b35f984cf67d71adb265fc4f30d383e2b \ No newline at end of file diff --git a/examples/styling/snapshots/moonfly-tiny-skia.sha256 b/examples/styling/snapshots/moonfly-tiny-skia.sha256 index 21d299eb..f3c9d57d 100644 --- a/examples/styling/snapshots/moonfly-tiny-skia.sha256 +++ b/examples/styling/snapshots/moonfly-tiny-skia.sha256 @@ -1 +1 @@ -bc88452bb81a702a8c29c9dde933bf0bdb1723af1c910cb44e56180dc64270b5 \ No newline at end of file +82e617ffb6f5805014377e0b9094b91827de14fa919855d4c6443267291ca677 \ No newline at end of file diff --git a/examples/styling/snapshots/nightfly-tiny-skia.sha256 b/examples/styling/snapshots/nightfly-tiny-skia.sha256 index 90c3b78a..3745dd49 100644 --- a/examples/styling/snapshots/nightfly-tiny-skia.sha256 +++ b/examples/styling/snapshots/nightfly-tiny-skia.sha256 @@ -1 +1 @@ -140ca7cf98bec0d955678b5160e0ccb43d85a829eed62c54f09d5e0b1a401e6f \ No newline at end of file +3cae3ed606e1927ef9aaba7e498a54b62ea70d114f0011a048192a2743accbef \ No newline at end of file diff --git a/examples/styling/snapshots/nord-tiny-skia.sha256 b/examples/styling/snapshots/nord-tiny-skia.sha256 index aa36b9a7..52e996e5 100644 --- a/examples/styling/snapshots/nord-tiny-skia.sha256 +++ b/examples/styling/snapshots/nord-tiny-skia.sha256 @@ -1 +1 @@ -e8b2b050896d2b2cfd1c31b2c8773f74b2c23b94b3d94e8f16b8fb6604e8b2f2 \ No newline at end of file +8daec0d941ecc2eb52135b63a91936786ef2af48d56fba2d192e00438230ae0b \ No newline at end of file diff --git a/examples/styling/snapshots/oxocarbon-tiny-skia.sha256 b/examples/styling/snapshots/oxocarbon-tiny-skia.sha256 index 096bad4c..356e9b0b 100644 --- a/examples/styling/snapshots/oxocarbon-tiny-skia.sha256 +++ b/examples/styling/snapshots/oxocarbon-tiny-skia.sha256 @@ -1 +1 @@ -d40514ab3f75e4aa08d8d21e197e5fa486dd0689a4e81027ae335e9abd2ea311 \ No newline at end of file +d0bd8d738130d56857e618efbd9e11b515aa0655e2edf8dc2326b8dabf54c490 \ No newline at end of file diff --git a/examples/styling/snapshots/solarized_dark-tiny-skia.sha256 b/examples/styling/snapshots/solarized_dark-tiny-skia.sha256 index 93ec5161..f8475616 100644 --- a/examples/styling/snapshots/solarized_dark-tiny-skia.sha256 +++ b/examples/styling/snapshots/solarized_dark-tiny-skia.sha256 @@ -1 +1 @@ -3ea703ef5d769c6184777bee6caa71e49adc381e1a47f3241f03250ab27b6988 \ No newline at end of file +d1c06a7016554e03308c0a642ea0edf17e397b639aa9194c2314b0e32d8165ff \ No newline at end of file diff --git a/examples/styling/snapshots/solarized_light-tiny-skia.sha256 b/examples/styling/snapshots/solarized_light-tiny-skia.sha256 index ce985f2c..213ee947 100644 --- a/examples/styling/snapshots/solarized_light-tiny-skia.sha256 +++ b/examples/styling/snapshots/solarized_light-tiny-skia.sha256 @@ -1 +1 @@ -9af0d10bb6b71fae760d9993e7ba6f9431002a376c6c064ac0e0738499f4e359 \ No newline at end of file +c8596fa0d72e96e144de58953e7a8ef7c37b88625070642747769af1104a0050 \ No newline at end of file diff --git a/examples/styling/snapshots/tokyo_night-tiny-skia.sha256 b/examples/styling/snapshots/tokyo_night-tiny-skia.sha256 index 99686307..4700021e 100644 --- a/examples/styling/snapshots/tokyo_night-tiny-skia.sha256 +++ b/examples/styling/snapshots/tokyo_night-tiny-skia.sha256 @@ -1 +1 @@ -82a173e0c1b9c665fbf06de60acbb0523b7f9ab5af429d5ec29ce908f640d5ec \ No newline at end of file +c831821798f5fe38609a7fe854a3785942ae04750ed23936f32b33139126e195 \ No newline at end of file diff --git a/examples/styling/snapshots/tokyo_night_light-tiny-skia.sha256 b/examples/styling/snapshots/tokyo_night_light-tiny-skia.sha256 index 300f2eac..a26fd224 100644 --- a/examples/styling/snapshots/tokyo_night_light-tiny-skia.sha256 +++ b/examples/styling/snapshots/tokyo_night_light-tiny-skia.sha256 @@ -1 +1 @@ -e2d049e13e1d88c9fd046803936c27e9a45809f133d8ea58d4731626594a87a3 \ No newline at end of file +26c9d551330f5dbe6680f1c9e8cdf3b6810c26c9de3b22a9a948eae16d5fa3d9 \ No newline at end of file diff --git a/examples/styling/snapshots/tokyo_night_storm-tiny-skia.sha256 b/examples/styling/snapshots/tokyo_night_storm-tiny-skia.sha256 index ed8f662b..27013156 100644 --- a/examples/styling/snapshots/tokyo_night_storm-tiny-skia.sha256 +++ b/examples/styling/snapshots/tokyo_night_storm-tiny-skia.sha256 @@ -1 +1 @@ -dfc3317f39c204b8509c1b8f7e8e1d9b0911bfc1a7bd5fbde822a7a5c6c54e12 \ No newline at end of file +5660044597f3ca9e10f5f704cfd4723e7c68f1d211c999063134aa8576227757 \ No newline at end of file diff --git a/widget/src/checkbox.rs b/widget/src/checkbox.rs index 8fce8b1d..91c87ac0 100644 --- a/widget/src/checkbox.rs +++ b/widget/src/checkbox.rs @@ -556,20 +556,23 @@ pub fn primary(theme: &Theme, status: Status) -> Style { match status { Status::Active { is_checked } => styled( - palette.background.strongest.color, + palette.background.strong.color, palette.background.base, + palette.primary.base.text, palette.primary.base, is_checked, ), Status::Hovered { is_checked } => styled( - palette.background.strongest.color, + palette.background.strong.color, palette.background.weak, + palette.primary.base.text, palette.primary.strong, is_checked, ), Status::Disabled { is_checked } => styled( palette.background.weak.color, palette.background.weak, + palette.primary.base.text, palette.background.strong, is_checked, ), @@ -582,20 +585,23 @@ pub fn secondary(theme: &Theme, status: Status) -> Style { match status { Status::Active { is_checked } => styled( - palette.background.strongest.color, + palette.background.strong.color, palette.background.base, + palette.background.base.text, palette.background.strong, is_checked, ), Status::Hovered { is_checked } => styled( - palette.background.strongest.color, + palette.background.strong.color, palette.background.weak, + palette.background.base.text, palette.background.strong, is_checked, ), Status::Disabled { is_checked } => styled( palette.background.weak.color, palette.background.weak, + palette.background.base.text, palette.background.weak, is_checked, ), @@ -610,18 +616,21 @@ pub fn success(theme: &Theme, status: Status) -> Style { Status::Active { is_checked } => styled( palette.background.weak.color, palette.background.base, + palette.success.base.text, palette.success.base, is_checked, ), Status::Hovered { is_checked } => styled( - palette.background.strongest.color, + palette.background.strong.color, palette.background.weak, + palette.success.base.text, palette.success.strong, is_checked, ), Status::Disabled { is_checked } => styled( palette.background.weak.color, palette.background.weak, + palette.success.base.text, palette.success.weak, is_checked, ), @@ -634,20 +643,23 @@ pub fn danger(theme: &Theme, status: Status) -> Style { match status { Status::Active { is_checked } => styled( - palette.background.strongest.color, + palette.background.strong.color, palette.background.base, + palette.danger.base.text, palette.danger.base, is_checked, ), Status::Hovered { is_checked } => styled( - palette.background.strongest.color, + palette.background.strong.color, palette.background.weak, + palette.danger.base.text, palette.danger.strong, is_checked, ), Status::Disabled { is_checked } => styled( palette.background.weak.color, palette.background.weak, + palette.danger.base.text, palette.danger.weak, is_checked, ), @@ -657,6 +669,7 @@ pub fn danger(theme: &Theme, status: Status) -> Style { fn styled( border_color: Color, base: palette::Pair, + icon_color: Color, accent: palette::Pair, is_checked: bool, ) -> Style { @@ -668,7 +681,7 @@ fn styled( Style { background: Background::Color(background.color), - icon_color: background.text, + icon_color, border: Border { radius: 2.0.into(), width: 1.0, diff --git a/widget/src/pick_list.rs b/widget/src/pick_list.rs index 517ff35d..4076d7f7 100644 --- a/widget/src/pick_list.rs +++ b/widget/src/pick_list.rs @@ -899,7 +899,7 @@ pub fn default(theme: &Theme, status: Status) -> Style { let active = Style { text_color: palette.background.weak.text, background: palette.background.weak.color.into(), - placeholder_color: palette.background.strong.color, + placeholder_color: palette.secondary.base.color, handle_color: palette.background.weak.text, border: Border { radius: 2.0.into(), diff --git a/widget/src/scrollable.rs b/widget/src/scrollable.rs index 01c4ef7c..61e78d50 100644 --- a/widget/src/scrollable.rs +++ b/widget/src/scrollable.rs @@ -2069,7 +2069,7 @@ pub fn default(theme: &Theme, status: Status) -> Style { background: Some(palette.background.weak.color.into()), border: border::rounded(2), scroller: Scroller { - color: palette.background.strong.color, + color: palette.background.strongest.color, border: border::rounded(2), }, }; diff --git a/widget/src/toggler.rs b/widget/src/toggler.rs index 7f6e6795..41e4bd64 100644 --- a/widget/src/toggler.rs +++ b/widget/src/toggler.rs @@ -556,7 +556,7 @@ pub fn default(theme: &Theme, status: Status) -> Style { if is_toggled { palette.primary.base.color } else { - palette.background.strongest.color + palette.background.strong.color } } Status::Disabled => palette.background.weak.color,