Try to make light themes a bit more colorful

This commit is contained in:
Héctor Ramón Jiménez 2025-08-05 22:04:35 +02:00
parent e14d3609ac
commit 4d4f565da7
No known key found for this signature in database
GPG key ID: 7CC46565708259A7
8 changed files with 18 additions and 15 deletions

View file

@ -623,7 +623,10 @@ 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
oklch.c *= 1.0 + 2.0 * amount / oklch.l.max(0.05);
if oklch.c > 0.0 {
// Formula empirically and cluelessly derived
oklch.c *= 1.0 + (0.3 / oklch.c).min(100.0) * amount;
}
oklch.l = if oklch.l - amount < 0.0 {
0.0
@ -638,6 +641,7 @@ fn lighten(color: Color, amount: f32) -> Color {
let mut oklch = to_oklch(color);
// We try to bump the chroma a bit for more colorful palettes
// Formula empirically and cluelessly derived
oklch.c *= 1.0 + 2.0 * amount / oklch.l.max(0.05);
oklch.l = if oklch.l + amount > 1.0 {

View file

@ -1 +1 @@
46f6341d1e3f63ddb4a6a9a11f0efee4dcb076861c351258a3d29095d67c170d
045ee6f1580e728919431e5ae741b50277b96cb97089ad3bf2a0e2aefd9e0090

View file

@ -1 +1 @@
3131fd97275095e2c562341e3b0b13dfbed45e2461595b692f20dae0e5941dba
09cb020de17de0695c3a383972af3562e49d87dcfc5bcf8f1459b19f8874834a

View file

@ -1 +1 @@
59a02d3278a9f321731c11c182edc897f87c2703af5f14a6e76dbea6e505fcc6
ddc366fdf1127014a47d18a8914b6e9967eada10fae48a03b10c9428c589c51f

View file

@ -1 +1 @@
ce493d0c75ecce3eedb82c459c6d3ac674a4f8ee0bdaf3a912ff8ef8e57e5b32
9af0d10bb6b71fae760d9993e7ba6f9431002a376c6c064ac0e0738499f4e359

View file

@ -1 +1 @@
40441bc94b7c524c5064ff155a0db28d896109c3cce4da6822efefd71b3a9a92
e2d049e13e1d88c9fd046803936c27e9a45809f133d8ea58d4731626594a87a3

View file

@ -1,8 +1,8 @@
use iced::keyboard;
use iced::widget::{
button, center, checkbox, column, container, horizontal_rule, pick_list,
progress_bar, row, scrollable, slider, text, text_input, toggler,
vertical_rule, vertical_space,
button, center_x, center_y, checkbox, column, container, horizontal_rule,
pick_list, progress_bar, row, scrollable, slider, text, text_input,
toggler, vertical_rule, vertical_space,
};
use iced::{Center, Element, Fill, Subscription, Theme};
@ -94,7 +94,7 @@ impl Styling {
let progress_bar = || progress_bar(0.0..=100.0, self.slider_value);
let scrollable = scrollable(column![
let scroll_me = scrollable(column![
"Scroll me!",
vertical_space().height(800),
"You did it!"
@ -134,7 +134,7 @@ impl Styling {
slider(),
progress_bar(),
row![
scrollable,
scroll_me,
row![vertical_rule(1), column![checkbox, toggler].spacing(20)]
.spacing(20)
]
@ -147,7 +147,9 @@ impl Styling {
.padding(20)
.max_width(600);
center(content).into()
center_y(scrollable(center_x(content)).spacing(10))
.padding(10)
.into()
}
fn subscription(&self) -> Subscription<Message> {

View file

@ -1374,8 +1374,6 @@ pub struct Style {
pub background: Background,
/// The [`Border`] of the text input.
pub border: Border,
/// The [`Color`] of the icon of the text input.
pub icon: Color,
/// The [`Color`] of the placeholder of the text input.
pub placeholder: Color,
/// The [`Color`] of the value of the text input.
@ -1422,7 +1420,6 @@ pub fn default(theme: &Theme, status: Status) -> Style {
width: 1.0,
color: palette.background.strong.color,
},
icon: palette.background.weak.text,
placeholder: palette.secondary.base.color,
value: palette.background.base.text,
selection: palette.primary.weak.color,