use aksr::Builder;
use crate::Color;
#[derive(Debug, Builder, Default, Clone, PartialEq, Copy)]
pub struct ColorStyle {
pub outline: Option<Color>,
pub fill: Option<Color>,
pub text: Option<Color>,
pub text_bg_fill: Option<Color>,
pub text_bg_outline: Option<Color>,
}
impl ColorStyle {
pub fn text_bg(&self) -> Option<Color> {
self.text_bg_fill
}
pub fn with_text_bg(mut self, color: Color) -> Self {
self.text_bg_fill = Some(color);
self
}
}
#[derive(Debug, Clone, Copy, PartialEq, Default)]
pub enum ColorSource {
#[default]
Auto,
AutoAlpha(u8),
InheritOutline,
InheritOutlineAlpha(u8),
InheritFill,
InheritFillAlpha(u8),
Custom(Color),
}
impl ColorSource {
pub fn custom(color: Color) -> Self {
Self::Custom(color)
}
pub fn auto_alpha(alpha: u8) -> Self {
Self::AutoAlpha(alpha)
}
pub fn inherit_outline_alpha(alpha: u8) -> Self {
Self::InheritOutlineAlpha(alpha)
}
pub fn inherit_fill_alpha(alpha: u8) -> Self {
Self::InheritFillAlpha(alpha)
}
}