Skip to content

Commit 4a25dd2

Browse files
dataphracthacknus
authored andcommitted
Fix hex_color! macro by re-exporting color_hex crate from ecolor (emilk#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. <!-- Please read the "Making a PR" section of [`CONTRIBUTING.md`](https://github.com/emilk/egui/blob/master/CONTRIBUTING.md) before opening a Pull Request! * Keep your PR:s small and focused. * The PR title is what ends up in the changelog, so make it descriptive! * If applicable, add a screenshot or gif. * If it is a non-trivial addition, consider adding a demo for it to `egui_demo_lib`, or a new example. * Do NOT open PR:s from your `master` branch, as that makes it hard for maintainers to add commits to your PR. * Remember to run `cargo fmt` and `cargo cranky`. * Open the PR as a draft until you have self-reviewed it and run `./scripts/check.sh`. * When you have addressed a PR comment, mark it as resolved. Please be patient! I will review your PR, but my time is limited! --> * Closes emilk#2644
1 parent 6c6f6db commit 4a25dd2

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

crates/ecolor/src/hex_color_macro.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
#[macro_export]
1414
macro_rules! hex_color {
1515
($s:literal) => {{
16-
let array = color_hex::color_from_hex!($s);
16+
let array = $crate::color_hex::color_from_hex!($s);
1717
if array.len() == 3 {
1818
$crate::Color32::from_rgb(array[0], array[1], array[2])
1919
} else {

crates/ecolor/src/lib.rs

+3
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ pub use hsva::*;
2424

2525
#[cfg(feature = "color-hex")]
2626
mod hex_color_macro;
27+
#[cfg(feature = "color-hex")]
28+
#[doc(hidden)]
29+
pub use color_hex;
2730

2831
mod rgba;
2932
pub use rgba::*;

0 commit comments

Comments
 (0)