mirror of
https://github.com/emilk/egui.git
synced 2026-08-29 12:50:04 -04:00
Make color-hex optional (#1632)
This commit is contained in:
@@ -192,6 +192,7 @@ impl Color32 {
|
||||
/// assert_eq!(hex_color!("#202122"), Color32::from_rgb(0x20, 0x21, 0x22));
|
||||
/// assert_eq!(hex_color!("#abcdef12"), Color32::from_rgba_unmultiplied(0xab, 0xcd, 0xef, 0x12));
|
||||
/// ```
|
||||
#[cfg(feature = "color-hex")]
|
||||
#[macro_export]
|
||||
macro_rules! hex_color {
|
||||
($s:literal) => {{
|
||||
@@ -205,6 +206,7 @@ macro_rules! hex_color {
|
||||
}};
|
||||
}
|
||||
|
||||
#[cfg(feature = "color-hex")]
|
||||
#[test]
|
||||
fn test_from_rgb_hex() {
|
||||
assert_eq!(Color32::from_rgb(0x20, 0x21, 0x22), hex_color!("#202122"));
|
||||
@@ -214,6 +216,7 @@ fn test_from_rgb_hex() {
|
||||
);
|
||||
}
|
||||
|
||||
#[cfg(feature = "color-hex")]
|
||||
#[test]
|
||||
fn test_from_rgba_hex() {
|
||||
assert_eq!(
|
||||
|
||||
@@ -49,6 +49,7 @@ pub use emath::{pos2, vec2, Pos2, Rect, Vec2};
|
||||
pub use ahash;
|
||||
pub use emath;
|
||||
|
||||
#[cfg(feature = "color-hex")]
|
||||
pub use color_hex;
|
||||
|
||||
/// The UV coordinate of a white region of the texture mesh.
|
||||
|
||||
Reference in New Issue
Block a user