Chatterino
Theme.hpp
Go to the documentation of this file.
1 #pragma once
2 
3 #include "common/Singleton.hpp"
5 
6 #include <QBrush>
7 #include <QColor>
8 #include <pajlada/settings/setting.hpp>
10 
11 namespace chatterino {
12 
13 class WindowManager;
14 
15 class Theme final : public Singleton
16 {
17 public:
18  Theme();
19 
20  bool isLightTheme() const;
21 
22  struct TabColors {
23  QColor text;
24  struct {
25  QBrush regular;
26  QBrush hover;
27  QBrush unfocused;
28  } backgrounds;
29  struct {
30  QColor regular;
31  QColor hover;
32  QColor unfocused;
33  } line;
34  };
35 
36  QColor accent{"#00aeef"};
37 
39  struct {
40  QColor background;
41  QColor text;
43  QColor borderFocused;
44  } window;
45 
47  struct {
52  QColor border;
53  QColor dividerLine;
54  } tabs;
55 
57  struct {
58  struct {
59  QColor regular;
60  QColor caret;
61  QColor link;
62  QColor system;
64  } textColors;
65 
66  struct {
67  QColor regular;
68  QColor alternate;
69  // QColor whisper;
70  } backgrounds;
71 
72  QColor disabled;
73  // QColor seperator;
74  // QColor seperatorInner;
75  QColor selection;
76 
79  } messages;
80 
82  struct {
83  QColor background;
84  QColor thumb;
85  QColor thumbSelected;
86  struct {
87  QColor highlight;
88  QColor subscription;
89  } highlights;
90  } scrollbars;
91 
93  struct {
94  QColor text;
95  QColor background;
96  } tooltip;
97 
99  struct {
101  QColor background;
102  QColor dropPreview;
106  QColor resizeHandle;
108 
109  struct {
110  QColor border;
112  QColor background;
114  QColor text;
115  QColor focusedText;
116  // int margin;
117  } header;
118 
119  struct {
120  QColor border;
121  QColor background;
122  QColor selection;
123  QColor focusedLine;
124  QColor text;
125  QString styleSheet;
126  // int margin;
127  } input;
128  } splits;
129 
130  struct {
131  QPixmap copy;
132  QPixmap pin;
133  } buttons;
134 
135  void normalizeColor(QColor &color);
136  void update();
137  QColor blendColors(const QColor &color1, const QColor &color2, qreal ratio);
138 
139  pajlada::Signals::NoArgSignal updated;
140 
141  QStringSetting themeName{"/appearance/theme/name", "Dark"};
142  DoubleSetting themeHue{"/appearance/theme/hue", 0.0};
143 
144 private:
145  bool isLight_ = false;
146  void actuallyUpdate(double hue, double multiplier);
147 
148  pajlada::Signals::NoArgSignal repaintVisibleChatWidgets_;
149 
150  friend class WindowManager;
151 };
152 
153 Theme *getTheme();
154 } // namespace chatterino
QColor link
Definition: Theme.hpp:61
QStringSetting themeName
Definition: Theme.hpp:141
QColor borderFocused
Definition: Theme.hpp:43
QColor messageSeperator
Definition: Theme.hpp:100
QColor caret
Definition: Theme.hpp:60
QColor thumb
Definition: Theme.hpp:84
QColor chatPlaceholder
Definition: Theme.hpp:63
QColor text
Definition: Theme.hpp:23
QColor dividerLine
Definition: Theme.hpp:53
TabColors newMessage
Definition: Theme.hpp:49
struct chatterino::Theme::@14 scrollbars
SCROLLBAR.
struct chatterino::Theme::@14::@22 highlights
Definition: Singleton.hpp:10
struct chatterino::Theme::@17 buttons
QColor borderUnfocused
Definition: Theme.hpp:42
QColor blendColors(const QColor &color1, const QColor &color2, qreal ratio)
Definition: Theme.cpp:50
struct chatterino::Theme::@12 tabs
TABS.
struct chatterino::Theme::@13 messages
MESSAGES.
QPixmap pin
Definition: Theme.hpp:132
struct chatterino::Theme::TabColors::@19 line
Definition: Application.cpp:48
QColor highlightAnimationStart
Definition: Theme.hpp:77
QBrush hover
Definition: Theme.hpp:26
QPixmap copy
Definition: Theme.hpp:131
pajlada::Signals::NoArgSignal updated
Definition: Theme.hpp:139
QColor dropPreview
Definition: Theme.hpp:102
Definition: WindowManager.hpp:27
QBrush regular
Definition: Theme.hpp:25
void update()
Definition: Theme.cpp:76
QColor focusedBorder
Definition: Theme.hpp:111
QColor hover
Definition: Theme.hpp:31
QColor regular
Definition: Theme.hpp:30
DoubleSetting themeHue
Definition: Theme.hpp:142
QColor thumbSelected
Definition: Theme.hpp:85
QColor resizeHandleBackground
Definition: Theme.hpp:107
QColor unfocused
Definition: Theme.hpp:32
struct chatterino::Theme::@11 window
WINDOW.
QColor accent
Definition: Theme.hpp:36
struct chatterino::Theme::@15 tooltip
TOOLTIP.
QColor dropTargetRect
Definition: Theme.hpp:104
TabColors regular
Definition: Theme.hpp:48
struct chatterino::Theme::@13::@20 textColors
QColor text
Definition: Theme.hpp:41
struct chatterino::Theme::@16::@23 header
void normalizeColor(QColor &color)
Definition: Theme.cpp:290
bool isLightTheme() const
Definition: Theme.cpp:45
QColor background
Definition: Theme.hpp:40
Theme * getTheme()
Definition: Theme.cpp:327
QColor focusedLine
Definition: Theme.hpp:123
QColor system
Definition: Theme.hpp:62
Theme()
Definition: Theme.cpp:60
QColor highlight
Definition: Theme.hpp:87
QColor focusedBackground
Definition: Theme.hpp:113
QBrush unfocused
Definition: Theme.hpp:27
QColor focusedText
Definition: Theme.hpp:115
QColor subscription
Definition: Theme.hpp:88
QColor disabled
Definition: Theme.hpp:72
struct chatterino::Theme::@16 splits
SPLITS.
struct chatterino::Theme::TabColors::@18 backgrounds
Definition: Theme.hpp:22
QColor selection
Definition: Theme.hpp:75
TabColors highlighted
Definition: Theme.hpp:50
QColor dropTargetRectBorder
Definition: Theme.hpp:105
QColor regular
Definition: Theme.hpp:59
TabColors selected
Definition: Theme.hpp:51
QColor alternate
Definition: Theme.hpp:68
QColor border
Definition: Theme.hpp:52
QColor dropPreviewBorder
Definition: Theme.hpp:103
QColor highlightAnimationEnd
Definition: Theme.hpp:78
QColor resizeHandle
Definition: Theme.hpp:106
QString styleSheet
Definition: Theme.hpp:125
Definition: Theme.hpp:15
struct chatterino::Theme::@16::@24 input