From 3ab6055898c2d6b2809b62ebf6a174f35352c204 Mon Sep 17 00:00:00 2001 From: ouwou <26526779+ouwou@users.noreply.github.com> Date: Fri, 17 Nov 2023 01:49:30 -0500 Subject: disable foreground set on channel renderer, get rid of stray property_sensitive=false --- src/components/channelscellrenderer.cpp | 41 ++++++++++++++++----------------- 1 file changed, 20 insertions(+), 21 deletions(-) (limited to 'src/components/channelscellrenderer.cpp') diff --git a/src/components/channelscellrenderer.cpp b/src/components/channelscellrenderer.cpp index ac98512..c344bb1 100644 --- a/src/components/channelscellrenderer.cpp +++ b/src/components/channelscellrenderer.cpp @@ -243,12 +243,12 @@ void CellRendererChannels::render_vfunc_folder(const Cairo::RefPtr(text_h)); static const auto color = Gdk::RGBA(Abaddon::Get().GetSettings().ChannelColor); - m_renderer_text.property_foreground_rgba() = color; + // m_renderer_text.property_foreground_rgba() = color; m_renderer_text.render(cr, widget, background_area, text_cell_area, flags); const bool hover_only = Abaddon::Get().GetSettings().AnimatedGuildHoverOnly; @@ -465,15 +465,15 @@ void CellRendererChannels::render_vfunc_category(const Cairo::RefPtr 0) { AddUnreadIndicator(cr, background_area); } - m_renderer_text.property_foreground_rgba() = color; + // m_renderer_text.property_foreground_rgba() = color; } m_renderer_text.render(cr, widget, background_area, text_cell_area, flags); - m_renderer_text.property_foreground_set() = false; + // m_renderer_text.property_foreground_set() = false; } // text channel @@ -511,22 +511,21 @@ void CellRendererChannels::render_vfunc_channel(const Cairo::RefPtr & muted.set_red(muted.get_red() * 0.5); muted.set_green(muted.get_green() * 0.5); muted.set_blue(muted.get_blue() * 0.5); - m_renderer_text.property_foreground_rgba() = muted; + // m_renderer_text.property_foreground_rgba() = muted; } else { - m_renderer_text.property_foreground_rgba() = color; + // m_renderer_text.property_foreground_rgba() = color; } m_renderer_text.render(cr, widget, background_area, text_cell_area, flags); - m_renderer_text.property_foreground_set() = false; + // m_renderer_text.property_foreground_set() = false; Gdk::Cairo::set_source_pixbuf(cr, m_property_pixbuf.get_value(), icon_x, icon_y); cr->rectangle(icon_x, icon_y, icon_w, icon_h); -- cgit v1.2.3 From 2b8fc6a495703ba5a3b8d2db2451fd047b34b819 Mon Sep 17 00:00:00 2001 From: ouwou <26526779+ouwou@users.noreply.github.com> Date: Sat, 18 Nov 2023 19:38:54 -0500 Subject: dim channel color on mute by alpha --- src/components/channelscellrenderer.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/components/channelscellrenderer.cpp') diff --git a/src/components/channelscellrenderer.cpp b/src/components/channelscellrenderer.cpp index c344bb1..52bc57e 100644 --- a/src/components/channelscellrenderer.cpp +++ b/src/components/channelscellrenderer.cpp @@ -523,7 +523,14 @@ void CellRendererChannels::render_vfunc_channel(const Cairo::RefPtrget_color(Gtk::STATE_FLAG_NORMAL); + color.set_alpha(0.6); + m_renderer_text.property_foreground_rgba() = color; + } m_renderer_text.render(cr, widget, background_area, text_cell_area, flags); + m_renderer_text.property_foreground_set() = false; // unset foreground to default so properties dont bleed // m_renderer_text.property_foreground_set() = false; -- cgit v1.2.3 From c61feb9f010caa9536e318e2aedb3a4ed739a91d Mon Sep 17 00:00:00 2001 From: ouwou <26526779+ouwou@users.noreply.github.com> Date: Sun, 26 Nov 2023 19:46:02 -0500 Subject: code deduplication unread indicator --- src/components/channelscellrenderer.cpp | 42 ++++++++++++--------------------- 1 file changed, 15 insertions(+), 27 deletions(-) (limited to 'src/components/channelscellrenderer.cpp') diff --git a/src/components/channelscellrenderer.cpp b/src/components/channelscellrenderer.cpp index 52bc57e..35c6137 100644 --- a/src/components/channelscellrenderer.cpp +++ b/src/components/channelscellrenderer.cpp @@ -7,6 +7,17 @@ constexpr static double M_PI = 3.14159265358979; constexpr static double M_PI_H = M_PI / 2.0; constexpr static double M_PI_3_2 = M_PI * 3.0 / 2.0; +void AddUnreadIndicator(const Cairo::RefPtr &cr, const Gdk::Rectangle &background_area) { + static const auto color = Gdk::RGBA(Abaddon::Get().GetSettings().UnreadIndicatorColor); + cr->set_source_rgb(color.get_red(), color.get_green(), color.get_blue()); + const auto x = background_area.get_x(); + const auto y = background_area.get_y(); + const auto w = background_area.get_width(); + const auto h = background_area.get_height(); + cr->rectangle(x, y, 3, h); + cr->fill(); +} + CellRendererChannels::CellRendererChannels() : Glib::ObjectBase(typeid(CellRendererChannels)) , Gtk::CellRenderer() @@ -373,14 +384,9 @@ void CellRendererChannels::render_vfunc_guild(const Cairo::RefPtrset_source_rgb(color.get_red(), color.get_green(), color.get_blue()); - const auto x = background_area.get_x(); - const auto y = background_area.get_y(); - const auto w = background_area.get_width(); - const auto h = background_area.get_height(); - cr->rectangle(x, y + h / 2.0 - 24.0 / 2.0, 3.0, 24.0); - cr->fill(); + auto area = background_area; + area.set_y(area.get_y() + area.get_height() / 2.0 - 24.0 / 2.0); + AddUnreadIndicator(cr, area); } if (total_mentions < 1) return; @@ -410,17 +416,6 @@ void CellRendererChannels::get_preferred_height_for_width_vfunc_category(Gtk::Wi m_renderer_text.get_preferred_height_for_width(widget, width, minimum_height, natural_height); } -void AddUnreadIndicator(const Cairo::RefPtr &cr, const Gdk::Rectangle &background_area) { - static const auto color = Gdk::RGBA(Abaddon::Get().GetSettings().UnreadIndicatorColor); - cr->set_source_rgb(color.get_red(), color.get_green(), color.get_blue()); - const auto x = background_area.get_x(); - const auto y = background_area.get_y(); - const auto w = background_area.get_width(); - const auto h = background_area.get_height(); - cr->rectangle(x, y, 3, h); - cr->fill(); -} - void CellRendererChannels::render_vfunc_category(const Cairo::RefPtr &cr, Gtk::Widget &widget, const Gdk::Rectangle &background_area, const Gdk::Rectangle &cell_area, Gtk::CellRendererState flags) { // todo: figure out how Gtk::Arrow is rendered because i like it better :^) constexpr static int len = 5; @@ -927,14 +922,7 @@ void CellRendererChannels::render_vfunc_dm(const Cairo::RefPtr & if (unread_state < 0) return; if (!is_muted) { - static const auto color = Gdk::RGBA(Abaddon::Get().GetSettings().UnreadIndicatorColor); - cr->set_source_rgb(color.get_red(), color.get_green(), color.get_blue()); - const auto x = background_area.get_x(); - const auto y = background_area.get_y(); - const auto w = background_area.get_width(); - const auto h = background_area.get_height(); - cr->rectangle(x, y, 3, h); - cr->fill(); + AddUnreadIndicator(cr, background_area); } } -- cgit v1.2.3 From 5ea80d1a147c445468293277a517558e727dd4f9 Mon Sep 17 00:00:00 2001 From: ouwou <26526779+ouwou@users.noreply.github.com> Date: Fri, 15 Dec 2023 20:46:36 -0500 Subject: use selected bg for expander color --- src/components/channelscellrenderer.cpp | 102 +++++++++----------------------- 1 file changed, 29 insertions(+), 73 deletions(-) (limited to 'src/components/channelscellrenderer.cpp') diff --git a/src/components/channelscellrenderer.cpp b/src/components/channelscellrenderer.cpp index 35c6137..bbe19e7 100644 --- a/src/components/channelscellrenderer.cpp +++ b/src/components/channelscellrenderer.cpp @@ -18,6 +18,32 @@ void AddUnreadIndicator(const Cairo::RefPtr &cr, const Gdk::Rect cr->fill(); } +void RenderExpander(int x_offset, const Cairo::RefPtr &cr, Gtk::Widget &widget, const Gdk::Rectangle &background_area, bool is_expanded) { + constexpr static int len = 5; + int x1, y1, x2, y2, x3, y3; + if (is_expanded) { + x1 = background_area.get_x() + x_offset; + y1 = background_area.get_y() + background_area.get_height() / 2 - len; + x2 = background_area.get_x() + x_offset + len; + y2 = background_area.get_y() + background_area.get_height() / 2 + len; + x3 = background_area.get_x() + x_offset + len * 2; + y3 = background_area.get_y() + background_area.get_height() / 2 - len; + } else { + x1 = background_area.get_x() + x_offset; + y1 = background_area.get_y() + background_area.get_height() / 2 - len; + x2 = background_area.get_x() + x_offset + len * 2; + y2 = background_area.get_y() + background_area.get_height() / 2; + x3 = background_area.get_x() + x_offset; + y3 = background_area.get_y() + background_area.get_height() / 2 + len; + } + cr->move_to(x1, y1); + cr->line_to(x2, y2); + cr->line_to(x3, y3); + const auto expander_color = widget.get_style_context()->get_background_color(Gtk::STATE_FLAG_SELECTED); + cr->set_source_rgb(expander_color.get_red(), expander_color.get_green(), expander_color.get_blue()); + cr->stroke(); +} + CellRendererChannels::CellRendererChannels() : Glib::ObjectBase(typeid(CellRendererChannels)) , Gtk::CellRenderer() @@ -218,30 +244,7 @@ void CellRendererChannels::get_preferred_height_for_width_vfunc_folder(Gtk::Widg } void CellRendererChannels::render_vfunc_folder(const Cairo::RefPtr &cr, Gtk::Widget &widget, const Gdk::Rectangle &background_area, const Gdk::Rectangle &cell_area, Gtk::CellRendererState flags) { - constexpr static int len = 5; - int x1, y1, x2, y2, x3, y3; - if (property_expanded()) { - x1 = background_area.get_x() + 7; - y1 = background_area.get_y() + background_area.get_height() / 2 - len; - x2 = background_area.get_x() + 7 + len; - y2 = background_area.get_y() + background_area.get_height() / 2 + len; - x3 = background_area.get_x() + 7 + len * 2; - y3 = background_area.get_y() + background_area.get_height() / 2 - len; - } else { - x1 = background_area.get_x() + 7; - y1 = background_area.get_y() + background_area.get_height() / 2 - len; - x2 = background_area.get_x() + 7 + len * 2; - y2 = background_area.get_y() + background_area.get_height() / 2; - x3 = background_area.get_x() + 7; - y3 = background_area.get_y() + background_area.get_height() / 2 + len; - } - cr->move_to(x1, y1); - cr->line_to(x2, y2); - cr->line_to(x3, y3); - const auto expander_color = Gdk::RGBA(Abaddon::Get().GetSettings().ChannelsExpanderColor); - cr->set_source_rgb(expander_color.get_red(), expander_color.get_green(), expander_color.get_blue()); - cr->stroke(); - + RenderExpander(7, cr, widget, background_area, property_expanded()); Gtk::Requisition text_minimum, text_natural; m_renderer_text.get_preferred_size(widget, text_minimum, text_natural); @@ -417,30 +420,7 @@ void CellRendererChannels::get_preferred_height_for_width_vfunc_category(Gtk::Wi } void CellRendererChannels::render_vfunc_category(const Cairo::RefPtr &cr, Gtk::Widget &widget, const Gdk::Rectangle &background_area, const Gdk::Rectangle &cell_area, Gtk::CellRendererState flags) { - // todo: figure out how Gtk::Arrow is rendered because i like it better :^) - constexpr static int len = 5; - int x1, y1, x2, y2, x3, y3; - if (property_expanded()) { - x1 = background_area.get_x() + 7; - y1 = background_area.get_y() + background_area.get_height() / 2 - len; - x2 = background_area.get_x() + 7 + len; - y2 = background_area.get_y() + background_area.get_height() / 2 + len; - x3 = background_area.get_x() + 7 + len * 2; - y3 = background_area.get_y() + background_area.get_height() / 2 - len; - } else { - x1 = background_area.get_x() + 7; - y1 = background_area.get_y() + background_area.get_height() / 2 - len; - x2 = background_area.get_x() + 7 + len * 2; - y2 = background_area.get_y() + background_area.get_height() / 2; - x3 = background_area.get_x() + 7; - y3 = background_area.get_y() + background_area.get_height() / 2 + len; - } - cr->move_to(x1, y1); - cr->line_to(x2, y2); - cr->line_to(x3, y3); - const auto expander_color = Gdk::RGBA(Abaddon::Get().GetSettings().ChannelsExpanderColor); - cr->set_source_rgb(expander_color.get_red(), expander_color.get_green(), expander_color.get_blue()); - cr->stroke(); + RenderExpander(7, cr, widget, background_area, property_expanded()); Gtk::Requisition text_minimum, text_natural; m_renderer_text.get_preferred_size(widget, text_minimum, text_natural); @@ -668,31 +648,7 @@ void CellRendererChannels::render_vfunc_voice_channel(const Cairo::RefPtrshow_in_cairo_context(cr); - // expander - constexpr static int len = 5; - constexpr static int offset = 24; - int x1, y1, x2, y2, x3, y3; - if (property_expanded()) { - x1 = background_area.get_x() + offset; - y1 = background_area.get_y() + background_area.get_height() / 2 - len; - x2 = background_area.get_x() + offset + len; - y2 = background_area.get_y() + background_area.get_height() / 2 + len; - x3 = background_area.get_x() + offset + len * 2; - y3 = background_area.get_y() + background_area.get_height() / 2 - len; - } else { - x1 = background_area.get_x() + offset; - y1 = background_area.get_y() + background_area.get_height() / 2 - len; - x2 = background_area.get_x() + offset + len * 2; - y2 = background_area.get_y() + background_area.get_height() / 2; - x3 = background_area.get_x() + offset; - y3 = background_area.get_y() + background_area.get_height() / 2 + len; - } - cr->move_to(x1, y1); - cr->line_to(x2, y2); - cr->line_to(x3, y3); - const auto expander_color = Gdk::RGBA(Abaddon::Get().GetSettings().ChannelsExpanderColor); - cr->set_source_rgb(expander_color.get_red(), expander_color.get_green(), expander_color.get_blue()); - cr->stroke(); + RenderExpander(24, cr, widget, background_area, property_expanded()); } // voice participant -- cgit v1.2.3 From 19282c8642f5bc1c064a8f8645b2d5380d2014b4 Mon Sep 17 00:00:00 2001 From: ouwou <26526779+ouwou@users.noreply.github.com> Date: Fri, 15 Dec 2023 21:44:58 -0500 Subject: allow override expander color --- src/components/channelscellrenderer.cpp | 5 ++++- src/settings.hpp | 3 +-- 2 files changed, 5 insertions(+), 3 deletions(-) (limited to 'src/components/channelscellrenderer.cpp') diff --git a/src/components/channelscellrenderer.cpp b/src/components/channelscellrenderer.cpp index bbe19e7..3f10330 100644 --- a/src/components/channelscellrenderer.cpp +++ b/src/components/channelscellrenderer.cpp @@ -39,7 +39,10 @@ void RenderExpander(int x_offset, const Cairo::RefPtr &cr, Gtk:: cr->move_to(x1, y1); cr->line_to(x2, y2); cr->line_to(x3, y3); - const auto expander_color = widget.get_style_context()->get_background_color(Gtk::STATE_FLAG_SELECTED); + auto expander_color = Gdk::RGBA(Abaddon::Get().GetSettings().ChannelsExpanderColor); + if (expander_color.get_alpha_u() == 0) { + expander_color = widget.get_style_context()->get_background_color(Gtk::STATE_FLAG_SELECTED); + } cr->set_source_rgb(expander_color.get_red(), expander_color.get_green(), expander_color.get_blue()); cr->stroke(); } diff --git a/src/settings.hpp b/src/settings.hpp index 67ba515..a51d93b 100644 --- a/src/settings.hpp +++ b/src/settings.hpp @@ -38,8 +38,7 @@ public: std::string UserAgent { "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.87 Safari/537.36" }; // [style] - // TODO: convert to StyleProperty... or maybe not? i still cant figure out what the "correct" method is for this - std::string ChannelsExpanderColor { "rgba(255, 83, 112, 255)" }; + std::string ChannelsExpanderColor { "rgba(255, 83, 112, 0)" }; std::string NSFWChannelColor { "#ed6666" }; std::string ChannelColor { "#fbfbfb" }; std::string MentionBadgeColor { "#b82525" }; -- cgit v1.2.3 From 0187e6958464f9a9d5c8bc1143d6dfac60e862b1 Mon Sep 17 00:00:00 2001 From: ouwou <26526779+ouwou@users.noreply.github.com> Date: Fri, 15 Dec 2023 22:06:16 -0500 Subject: remove channel color style setting --- src/components/channelscellrenderer.cpp | 57 ++------------------------------- src/settings.cpp | 2 -- src/settings.hpp | 1 - 3 files changed, 3 insertions(+), 57 deletions(-) (limited to 'src/components/channelscellrenderer.cpp') diff --git a/src/components/channelscellrenderer.cpp b/src/components/channelscellrenderer.cpp index 3f10330..7fd97da 100644 --- a/src/components/channelscellrenderer.cpp +++ b/src/components/channelscellrenderer.cpp @@ -258,14 +258,11 @@ void CellRendererChannels::render_vfunc_folder(const Cairo::RefPtr(text_w), static_cast(text_h)); - static const auto color = Gdk::RGBA(Abaddon::Get().GetSettings().ChannelColor); - // m_renderer_text.property_foreground_rgba() = color; m_renderer_text.render(cr, widget, background_area, text_cell_area, flags); const bool hover_only = Abaddon::Get().GetSettings().AnimatedGuildHoverOnly; @@ -435,23 +430,14 @@ void CellRendererChannels::render_vfunc_category(const Cairo::RefPtr 0) { AddUnreadIndicator(cr, background_area); } - // m_renderer_text.property_foreground_rgba() = color; } m_renderer_text.render(cr, widget, background_area, text_cell_area, flags); - // m_renderer_text.property_foreground_set() = false; } // text channel @@ -487,20 +473,7 @@ void CellRendererChannels::render_vfunc_channel(const Cairo::RefPtrget_color(Gtk::STATE_FLAG_NORMAL); @@ -509,8 +482,6 @@ void CellRendererChannels::render_vfunc_channel(const Cairo::RefPtr & const auto id = m_property_id.get_value(); const bool is_muted = discord.IsChannelMuted(id); - static const auto color = Gdk::RGBA(Abaddon::Get().GetSettings().ChannelColor); - if (Abaddon::Get().GetDiscordClient().IsChannelMuted(m_property_id.get_value())) { - auto muted = color; - muted.set_red(muted.get_red() * 0.5); - muted.set_green(muted.get_green() * 0.5); - muted.set_blue(muted.get_blue() * 0.5); - // m_renderer_text.property_foreground_rgba() = muted; - } else { - // m_renderer_text.property_foreground_rgba() = color; - } m_renderer_text.render(cr, widget, background_area, text_cell_area, flags); - // m_renderer_text.property_foreground_set() = false; Gdk::Cairo::set_source_pixbuf(cr, m_property_pixbuf.get_value(), icon_x, icon_y); cr->rectangle(icon_x, icon_y, icon_w, icon_h); diff --git a/src/settings.cpp b/src/settings.cpp index 368d5bb..d1dff3f 100644 --- a/src/settings.cpp +++ b/src/settings.cpp @@ -69,7 +69,6 @@ void SettingsManager::ReadSettings() { SMSTR("http", "user_agent", UserAgent); SMSTR("style", "expandercolor", ChannelsExpanderColor); SMSTR("style", "nsfwchannelcolor", NSFWChannelColor); - SMSTR("style", "channelcolor", ChannelColor); SMSTR("style", "mentionbadgecolor", MentionBadgeColor); SMSTR("style", "mentionbadgetextcolor", MentionBadgeTextColor); SMSTR("style", "unreadcolor", UnreadIndicatorColor); @@ -159,7 +158,6 @@ void SettingsManager::Close() { SMSTR("http", "user_agent", UserAgent); SMSTR("style", "expandercolor", ChannelsExpanderColor); SMSTR("style", "nsfwchannelcolor", NSFWChannelColor); - SMSTR("style", "channelcolor", ChannelColor); SMSTR("style", "mentionbadgecolor", MentionBadgeColor); SMSTR("style", "mentionbadgetextcolor", MentionBadgeTextColor); SMSTR("style", "unreadcolor", UnreadIndicatorColor); diff --git a/src/settings.hpp b/src/settings.hpp index a51d93b..99e1adc 100644 --- a/src/settings.hpp +++ b/src/settings.hpp @@ -40,7 +40,6 @@ public: // [style] std::string ChannelsExpanderColor { "rgba(255, 83, 112, 0)" }; std::string NSFWChannelColor { "#ed6666" }; - std::string ChannelColor { "#fbfbfb" }; std::string MentionBadgeColor { "#b82525" }; std::string MentionBadgeTextColor { "#fbfbfb" }; std::string UnreadIndicatorColor { "#ffffff" }; -- cgit v1.2.3 From 618cd27d94a23a23674fe759bdc74f938ac3d6fe Mon Sep 17 00:00:00 2001 From: ouwou <26526779+ouwou@users.noreply.github.com> Date: Sat, 16 Dec 2023 20:01:56 -0500 Subject: draw nsfw channels red again --- src/components/channelscellrenderer.cpp | 10 +++++----- src/settings.hpp | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'src/components/channelscellrenderer.cpp') diff --git a/src/components/channelscellrenderer.cpp b/src/components/channelscellrenderer.cpp index 7fd97da..d612812 100644 --- a/src/components/channelscellrenderer.cpp +++ b/src/components/channelscellrenderer.cpp @@ -475,11 +475,11 @@ void CellRendererChannels::render_vfunc_channel(const Cairo::RefPtrget_color(Gtk::STATE_FLAG_NORMAL); - color.set_alpha(0.6); - m_renderer_text.property_foreground_rgba() = color; - } + auto color = widget.get_style_context()->get_color(Gtk::STATE_FLAG_NORMAL); + if (property_nsfw()) color = nsfw_color; + if (is_muted) color.set_alpha(0.6); + + m_renderer_text.property_foreground_rgba() = color; m_renderer_text.render(cr, widget, background_area, text_cell_area, flags); m_renderer_text.property_foreground_set() = false; diff --git a/src/settings.hpp b/src/settings.hpp index 99e1adc..c51e635 100644 --- a/src/settings.hpp +++ b/src/settings.hpp @@ -39,7 +39,7 @@ public: // [style] std::string ChannelsExpanderColor { "rgba(255, 83, 112, 0)" }; - std::string NSFWChannelColor { "#ed6666" }; + std::string NSFWChannelColor { "#970d0d" }; std::string MentionBadgeColor { "#b82525" }; std::string MentionBadgeTextColor { "#fbfbfb" }; std::string UnreadIndicatorColor { "#ffffff" }; -- cgit v1.2.3 From 6d7ddcd42fd1de1f0ea3eda83e3c76f2d34b6a12 Mon Sep 17 00:00:00 2001 From: ouwou <26526779+ouwou@users.noreply.github.com> Date: Sat, 16 Dec 2023 20:38:46 -0500 Subject: use background style colors for unread indicator and mention badges --- src/components/channelscellrenderer.cpp | 31 +++++++++++++++---------------- src/settings.hpp | 6 +++--- 2 files changed, 18 insertions(+), 19 deletions(-) (limited to 'src/components/channelscellrenderer.cpp') diff --git a/src/components/channelscellrenderer.cpp b/src/components/channelscellrenderer.cpp index d612812..bf84a9b 100644 --- a/src/components/channelscellrenderer.cpp +++ b/src/components/channelscellrenderer.cpp @@ -7,8 +7,11 @@ constexpr static double M_PI = 3.14159265358979; constexpr static double M_PI_H = M_PI / 2.0; constexpr static double M_PI_3_2 = M_PI * 3.0 / 2.0; -void AddUnreadIndicator(const Cairo::RefPtr &cr, const Gdk::Rectangle &background_area) { - static const auto color = Gdk::RGBA(Abaddon::Get().GetSettings().UnreadIndicatorColor); +void AddUnreadIndicator(const Cairo::RefPtr &cr, Gtk::Widget &widget, const Gdk::Rectangle &background_area) { + static const auto color_setting = Gdk::RGBA(Abaddon::Get().GetSettings().UnreadIndicatorColor); + + const auto color = color_setting.get_alpha_u() > 0 ? color_setting : widget.get_style_context()->get_background_color(Gtk::STATE_FLAG_SELECTED); + cr->set_source_rgb(color.get_red(), color.get_green(), color.get_blue()); const auto x = background_area.get_x(); const auto y = background_area.get_y(); @@ -387,7 +390,7 @@ void CellRendererChannels::render_vfunc_guild(const Cairo::RefPtr 0) { - AddUnreadIndicator(cr, background_area); + AddUnreadIndicator(cr, widget, background_area); } } m_renderer_text.render(cr, widget, background_area, text_cell_area, flags); @@ -490,7 +493,7 @@ void CellRendererChannels::render_vfunc_channel(const Cairo::RefPtrset_source_rgb(color.get_red(), color.get_green(), color.get_blue()); - const auto x = background_area.get_x(); - const auto y = background_area.get_y(); - const auto w = background_area.get_width(); - const auto h = background_area.get_height(); - cr->rectangle(x, y, 3, h); - cr->fill(); + AddUnreadIndicator(cr, widget, background_area); } if (unread_state < 1) return; @@ -830,7 +826,7 @@ void CellRendererChannels::render_vfunc_dm(const Cairo::RefPtr & if (unread_state < 0) return; if (!is_muted) { - AddUnreadIndicator(cr, background_area); + AddUnreadIndicator(cr, widget, background_area); } } @@ -857,8 +853,11 @@ void CellRendererChannels::unread_render_mentions(const Cairo::RefPtrget_pixel_size(width, height); { - static const auto bg = Gdk::RGBA(Abaddon::Get().GetSettings().MentionBadgeColor); - static const auto text = Gdk::RGBA(Abaddon::Get().GetSettings().MentionBadgeTextColor); + static const auto badge_setting = Gdk::RGBA(Abaddon::Get().GetSettings().MentionBadgeColor); + static const auto text_setting = Gdk::RGBA(Abaddon::Get().GetSettings().MentionBadgeTextColor); + + auto bg = badge_setting.get_alpha_u() > 0 ? badge_setting : widget.get_style_context()->get_background_color(Gtk::STATE_FLAG_SELECTED); + auto text = text_setting.get_alpha_u() > 0 ? text_setting : widget.get_style_context()->get_color(Gtk::STATE_FLAG_SELECTED); const auto x = cell_area.get_x() + edge - width - MentionsRightPad; const auto y = cell_area.get_y() + cell_area.get_height() / 2.0 - height / 2.0 - 1; diff --git a/src/settings.hpp b/src/settings.hpp index c51e635..419734c 100644 --- a/src/settings.hpp +++ b/src/settings.hpp @@ -40,9 +40,9 @@ public: // [style] std::string ChannelsExpanderColor { "rgba(255, 83, 112, 0)" }; std::string NSFWChannelColor { "#970d0d" }; - std::string MentionBadgeColor { "#b82525" }; - std::string MentionBadgeTextColor { "#fbfbfb" }; - std::string UnreadIndicatorColor { "#ffffff" }; + std::string MentionBadgeColor { "rgba(184, 37, 37, 0)" }; + std::string MentionBadgeTextColor { "rgba(251, 251, 251, 0)" }; + std::string UnreadIndicatorColor { "rgba(255, 255, 255, 0)" }; // [notifications] #ifdef _WIN32 -- cgit v1.2.3