20namespace comms::literals {
25consteval Color operator""_color(
const char* str,
const std::size_t len) {
28 throw "commons: invalid color literal";
37consteval Icon operator""_icon(
const char* str,
const std::size_t len) {
38 const auto i =
Icon::parse(std::string_view{str, len});
40 throw "commons: invalid icon literal";
A tiny RGBA color container with rich, mostly-constexpr color manipulation, plus the Hsl/Hsv model st...
A tiny value type carrying an Iconify icon identifier such as mdi:abacus (a set:name pair).
An 8-bit-per-channel RGBA color. Default is opaque black.
Definition color.hpp:347
static constexpr std::optional< Color > parse_hex(std::string_view s)
Parse a hex color: #rgb, #rgba, #rrggbb, or #rrggbbaa (the leading # is optional).
Definition color.hpp:759
An Iconify icon identifier — a set:name pair such as mdi:abacus.
Definition icon.hpp:43
static constexpr std::optional< Icon > parse(const std::string_view value)
Non-throwing validation: returns the Icon for a well-formed value (exactly one :, non-empty set and n...
Definition icon.hpp:96