From fe454573dbcc812302009d5e8ba97d7553d8c8a2 Mon Sep 17 00:00:00 2001 From: dataphract <86984145+dataphract@users.noreply.github.com> Date: Sun, 21 Apr 2024 04:07:55 -0500 Subject: [PATCH] Fix `hex_color!` macro by re-exporting `color_hex` crate from `ecolor` (#4372) The `hex_color!` macro currently makes an unqualified reference to the `color_hex` crate, which users may not have in their `Cargo.toml`. This PR re-exports `color_hex` from the root of `ecolor` and changes the macro to use the re-exported path. * Closes https://github.com/emilk/egui/issues/2644 --- crates/ecolor/src/hex_color_macro.rs | 2 +- crates/ecolor/src/lib.rs | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/crates/ecolor/src/hex_color_macro.rs b/crates/ecolor/src/hex_color_macro.rs index 16f8cc2b8d8..a0a0729fdd1 100644 --- a/crates/ecolor/src/hex_color_macro.rs +++ b/crates/ecolor/src/hex_color_macro.rs @@ -13,7 +13,7 @@ #[macro_export] macro_rules! hex_color { ($s:literal) => {{ - let array = color_hex::color_from_hex!($s); + let array = $crate::color_hex::color_from_hex!($s); if array.len() == 3 { $crate::Color32::from_rgb(array[0], array[1], array[2]) } else { diff --git a/crates/ecolor/src/lib.rs b/crates/ecolor/src/lib.rs index e3c077edd50..a7072d8e89a 100644 --- a/crates/ecolor/src/lib.rs +++ b/crates/ecolor/src/lib.rs @@ -24,6 +24,9 @@ pub use hsva::*; #[cfg(feature = "color-hex")] mod hex_color_macro; +#[cfg(feature = "color-hex")] +#[doc(hidden)] +pub use color_hex; mod rgba; pub use rgba::*;