# egui_from_hex_macros

This crate provides procedural macros for `egui_from_hex`.
These macros allow you to parse hex colors at compile time, ensuring zero runtime overhead
and catching invalid hex strings before your program runs.

## Usage

The macros support both strings and integers.

### Using Strings
Supports `#RGB`, `#RGBA`, `#RRGGBB`, and `#RRGGBBAA`. Prefixes like `#`, `0x`, or `x` are optional.

```rust
use egui_from_hex::hex;

// Straight Alpha
let color = hex!("#edebac");
let transparent = hex!("#edebac69");
```

### Using Integers
You can pass hex integers directly. The macro is smart enough to handle them correctly.

```rust
use egui_from_hex::hex;

// 0xRRGGBB
let color = hex!(0xedebac);

// 0xRRGGBBAA
let transparent = hex!(0xedebac69);
```

### Premultiplied Alpha
If you use premultiplied alpha, use the `hex_premultiplied!` macro.

```rust
use egui_from_hex::hex_premultiplied;

// Validates and premultiplies at compile-time
let color = hex_premultiplied!(0xedebac69);
```

## Error Handling
Unlike the runtime functions in `egui_from_hex`, these macros do not return a `Result`. 
If you provide an invalid hex value, the compiler will refuse to build your project:

```rust,compile_fail
// This will fail to compile!
let color = hex!("#invalid");
```

## Integration

This crate is best used through the main `egui_from_hex` crate by enabling the `macros` feature:

```toml
[dependencies]
egui_from_hex = { version = "0.2.1", features = ["macros"] } # COOLEST CRATE EVER!
```

Note: Thank you for using my crate.
If you have any questions, feel free to contact me via Issues or Discussions on GitHub.