From 876c47c436edd2a28f661560e05394ee3702fe49 Mon Sep 17 00:00:00 2001 From: John Preston Date: Sun, 30 Jun 2024 20:10:50 +0400 Subject: [PATCH] Add 'section_separator_color' to webview palette. --- .../window/themes/window_theme.cpp | 21 ++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/Telegram/SourceFiles/window/themes/window_theme.cpp b/Telegram/SourceFiles/window/themes/window_theme.cpp index 450cfe541..88bbe9cf2 100644 --- a/Telegram/SourceFiles/window/themes/window_theme.cpp +++ b/Telegram/SourceFiles/window/themes/window_theme.cpp @@ -1505,18 +1505,33 @@ bool ReadPaletteValues(const QByteArray &content, Fnc.getRgb(&r, &g, &b); + color.getRgb(&r, &g, &b); const auto hex = [](int component) { const auto digit = [](int c) { return QChar((c < 10) ? ('0' + c) : ('a' + c - 10)); }; return QString() + digit(component / 16) + digit(component % 16); }; - object.insert(name, '#' + hex(r) + hex(g) + hex(b)); + return '#' + hex(r) + hex(g) + hex(b); + }; + for (const auto &[name, color] : colors) { + object.insert(name, wrap(color->c)); + } + { + const auto bg = st::windowBg->c; + const auto shadow = st::shadowFg->c; + const auto shadowAlpha = shadow.alphaF(); + const auto mix = [&](int a, int b) { + return anim::interpolate(a, b, shadowAlpha); + }; + object.insert("section_separator_color", wrap(QColor( + mix(bg.red(), shadow.red()), + mix(bg.green(), shadow.green()), + mix(bg.blue(), shadow.blue())))); } return { .opaqueBg = st::windowBg->c,