macro_rules! impl_composed_styling_methods {
{
args: [$self:ident, $effect:ident, $underline_effect:ident, $target:ident, $color:ident, $value:ident];
example_variable: $example_variable:literal;
set_effect: $set_effect:block
get_effect: $get_effect:block
get_effects: $get_effects:block
set_underline_effect: $set_underline_effect:block
get_underline_effect: $get_underline_effect:block
set_color: $set_color:block
get_color: $get_color:block
} => {
#[must_use]
pub fn set_effect($self, $effect: impl Into<Effect>, $value: bool) -> Self {
$set_effect
}
#[must_use]
pub fn get_effect(&$self, $effect: impl Into<Effect>) -> bool {
$get_effect
}
#[must_use]
pub fn get_effects(&$self) -> GetEffects {
$get_effects
}
#[must_use]
pub fn set_underline_effect($self, $underline_effect: Option<UnderlineEffect>) -> Self
$set_underline_effect
#[must_use]
pub fn get_underline_effect(&$self) -> Option<UnderlineEffect> {
$get_underline_effect
}
#[doc = concat!(r"
```
# use fluent_ansi::{prelude::*, ColorTarget, Style};
# let ", $example_variable, r" = Style::new();
", $example_variable, r".set_color(ColorTarget::Foreground, None::<Color>);
// or
", $example_variable, r".set_color(ColorTarget::Foreground, Color::none());
```
")]
#[must_use]
pub fn set_color($self, $target: $crate::ColorTarget, $color: Option<impl Into<Color>>) -> Self {
$set_color
}
#[must_use]
pub fn get_color(&$self, $target: $crate::ColorTarget) -> Option<Color> {
$get_color
}
#[must_use]
pub fn set<A: $crate::StylingAttribute<Self>>(self, attr: A, value: A::Value) -> Self {
attr.set_in(self, value)
}
#[must_use]
pub fn get<A: $crate::StylingAttribute<Self>>(&self, attr: A) -> A::Value {
attr.get_from(self)
}
#[must_use]
pub fn remove<A: $crate::StylingAttribute<Self>>(self, attr: A) -> Self {
attr.set_in(self, A::Value::default())
}
};
}
pub(crate) use impl_composed_styling_methods;