From: Vsevolod Stakhov Date: Mon, 14 Jun 2021 12:21:20 +0000 (+0100) Subject: [Minor] Add conversion to rgb without alpha channel X-Git-Tag: 3.0~308 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=b1a47611bedc66ce0bd26efd1ff5cee720f6aeac;p=rspamd.git [Minor] Add conversion to rgb without alpha channel --- diff --git a/src/libserver/css/css_value.hxx b/src/libserver/css/css_value.hxx index a7b9a9b47..efb18e20a 100644 --- a/src/libserver/css/css_value.hxx +++ b/src/libserver/css/css_value.hxx @@ -46,6 +46,12 @@ struct alignas(int) css_color { (std::uint32_t)g << 8 | (std::uint32_t)b << 0; } + + constexpr auto to_rgb() const -> std::uint32_t { + return (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); }