2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-30 22:25:12 +00:00

Initial chat theme changing.

This commit is contained in:
John Preston
2021-09-24 19:10:25 +04:00
parent 80028e41f3
commit ab0d2bf9c6
20 changed files with 773 additions and 120 deletions

View File

@@ -46,6 +46,7 @@ namespace {
constexpr auto kThemeFileSizeLimit = 5 * 1024 * 1024;
constexpr auto kBackgroundSizeLimit = 25 * 1024 * 1024;
constexpr auto kNightThemeFile = ":/gui/night.tdesktop-theme"_cs;
constexpr auto kDarkValueThreshold = 0.5;
struct Applying {
Saved data;
@@ -1450,6 +1451,16 @@ bool LoadFromContent(
out);
}
rpl::producer<bool> IsThemeDarkValue() {
return rpl::single(
rpl::empty_value()
) | rpl::then(
style::PaletteChanged()
) | rpl::map([] {
return (st::dialogsBg->c.valueF() < kDarkValueThreshold);
});
}
QString EditingPalettePath() {
return cWorkingDir() + "tdata/editing-theme.tdesktop-palette";
}