diff --git a/Telegram/SourceFiles/chat_helpers/message_field.cpp b/Telegram/SourceFiles/chat_helpers/message_field.cpp index 85c8f9dda3..931c342213 100644 --- a/Telegram/SourceFiles/chat_helpers/message_field.cpp +++ b/Telegram/SourceFiles/chat_helpers/message_field.cpp @@ -441,7 +441,9 @@ bool HasSendText(not_null field) { return false; } -void InitMessageFieldFade(not_null field) { +void InitMessageFieldFade( + not_null field, + const style::color &bg) { class Fade final : public Ui::RpWidget { public: using Ui::RpWidget::RpWidget; @@ -467,7 +469,7 @@ void InitMessageFieldFade(not_null field) { const auto topFade = Ui::CreateChild(field.get()); const auto bottomFade = Ui::CreateChild(field.get()); - const auto generateFade = [=] { + const auto generateFade = [=, bg = bg->c] { const auto size = QSize(1, st::historyComposeFieldFadeHeight); auto fade = QPixmap(size * style::DevicePixelRatio()); fade.setDevicePixelRatio(style::DevicePixelRatio()); @@ -476,10 +478,7 @@ void InitMessageFieldFade(not_null field) { auto p = QPainter(&fade); auto gradient = QLinearGradient(0, 1, 0, size.height()); - gradient.setStops({ - { 0., st::historyComposeField.textBg->c }, - { .9, Qt::transparent }, - }); + gradient.setStops({ { 0., bg }, { .9, Qt::transparent } }); p.setPen(Qt::NoPen); p.setBrush(gradient); p.drawRect(Rect(size)); diff --git a/Telegram/SourceFiles/chat_helpers/message_field.h b/Telegram/SourceFiles/chat_helpers/message_field.h index 18ad42c094..a8f248e82f 100644 --- a/Telegram/SourceFiles/chat_helpers/message_field.h +++ b/Telegram/SourceFiles/chat_helpers/message_field.h @@ -79,7 +79,9 @@ void InitSpellchecker( bool HasSendText(not_null field); -void InitMessageFieldFade(not_null field); +void InitMessageFieldFade( + not_null field, + const style::color &bg); struct InlineBotQuery { QString query; diff --git a/Telegram/SourceFiles/history/history_widget.cpp b/Telegram/SourceFiles/history/history_widget.cpp index ba20e32ca6..85c44941fb 100644 --- a/Telegram/SourceFiles/history/history_widget.cpp +++ b/Telegram/SourceFiles/history/history_widget.cpp @@ -401,7 +401,7 @@ HistoryWidget::HistoryWidget( showPremiumToast(document); return false; }); - InitMessageFieldFade(_field); + InitMessageFieldFade(_field, st::historyComposeField.textBg); _keyboard->sendCommandRequests( ) | rpl::start_with_next([=](Bot::SendCommandRequest r) { diff --git a/Telegram/SourceFiles/history/view/controls/history_view_compose_controls.cpp b/Telegram/SourceFiles/history/view/controls/history_view_compose_controls.cpp index c7340489b1..c6260f184b 100644 --- a/Telegram/SourceFiles/history/view/controls/history_view_compose_controls.cpp +++ b/Telegram/SourceFiles/history/view/controls/history_view_compose_controls.cpp @@ -1583,7 +1583,7 @@ void ComposeControls::initField() { } return false; }); - InitMessageFieldFade(_field); + InitMessageFieldFade(_field, _st.field.textBg); _field->setEditLinkCallback( DefaultEditLinkCallback(_show, _field, &_st.boxField)); initAutocomplete();