From 933ceeabb339cdf0583a8687528941593381a268 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Mon, 21 Jun 2021 06:25:13 +0200 Subject: Add color themeing, (Theme.hpp/Theme.cpp) and the env var QM_THEME --- src/plugins/Matrix.cpp | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'src/plugins/Matrix.cpp') diff --git a/src/plugins/Matrix.cpp b/src/plugins/Matrix.cpp index 1e20bf6..9f5faf0 100644 --- a/src/plugins/Matrix.cpp +++ b/src/plugins/Matrix.cpp @@ -8,6 +8,7 @@ #include "../../include/Json.hpp" #include "../../include/AsyncImageLoader.hpp" #include "../../include/Utils.hpp" +#include "../../include/Theme.hpp" #include #include #include @@ -624,20 +625,20 @@ namespace QuickMedia { int unread_notification_count = room->unread_notification_count; if(unread_notification_count > 0 && set_room_as_unread) { room_desc += "\n** " + std::to_string(unread_notification_count) + " unread mention(s) **"; // TODO: Better notification? - room->body_item->set_description_color(sf::Color(255, 100, 100)); + room->body_item->set_description_color(get_current_theme().attention_alert_text_color); } else { - room->body_item->set_description_color(sf::Color(179, 179, 179)); + room->body_item->set_description_color(get_current_theme().faded_text_color); } room->body_item->set_description(std::move(room_desc)); if(set_room_as_unread) - room->body_item->set_title_color(sf::Color(255, 100, 100)); + room->body_item->set_title_color(get_current_theme().attention_alert_text_color); room->last_message_read = false; rooms_page->move_room_to_top(room); room_tags_page->move_room_to_top(room); } else if(is_initial_sync) { room->body_item->set_description(extract_first_line_remove_newline_elipses(matrix->message_get_author_displayname(last_new_message.get()), AUTHOR_MAX_LENGTH) + ": " + message_to_room_description_text(last_new_message.get())); - room->body_item->set_description_color(sf::Color(179, 179, 179)); + room->body_item->set_description_color(get_current_theme().faded_text_color); } } @@ -910,7 +911,7 @@ namespace QuickMedia { body_item->set_author(std::move(display_name)); body_item->set_author_color(user_id_to_color(user_info.user_id)); body_item->set_description(user_info.user_id); - body_item->set_description_color(sf::Color(179, 179, 179)); + body_item->set_description_color(get_current_theme().faded_text_color); if(user_info.avatar_url) body_item->thumbnail_url = user_info.avatar_url.value(); body_item->thumbnail_mask_type = ThumbnailMaskType::CIRCLE; @@ -1056,8 +1057,8 @@ namespace QuickMedia { body_item->url = notification.event_id; if(!notification.read) { - body_item->set_author_color(sf::Color(255, 100, 100)); - body_item->set_description_color(sf::Color(255, 100, 100)); + body_item->set_author_color(get_current_theme().attention_alert_text_color); + body_item->set_description_color(get_current_theme().attention_alert_text_color); } body_item->thumbnail_mask_type = ThumbnailMaskType::CIRCLE; @@ -1116,8 +1117,8 @@ namespace QuickMedia { NotificationsExtraData *extra_data = static_cast(body_item->extra.get()); if(!extra_data->read && extra_data->room == room) { extra_data->read = true; - body_item->set_author_color(sf::Color::White); - body_item->set_description_color(sf::Color::White); + body_item->set_author_color(get_current_theme().text_color); + body_item->set_description_color(get_current_theme().text_color); } } } -- cgit v1.2.3