2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 06:26:18 +00:00

Ensure contrast in colorized themes.

This commit is contained in:
John Preston
2019-08-27 16:59:15 +03:00
parent 763bdf8798
commit 117d6192fa
13 changed files with 238 additions and 183 deletions

View File

@@ -18,8 +18,6 @@ namespace Theme {
constexpr auto kThemeSchemeSizeLimit = 1024 * 1024;
struct Colorizer;
struct Cached {
QByteArray colors;
QByteArray background;
@@ -53,26 +51,21 @@ struct Preview {
bool Apply(const QString &filepath);
bool Apply(std::unique_ptr<Preview> preview);
void ApplyDefaultWithPath(
const QString &themePath,
const Colorizer *colorizer = nullptr);
void ApplyDefaultWithPath(const QString &themePath);
bool ApplyEditedPalette(const QString &path, const QByteArray &content);
void KeepApplied();
QString NightThemePath();
[[nodiscard]] bool IsNightMode();
void SetNightModeValue(bool nightMode);
void ToggleNightMode();
void ToggleNightMode(
const QString &themePath,
const Colorizer *colorizer = nullptr);
void ToggleNightMode(const QString &themePath);
[[nodiscard]] bool IsNonDefaultBackground();
void Revert();
bool LoadFromFile(
const QString &file,
Instance *out,
QByteArray *outContent,
const Colorizer *colorizer = nullptr);
QByteArray *outContent);
bool IsPaletteTestingPath(const QString &path);
QColor CountAverageColor(const QImage &image);
QColor AdjustedColor(QColor original, QColor background);
@@ -162,9 +155,7 @@ private:
void setNightModeValue(bool nightMode);
[[nodiscard]] bool nightMode() const;
void toggleNightMode(
std::optional<QString> themePath,
const Colorizer *colorizer);
void toggleNightMode(std::optional<QString> themePath);
void keepApplied(const QString &path, bool write);
[[nodiscard]] bool isNonDefaultThemeOrBackground();
[[nodiscard]] bool isNonDefaultBackground();
@@ -174,9 +165,7 @@ private:
friend bool IsNightMode();
friend void SetNightModeValue(bool nightMode);
friend void ToggleNightMode();
friend void ToggleNightMode(
const QString &themePath,
const Colorizer *colorizer);
friend void ToggleNightMode(const QString &themePath);
friend void KeepApplied();
friend bool IsNonDefaultBackground();