Update document WIP.

This commit is contained in:
ArthurSonzogni
2020-05-25 01:34:13 +02:00
committed by Arthur Sonzogni
parent 177df31d41
commit 75c424cea9
55 changed files with 3244 additions and 152 deletions

View File

@@ -42,18 +42,60 @@ class FgColor : public NodeDecorator {
Color color_;
};
Element color(Color c, Element child) {
return std::make_shared<FgColor>(unpack(std::move(child)), c);
/// @brief Set the foreground color of an element.
/// @param The color of the output element.
/// @param The input element.
/// @return The output element colored.
/// @ingroup dom
///
/// ### Example
///
/// ```cpp
/// Element document = color(Color::Green, text(L"Success")),
/// ```
Element color(Color color, Element child) {
return std::make_shared<FgColor>(unpack(std::move(child)), color);
}
Element bgcolor(Color c, Element child) {
return std::make_shared<BgColor>(unpack(std::move(child)), c);
/// @brief Set the background color of an element.
/// @param The color of the output element.
/// @param The input element.
/// @return The output element colored.
/// @ingroup dom
///
/// ### Example
///
/// ```cpp
/// Element document = bgcolor(Color::Green, text(L"Success")),
/// ```
Element bgcolor(Color color, Element child) {
return std::make_shared<BgColor>(unpack(std::move(child)), color);
}
/// @brief Decorate using a foreground color.
/// @param c The foreground color to be applied.
/// @return The Decorator applying the color.
/// @ingroup dom
///
/// ### Example
///
/// ```cpp
/// Element document = text(L"red") | color(Color::Red);
/// ```
Decorator color(Color c) {
return [c](Element child) { return color(c, std::move(child)); };
}
/// @brief Decorate using a background color.
/// @param The background color to be applied.
/// @return The Decorator applying the color.
/// @ingroup dom
///
/// ### Example
///
/// ```cpp
/// Element document = text(L"red") | bgcolor(Color::Red);
/// ```
Decorator bgcolor(Color c) {
return [c](Element child) { return bgcolor(c, std::move(child)); };
}