1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#![cfg_attr(feature = "strict", deny(warnings))]
#![recursion_limit = "128"]
extern crate proc_macro;
extern crate proc_macro2;
#[macro_use]
extern crate quote;
#[macro_use]
extern crate syn;
use proc_macro::TokenStream;
mod util;
mod meta;
mod convert;
mod encoding;
const COLOR_TYPES: &[&str] = &[
"Rgb", "Luma", "Hsl", "Hsv", "Hwb", "Lab", "Lch", "Xyz", "Yxy"
];
#[proc_macro_derive(FromColor,
attributes(palette_internal, palette_white_point, palette_component,
palette_manual_from, palette_rgb_space, palette_alpha))]
pub fn derive_from_color(tokens: TokenStream) -> TokenStream {
convert::derive_from_color(tokens)
}
#[proc_macro_derive(IntoColor,
attributes(palette_internal, palette_white_point, palette_component,
palette_manual_into, palette_rgb_space, palette_alpha))]
pub fn derive_into_color(tokens: TokenStream) -> TokenStream {
convert::derive_into_color(tokens)
}
#[proc_macro_derive(Pixel,
attributes(palette_internal, palette_unsafe_same_layout_as,
palette_unsafe_zero_sized))]
pub fn derive_pixel(tokens: TokenStream) -> TokenStream {
encoding::derive_pixel(tokens)
}