Skip to content

hex_color! macro uses color_hex crate, but it doesn't seem to import it correctly #2644

@Hpmason

Description

@Hpmason

Trying to use the hex_color! macro gives the following error:

error[E0433]: failed to resolve: use of undeclared crate or module `color_hex`
  --> src\main.rs:29:61
   |
29 |         let frame = egui::containers::Frame::default().fill(hex_color!("#ffffff"));
   |                                                             ^^^^^^^^^^^^^^^^^^^^^ use of undeclared crate or module `color_hex`
   |
   = note: this error originates in the macro `hex_color` (in Nightly builds, run with -Z macro-backtrace for more info)     

For more information about this error, try `rustc --explain E0433`.

From what I can tell, the macro calls another macro from the color_hex crate, but there's no guarantee the crate is in scope. Maybe in version 0.19, the color_hex crate was reexported so it was always in scope?

macro_rules! hex_color {
($s:literal) => {{
let array = color_hex::color_from_hex!($s);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions