diff options
author | 2024-04-07 14:01:05 +0200 | |
---|---|---|
committer | 2024-04-07 14:06:52 +0200 | |
commit | 13289dbd1933e7d7a0b21cffd197813f8f6f7fc0 (patch) | |
tree | 85cbda9aa86c277e623943307c63a33e192ae609 /core | |
parent | 5e01d767c5ef8a35937675d4e8f02b4c678a5da2 (diff) | |
parent | 1c241d1150d2f7b5d0ae154439325950e5d25f38 (diff) | |
download | iced-13289dbd1933e7d7a0b21cffd197813f8f6f7fc0.tar.gz iced-13289dbd1933e7d7a0b21cffd197813f8f6f7fc0.tar.bz2 iced-13289dbd1933e7d7a0b21cffd197813f8f6f7fc0.zip |
Merge branch 'master' into wgpu/better-architecture
Diffstat (limited to '')
-rw-r--r-- | core/Cargo.toml | 3 | ||||
-rw-r--r-- | core/src/lib.rs | 7 | ||||
-rw-r--r-- | core/src/theme/palette.rs | 12 |
3 files changed, 13 insertions, 9 deletions
diff --git a/core/Cargo.toml b/core/Cargo.toml index d3529d98..7bd37021 100644 --- a/core/Cargo.toml +++ b/core/Cargo.toml @@ -10,6 +10,9 @@ homepage.workspace = true categories.workspace = true keywords.workspace = true +[lints] +workspace = true + [features] auto-detect-theme = ["dep:dark-light"] advanced = [] diff --git a/core/src/lib.rs b/core/src/lib.rs index 832b2d2d..feda4fb4 100644 --- a/core/src/lib.rs +++ b/core/src/lib.rs @@ -9,13 +9,6 @@ #![doc( html_logo_url = "https://raw.githubusercontent.com/iced-rs/iced/9ab6923e943f784985e9ef9ca28b10278297225d/docs/logo.svg" )] -#![forbid(unsafe_code, rust_2018_idioms)] -#![deny( - missing_debug_implementations, - missing_docs, - unused_results, - rustdoc::broken_intra_doc_links -)] pub mod alignment; pub mod border; pub mod clipboard; diff --git a/core/src/theme/palette.rs b/core/src/theme/palette.rs index ca91c248..91543567 100644 --- a/core/src/theme/palette.rs +++ b/core/src/theme/palette.rs @@ -612,11 +612,19 @@ fn mix(a: Color, b: Color, factor: f32) -> Color { fn readable(background: Color, text: Color) -> Color { if is_readable(background, text) { - text - } else if is_dark(background) { + return text; + } + + let fallback = if is_dark(background) { Color::WHITE } else { Color::BLACK + }; + + if is_readable(background, fallback) { + fallback + } else { + fallback.inverse() } } |