1use ravenrs_core::Color;
2use ravenrs_style::{Semantic, Theme};
3
4#[derive(Clone, Copy, Debug, PartialEq)]
7#[cfg_attr(feature = "live", ravenrs_live::expose(part = "variants"))]
8pub enum Fill {
9 Semantic(Semantic),
11 Color(Color),
13}
14
15#[cfg_attr(feature = "live", ravenrs_live::expose)]
16impl Fill {
17 pub fn resolve(self, theme: &Theme) -> Color {
19 match self {
20 Self::Semantic(role) => theme.color(role),
21 Self::Color(c) => c,
22 }
23 }
24}
25
26impl From<Semantic> for Fill {
27 fn from(s: Semantic) -> Self {
28 Self::Semantic(s)
29 }
30}
31
32impl From<Color> for Fill {
33 fn from(c: Color) -> Self {
34 Self::Color(c)
35 }
36}