mirror-chatterino2/src/BaseTheme.hpp
Leon Richardt 95c909b337
Better Highlights: Fix Wrong Color for Migrated Phrases (#1568)
* Better Highlights: Fix wrong color for migrated phrases

Prior to this commit, no default color was set when an "old" highlight
phrase (one added prior to #1320 / 5957551) was deserialized. This
commit makes highlight phrases uses the default self-highlight color for
these situations. This approach is reasonably sensible since that color
is also similar to the old highlight color.

Fixes #1565.

* Update default self-highlight color

The new default color was suggested in [1] by @RAnders00. Refer to the
link for further information.

[1]: https://github.com/Chatterino/chatterino2/issues/1565#issuecomment-590441625

* Theme: Remove highlight color

As highlight color is independent of the selected theme now, the member
has been removed from the `Theme` singleton. Instead, the fallback theme
color is defined in `HighlightPhrase` now.

Uses of `themes->messages.backgrounds.highlighted` have been replaced
with `HighlightPhrase::FALLBACK_COLOR` accordingly.

* Update src/controllers/highlights/HighlightPhrase.hpp

attempt to just remove constexpr

Co-Authored-By: Ruben Anders <ruben.anders@robotty.de>

* Initialize FALLBACK_COLOR outside header file

* Rename FALLBACK_COLOR to FALLBACK_HIGHLIGHT_COLOR

In preparation for the next commit introducing a new variable.

* Moved subscription highlight color into HighlightPhrase

* Use actual subscription color as a fallback

Co-authored-by: pajlada <rasmus.karlsson@pajlada.com>
Co-authored-by: Ruben Anders <ruben.anders@robotty.de>
2020-03-22 13:14:07 +01:00

116 lines
2.3 KiB
C++

#ifndef AB_THEME_H
#define AB_THEME_H
#include <QBrush>
#include <QColor>
#include <common/ChatterinoSetting.hpp>
#ifdef AB_CUSTOM_THEME
# define AB_THEME_CLASS BaseTheme
#else
# define AB_THEME_CLASS Theme
#endif
namespace chatterino {
class Theme;
class AB_THEME_CLASS
{
public:
bool isLightTheme() const;
struct TabColors {
QColor text;
struct {
QBrush regular;
QBrush hover;
QBrush unfocused;
} backgrounds;
struct {
QColor regular;
QColor hover;
QColor unfocused;
} line;
};
/// WINDOW
struct {
QColor background;
QColor text;
QColor borderUnfocused;
QColor borderFocused;
} window;
/// TABS
struct {
TabColors regular;
TabColors newMessage;
TabColors highlighted;
TabColors selected;
QColor border;
QColor bottomLine;
} tabs;
/// MESSAGES
struct {
struct {
QColor regular;
QColor caret;
QColor link;
QColor system;
} textColors;
struct {
QColor regular;
QColor alternate;
// QColor whisper;
} backgrounds;
QColor disabled;
// QColor seperator;
// QColor seperatorInner;
QColor selection;
} messages;
/// SCROLLBAR
struct {
QColor background;
QColor thumb;
QColor thumbSelected;
struct {
QColor highlight;
QColor subscription;
} highlights;
} scrollbars;
/// TOOLTIP
struct {
QColor text;
QColor background;
} tooltip;
void update();
virtual void actuallyUpdate(double hue, double multiplier);
QColor blendColors(const QColor &color1, const QColor &color2, qreal ratio);
pajlada::Signals::NoArgSignal updated;
QStringSetting themeName{"/appearance/theme/name", "Dark"};
DoubleSetting themeHue{"/appearance/theme/hue", 0.0};
private:
bool isLight_ = false;
};
// Implemented in parent project if AB_CUSTOM_THEME is set.
// Otherwise implemented in BaseThemecpp
Theme *getTheme();
} // namespace chatterino
#ifdef CHATTERINO
# include "singletons/Theme.hpp"
#endif
#endif