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>
|
2018-01-16 00:26:04 +01:00
|
|
|
#include "util/serialize-custom.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
|
|
|
|
{
|
2018-01-15 01:35:35 +01:00
|
|
|
return this->isLight;
|
2017-06-26 16:41:20 +02:00
|
|
|
}
|
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;
|
|
|
|
};
|
|
|
|
|
2018-01-02 02:21:38 +01:00
|
|
|
struct {
|
2018-01-02 02:15:11 +01:00
|
|
|
TabColors regular;
|
|
|
|
TabColors selected;
|
|
|
|
TabColors highlighted;
|
|
|
|
TabColors newMessage;
|
2018-03-30 16:25:49 +02:00
|
|
|
QColor border;
|
2018-01-02 02:15:11 +01:00
|
|
|
} tabs;
|
|
|
|
|
2018-01-02 02:21:38 +01:00
|
|
|
struct {
|
2018-01-02 02:15:11 +01:00
|
|
|
QColor messageSeperator;
|
|
|
|
QColor background;
|
|
|
|
QColor border;
|
|
|
|
QColor borderFocused;
|
|
|
|
QColor dropPreview;
|
|
|
|
|
2018-01-02 02:21:38 +01:00
|
|
|
struct {
|
2018-01-02 02:15:11 +01:00
|
|
|
QColor border;
|
|
|
|
QColor background;
|
|
|
|
QColor text;
|
|
|
|
// int margin;
|
|
|
|
} header;
|
|
|
|
|
2018-01-02 02:21:38 +01:00
|
|
|
struct {
|
2018-01-02 02:15:11 +01:00
|
|
|
QColor border;
|
|
|
|
QColor background;
|
|
|
|
QColor selection;
|
|
|
|
QColor text;
|
|
|
|
QString styleSheet;
|
|
|
|
// int margin;
|
|
|
|
} input;
|
|
|
|
} splits;
|
|
|
|
|
2018-01-02 02:21:38 +01:00
|
|
|
struct {
|
|
|
|
struct {
|
2018-01-02 02:15:11 +01:00
|
|
|
QColor regular;
|
|
|
|
QColor caret;
|
|
|
|
QColor link;
|
|
|
|
QColor system;
|
|
|
|
} textColors;
|
|
|
|
|
2018-01-02 02:21:38 +01:00
|
|
|
struct {
|
2018-01-02 02:15:11 +01:00
|
|
|
QColor regular;
|
|
|
|
QColor highlighted;
|
|
|
|
// QColor resub;
|
|
|
|
// QColor whisper;
|
|
|
|
} backgrounds;
|
|
|
|
|
|
|
|
QColor disabled;
|
|
|
|
// QColor seperator;
|
|
|
|
// QColor seperatorInner;
|
|
|
|
QColor selection;
|
|
|
|
} messages;
|
|
|
|
|
2018-01-02 02:21:38 +01:00
|
|
|
struct {
|
2018-01-02 02:15:11 +01:00
|
|
|
QColor background;
|
|
|
|
QColor thumb;
|
|
|
|
QColor thumbSelected;
|
|
|
|
// const int highlightsCount = 3;
|
|
|
|
// QColor highlights[3];
|
|
|
|
} scrollbars;
|
|
|
|
|
2018-01-02 02:21:38 +01:00
|
|
|
struct {
|
2018-01-02 02:15:11 +01:00
|
|
|
QColor text;
|
|
|
|
QColor background;
|
|
|
|
} tooltip;
|
2017-01-03 21:19:33 +01:00
|
|
|
|
2018-01-15 01:35:35 +01:00
|
|
|
QColor windowBg;
|
|
|
|
QColor windowText;
|
|
|
|
|
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
|
|
|
|
2018-01-12 23:09:05 +01:00
|
|
|
pajlada::Settings::Setting<QString> themeName;
|
2017-07-02 12:36:50 +02:00
|
|
|
pajlada::Settings::Setting<double> themeHue;
|
|
|
|
|
2018-01-12 23:09:05 +01:00
|
|
|
private:
|
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
|
|
|
|
2018-01-15 01:35:35 +01:00
|
|
|
bool isLight = false;
|
2017-12-31 00:50:07 +01:00
|
|
|
|
|
|
|
pajlada::Signals::NoArgSignal repaintVisibleChatWidgets;
|
|
|
|
|
|
|
|
friend class WindowManager;
|
2016-12-30 19:16:48 +01:00
|
|
|
};
|
|
|
|
|
2018-01-12 23:09:05 +01:00
|
|
|
} // namespace singletons
|
2017-06-07 10:09:24 +02:00
|
|
|
} // namespace chatterino
|