refactor things around

This commit is contained in:
TheOddGarlic 2022-04-24 18:59:48 +03:00
parent a99e19de4b
commit f0d752570b
3 changed files with 7 additions and 9 deletions

View file

@ -34,17 +34,15 @@ impl From<Color> for D2D1_COLOR_F {
}
}
// fixme: figure out how to tell RGB, RGBA, HSL, HSLA, any of those in
// hexadecimal numbers, etc. apart.
#[macro_export]
macro_rules! color {
macro_rules! rgb {
($r:expr, $g:expr, $b:expr, $a:expr) => {
$crate::color::Color($r, $g, $b, $a)
};
($r:expr, $g:expr, $b:expr) => {
$crate::color::Color($r, $g, $b, 1.0)
};
// ($rgba:expr) => {
// $crate::color::Color::from_rgba($rgba)
// };
($rgba:expr) => {
$crate::color::Color::from_rgba($rgba)
};
}

View file

@ -8,7 +8,7 @@
//! Able GUI Toolkit (AbleTK)
#[doc(inline)] pub use abletk_macros::*;
pub use abletk_common::color;
pub use abletk_common::*;
pub mod application;
pub mod context;
pub mod event;
@ -26,6 +26,6 @@ pub mod prelude {
pub use crate::widget::Label;
pub use crate::widget::Widget;
pub use crate::window::*;
pub use crate::color;
pub use crate::rgb;
pub use crate::launch;
}

View file

@ -15,5 +15,5 @@ fn launch() -> _ {
.apply_plugin(QuitPlugin)
.add_window(Window::builder(
Label::new("Hello, AbleTK!")
.color(color!(0xFF00FFFF))))
.color(rgb!(0xFF00FFFF))))
}