From e9949c0f4a1f2f98e7954f43179d2fa9d7c95dd4 Mon Sep 17 00:00:00 2001 From: ebbit1q Date: Wed, 25 Mar 2026 13:02:40 +0100 Subject: [PATCH] set text color to white on higher opacities --- .../widgets/general/display/banner_widget.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/cockatrice/src/interface/widgets/general/display/banner_widget.cpp b/cockatrice/src/interface/widgets/general/display/banner_widget.cpp index 61ab689da..5de5457ea 100644 --- a/cockatrice/src/interface/widgets/general/display/banner_widget.cpp +++ b/cockatrice/src/interface/widgets/general/display/banner_widget.cpp @@ -7,8 +7,8 @@ #include #include -BannerWidget::BannerWidget(QWidget *parent, const QString &text, Qt::Orientation orientation, int transparency) - : QWidget(parent), gradientOrientation(orientation), transparency(qBound(0, transparency, 100)) +BannerWidget::BannerWidget(QWidget *parent, const QString &text, Qt::Orientation orientation, int transparency_) + : QWidget(parent), gradientOrientation(orientation), transparency(qBound(0, transparency_, 100)) { auto layout = new QHBoxLayout(this); @@ -18,7 +18,12 @@ BannerWidget::BannerWidget(QWidget *parent, const QString &text, Qt::Orientation // Create the banner label and set properties bannerLabel = new QLabel(text, this); bannerLabel->setAlignment(Qt::AlignCenter); - bannerLabel->setStyleSheet("font-size: 24px; font-weight: bold;"); + + QString textColor; + if (transparency > 50) { + textColor = " color: white;"; + } + bannerLabel->setStyleSheet("font-size: 24px; font-weight: bold;" + textColor); layout->addWidget(iconLabel); layout->addWidget(bannerLabel);