Merge branch 'master' into wgpu/better-architecture

This commit is contained in:
Héctor Ramón Jiménez 2024-04-07 14:01:05 +02:00
commit 13289dbd19
No known key found for this signature in database
GPG key ID: 7CC46565708259A7
41 changed files with 318 additions and 267 deletions

View file

@ -10,6 +10,9 @@ homepage.workspace = true
categories.workspace = true
keywords.workspace = true
[lints]
workspace = true
[features]
auto-detect-theme = ["dep:dark-light"]
advanced = []

View file

@ -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;

View file

@ -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()
}
}