2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-09-02 15:45:12 +00:00

Support colorizing of the default palette.

This commit is contained in:
John Preston
2021-09-02 20:48:12 +03:00
parent 2554aaf3c0
commit 444f21fd7e
4 changed files with 33 additions and 15 deletions

View File

@@ -81,26 +81,30 @@ constexpr auto kMaxChatEntryHistorySize = 50;
std::optional<QColor> accent) {
return [=](style::palette &palette) {
using namespace Theme;
palette.finalize();
if (dark) {
const auto &embedded = EmbeddedThemes();
const auto i = ranges::find(
embedded,
EmbeddedType::Night,
&EmbeddedScheme::type);
Assert(i != end(embedded));
const auto &embedded = EmbeddedThemes();
const auto i = ranges::find(
embedded,
dark ? EmbeddedType::Night : EmbeddedType::Default,
&EmbeddedScheme::type);
Assert(i != end(embedded));
const auto colorizer = accent
? ColorizerFrom(*i, *accent)
: style::colorizer();
if (dark) {
auto instance = Instance();
const auto loaded = LoadFromFile(
i->path,
&instance,
nullptr,
nullptr,
accent ? ColorizerFrom(*i, *accent) : style::colorizer());
colorizer);
Assert(loaded);
palette.finalize();
palette = instance.palette;
} else {
// #TODO themes apply accent color to classic theme
palette.finalize(colorizer);
}
};
}