summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorouwou <26526779+ouwou@users.noreply.github.com>2022-01-21 00:41:35 -0500
committerouwou <26526779+ouwou@users.noreply.github.com>2022-01-21 00:41:35 -0500
commit0ce509f80e238f7ffe14623761269aba8295c0f4 (patch)
tree9fa67decaea1d851162e8dca46fa9c63a9fbde2b
parentb6b215ee6f08e4e7d6d987ffd676cebeb8638a62 (diff)
downloadabaddon-portaudio-0ce509f80e238f7ffe14623761269aba8295c0f4.tar.gz
abaddon-portaudio-0ce509f80e238f7ffe14623761269aba8295c0f4.zip
add settings for some colors
-rw-r--r--src/components/channelscellrenderer.cpp53
-rw-r--r--src/settings.cpp6
-rw-r--r--src/settings.hpp5
3 files changed, 50 insertions, 14 deletions
diff --git a/src/components/channelscellrenderer.cpp b/src/components/channelscellrenderer.cpp
index fa7880f..a914d59 100644
--- a/src/components/channelscellrenderer.cpp
+++ b/src/components/channelscellrenderer.cpp
@@ -214,6 +214,8 @@ void CellRendererChannels::render_vfunc_guild(const Cairo::RefPtr<Cairo::Context
Gdk::Rectangle text_cell_area(text_x, text_y, text_w, 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;
@@ -327,9 +329,16 @@ void CellRendererChannels::render_vfunc_category(const Cairo::RefPtr<Cairo::Cont
Gdk::Rectangle text_cell_area(text_x, text_y, text_w, text_h);
- static Gdk::RGBA muted_color("#7f7f7f");
- if (Abaddon::Get().GetDiscordClient().IsChannelMuted(m_property_id.get_value()))
- m_renderer_text.property_foreground_rgba() = muted_color;
+ 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;
}
@@ -367,10 +376,10 @@ void CellRendererChannels::render_vfunc_channel(const Cairo::RefPtr<Cairo::Conte
const auto id = m_property_id.get_value();
const bool is_muted = discord.IsChannelMuted(id);
- // move to style in msys?
- static Gdk::RGBA sfw_unmuted("#FFFFFF");
+ static const auto sfw_unmuted = Gdk::RGBA(Abaddon::Get().GetSettings().ChannelColor);
- const auto nsfw_color = Gdk::RGBA(Abaddon::Get().GetSettings().NSFWChannelColor);
+ m_renderer_text.property_sensitive() = false;
+ static const auto nsfw_color = Gdk::RGBA(Abaddon::Get().GetSettings().NSFWChannelColor);
if (m_property_nsfw.get_value())
m_renderer_text.property_foreground_rgba() = nsfw_color;
else
@@ -443,9 +452,16 @@ void CellRendererChannels::render_vfunc_thread(const Cairo::RefPtr<Cairo::Contex
const auto id = m_property_id.get_value();
const bool is_muted = discord.IsChannelMuted(id);
- static Gdk::RGBA muted_color("#7f7f7f");
- if (discord.IsChannelMuted(m_property_id.get_value()))
- m_renderer_text.property_foreground_rgba() = muted_color;
+ 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;
@@ -569,8 +585,16 @@ void CellRendererChannels::render_vfunc_dm(const Cairo::RefPtr<Cairo::Context> &
const auto id = m_property_id.get_value();
const bool is_muted = discord.IsChannelMuted(id);
- if (is_muted)
- m_renderer_text.property_foreground() = "#7f7f7f";
+ 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;
@@ -617,12 +641,15 @@ void CellRendererChannels::unread_render_mentions(const Cairo::RefPtr<Cairo::Con
int width, height;
layout->get_pixel_size(width, height);
{
+ static const auto bg = Gdk::RGBA(Abaddon::Get().GetSettings().MentionBadgeColor);
+ static const auto text = Gdk::RGBA(Abaddon::Get().GetSettings().MentionBadgeTextColor);
+
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;
cairo_path_rounded_rect(cr, x - 4, y + 2, width + 8, height, 5);
- cr->set_source_rgb(184.0 / 255.0, 37.0 / 255.0, 37.0 / 255.0);
+ cr->set_source_rgb(bg.get_red(), bg.get_green(), bg.get_blue());
cr->fill();
- cr->set_source_rgb(1.0, 1.0, 1.0);
+ cr->set_source_rgb(text.get_red(), text.get_green(), text.get_blue());
cr->move_to(x, y);
layout->show_in_cairo_context(cr);
}
diff --git a/src/settings.cpp b/src/settings.cpp
index 6820ed0..999d323 100644
--- a/src/settings.cpp
+++ b/src/settings.cpp
@@ -52,6 +52,9 @@ void SettingsManager::ReadSettings() {
SMSTR("style", "expandercolor", ChannelsExpanderColor);
SMSTR("style", "linkcolor", LinkColor);
SMSTR("style", "nsfwchannelcolor", NSFWChannelColor);
+ SMSTR("style", "channelcolor", ChannelColor);
+ SMSTR("style", "mentionbadgecolor", MentionBadgeColor);
+ SMSTR("style", "mentionbadgetextcolor", MentionBadgeTextColor);
#undef SMBOOL
#undef SMSTR
@@ -100,6 +103,9 @@ void SettingsManager::Close() {
SMSTR("style", "expandercolor", ChannelsExpanderColor);
SMSTR("style", "linkcolor", LinkColor);
SMSTR("style", "nsfwchannelcolor", NSFWChannelColor);
+ SMSTR("style", "channelcolor", ChannelColor);
+ SMSTR("style", "mentionbadgecolor", MentionBadgeColor);
+ SMSTR("style", "mentionbadgetextcolor", MentionBadgeTextColor);
#undef SMSTR
#undef SMBOOL
diff --git a/src/settings.hpp b/src/settings.hpp
index ca2303f..0d5f3a5 100644
--- a/src/settings.hpp
+++ b/src/settings.hpp
@@ -32,10 +32,13 @@ 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
+ // TODO: convert to StyleProperty... or maybe not? i still cant figure out what the "correct" method is for this
std::string LinkColor { "rgba(40, 200, 180, 255)" };
std::string ChannelsExpanderColor { "rgba(255, 83, 112, 255)" };
std::string NSFWChannelColor { "#ed6666" };
+ std::string ChannelColor { "#fbfbfb" };
+ std::string MentionBadgeColor { "#b82525" };
+ std::string MentionBadgeTextColor { "#fbfbfb" };
};
SettingsManager(const std::string &filename);