diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2021-05-21 16:28:26 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2021-05-21 16:28:26 +0100 |
commit | adeb3780e89cc42dd452280428bf46b1a0efc63b (patch) | |
tree | 20ef62aeec64060d4fe38a3c59056d5512d0a945 /src/libserver/css | |
parent | d444d10095936cd246a41d3eeda66d279efec612 (diff) | |
download | rspamd-adeb3780e89cc42dd452280428bf46b1a0efc63b.tar.gz rspamd-adeb3780e89cc42dd452280428bf46b1a0efc63b.zip |
[Minor] Css: Allow to convert css color to uint32_t
Diffstat (limited to 'src/libserver/css')
-rw-r--r-- | src/libserver/css/css_value.hxx | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/libserver/css/css_value.hxx b/src/libserver/css/css_value.hxx index 4c013124c..9e192acb6 100644 --- a/src/libserver/css/css_value.hxx +++ b/src/libserver/css/css_value.hxx @@ -40,6 +40,12 @@ struct alignas(int) css_color { css_color(std::uint8_t _r, std::uint8_t _g, std::uint8_t _b, std::uint8_t _alpha = 255) : r(_r), g(_g), b(_b), alpha(_alpha) {} css_color() = default; + constexpr auto to_number() const -> std::uint32_t { + return (std::uint32_t)alpha << 24 | + (std::uint32_t)r << 16 | + (std::uint32_t)g << 8 | + (std::uint32_t)b << 0; + } friend bool operator==(const css_color& l, const css_color& r) { return (memcmp(&l, &r, sizeof(css_color)) == 0); } |