summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--core/Cargo.toml3
-rw-r--r--core/src/lib.rs7
-rw-r--r--core/src/theme/palette.rs12
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()
}
}