diff options
author | ouwou <26526779+ouwou@users.noreply.github.com> | 2020-09-05 21:05:52 -0400 |
---|---|---|
committer | ouwou <26526779+ouwou@users.noreply.github.com> | 2020-09-05 21:05:52 -0400 |
commit | de482d6cb7a57c804e771d14dcb1c592b5f07402 (patch) | |
tree | fa86e2bd69e95e7c4909d4c70053e166920fe66d /components | |
parent | 7d41206a198495c2355e16512391a3aa0483d0ca (diff) | |
download | abaddon-portaudio-de482d6cb7a57c804e771d14dcb1c592b5f07402.tar.gz abaddon-portaudio-de482d6cb7a57c804e771d14dcb1c592b5f07402.zip |
add int -> color to util
Diffstat (limited to 'components')
-rw-r--r-- | components/chatmessage.cpp | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/components/chatmessage.cpp b/components/chatmessage.cpp index 9d4aa46..bb61e81 100644 --- a/components/chatmessage.cpp +++ b/components/chatmessage.cpp @@ -2,6 +2,7 @@ #include <iomanip> #include "chatmessage.hpp" #include "../abaddon.hpp" +#include "../util.hpp" ChatMessageContainer::ChatMessageContainer(const MessageData *data) { UserID = data->Author.ID; @@ -271,17 +272,8 @@ void ChatMessageEmbedItem::DoLayout() { if (m_embed.Color != -1) { auto provider = Gtk::CssProvider::create(); // this seems wrong - int r = (m_embed.Color & 0xFF0000) >> 16; - int g = (m_embed.Color & 0x00FF00) >> 8; - int b = (m_embed.Color & 0x0000FF) >> 0; - std::stringstream css; // lol - css << ".embed { border-left: 2px solid #" - << std::hex << std::setw(2) << std::setfill('0') << r - << std::hex << std::setw(2) << std::setfill('0') << g - << std::hex << std::setw(2) << std::setfill('0') << b - << "; }"; - - provider->load_from_data(css.str()); + std::string css = ".embed { border-left: 2px solid #" + IntToCSSColor(m_embed.Color) + "; }"; + provider->load_from_data(css); style->add_provider(provider, GTK_STYLE_PROVIDER_PRIORITY_APPLICATION); } |