2017-06-07 10:09:24 +02:00
|
|
|
#pragma once
|
2016-12-30 19:16:48 +01:00
|
|
|
|
2017-01-01 02:30:42 +01:00
|
|
|
#include <QBrush>
|
2017-01-11 18:52:09 +01:00
|
|
|
#include <QColor>
|
2017-02-02 01:23:26 +01:00
|
|
|
#include <boost/signals2.hpp>
|
2017-07-02 12:36:50 +02:00
|
|
|
#include <pajlada/settings/setting.hpp>
|
2016-12-30 19:16:48 +01:00
|
|
|
|
2017-04-14 17:52:22 +02:00
|
|
|
namespace chatterino {
|
2017-12-31 22:58:35 +01:00
|
|
|
namespace singletons {
|
2017-01-18 21:30:23 +01:00
|
|
|
|
2017-06-13 21:13:58 +02:00
|
|
|
class WindowManager;
|
|
|
|
|
2017-12-31 00:50:07 +01:00
|
|
|
class ThemeManager
|
2016-12-30 19:16:48 +01:00
|
|
|
{
|
2017-12-31 00:50:07 +01:00
|
|
|
ThemeManager();
|
|
|
|
|
2016-12-30 20:41:24 +01:00
|
|
|
public:
|
2017-12-31 00:50:07 +01:00
|
|
|
static ThemeManager &getInstance();
|
2017-06-26 16:41:20 +02:00
|
|
|
|
|
|
|
inline bool isLightTheme() const
|
|
|
|
{
|
|
|
|
return this->lightTheme;
|
|
|
|
}
|
2016-12-30 20:41:24 +01:00
|
|
|
|
2018-01-02 02:15:11 +01:00
|
|
|
struct TabColors {
|
|
|
|
QColor text;
|
|
|
|
struct Backgrounds {
|
|
|
|
QBrush regular;
|
|
|
|
QBrush hover;
|
|
|
|
QBrush unfocused;
|
|
|
|
} backgrounds;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct Tabs {
|
|
|
|
TabColors regular;
|
|
|
|
TabColors selected;
|
|
|
|
TabColors highlighted;
|
|
|
|
TabColors newMessage;
|
|
|
|
} tabs;
|
|
|
|
|
|
|
|
struct Splits {
|
|
|
|
QColor messageSeperator;
|
|
|
|
QColor background;
|
|
|
|
QColor border;
|
|
|
|
QColor borderFocused;
|
|
|
|
QColor dropPreview;
|
|
|
|
|
|
|
|
struct Header {
|
|
|
|
QColor border;
|
|
|
|
QColor background;
|
|
|
|
QColor text;
|
|
|
|
// int margin;
|
|
|
|
} header;
|
|
|
|
|
|
|
|
struct Input {
|
|
|
|
QColor border;
|
|
|
|
QColor background;
|
|
|
|
QColor selection;
|
|
|
|
QColor text;
|
|
|
|
QString styleSheet;
|
|
|
|
// int margin;
|
|
|
|
} input;
|
|
|
|
} splits;
|
|
|
|
|
|
|
|
struct Messages {
|
|
|
|
struct TextColors {
|
|
|
|
QColor regular;
|
|
|
|
QColor caret;
|
|
|
|
QColor link;
|
|
|
|
QColor system;
|
|
|
|
} textColors;
|
|
|
|
|
|
|
|
struct Backgrounds {
|
|
|
|
QColor regular;
|
|
|
|
QColor highlighted;
|
|
|
|
// QColor resub;
|
|
|
|
// QColor whisper;
|
|
|
|
} backgrounds;
|
|
|
|
|
|
|
|
QColor disabled;
|
|
|
|
// QColor seperator;
|
|
|
|
// QColor seperatorInner;
|
|
|
|
QColor selection;
|
|
|
|
} messages;
|
|
|
|
|
|
|
|
struct Scrollbars {
|
|
|
|
QColor background;
|
|
|
|
QColor thumb;
|
|
|
|
QColor thumbSelected;
|
|
|
|
// const int highlightsCount = 3;
|
|
|
|
// QColor highlights[3];
|
|
|
|
} scrollbars;
|
|
|
|
|
|
|
|
struct Tooltip {
|
|
|
|
QColor text;
|
|
|
|
QColor background;
|
|
|
|
} tooltip;
|
2017-01-03 21:19:33 +01:00
|
|
|
|
2017-01-18 01:04:54 +01:00
|
|
|
void normalizeColor(QColor &color);
|
|
|
|
|
2017-02-02 01:23:26 +01:00
|
|
|
void update();
|
|
|
|
|
|
|
|
boost::signals2::signal<void()> updated;
|
2016-12-30 19:20:04 +01:00
|
|
|
|
|
|
|
private:
|
2017-07-02 12:36:50 +02:00
|
|
|
pajlada::Settings::Setting<std::string> themeName;
|
|
|
|
pajlada::Settings::Setting<double> themeHue;
|
|
|
|
|
2017-12-31 00:50:07 +01:00
|
|
|
void actuallyUpdate(double hue, double multiplier);
|
2017-09-12 19:06:16 +02:00
|
|
|
QColor blendColors(const QColor &color1, const QColor &color2, qreal ratio);
|
2017-01-18 01:04:54 +01:00
|
|
|
|
2017-06-26 16:41:20 +02:00
|
|
|
double middleLookupTable[360] = {};
|
|
|
|
double minLookupTable[360] = {};
|
2017-02-02 01:23:26 +01:00
|
|
|
|
2017-06-26 16:41:20 +02:00
|
|
|
void fillLookupTableValues(double (&array)[360], double from, double to, double fromValue,
|
|
|
|
double toValue);
|
2017-01-18 01:04:54 +01:00
|
|
|
|
2017-07-02 12:36:50 +02:00
|
|
|
bool lightTheme = false;
|
2017-12-31 00:50:07 +01:00
|
|
|
|
|
|
|
pajlada::Signals::NoArgSignal repaintVisibleChatWidgets;
|
|
|
|
|
|
|
|
friend class WindowManager;
|
2016-12-30 19:16:48 +01:00
|
|
|
};
|
|
|
|
|
2017-06-07 10:09:24 +02:00
|
|
|
} // namespace chatterino
|
2017-12-31 22:58:35 +01:00
|
|
|
}
|