Truly independent web browser
UI/Qt: Use red hover colors for rounded close buttons
Timothy Flynn8c221dfeb35e
diff --git a/UI/Qt/ChromeStyle.cpp b/UI/Qt/ChromeStyle.cppindex 4340229c674..14c00e892ad 100644--- a/UI/Qt/ChromeStyle.cpp+++ b/UI/Qt/ChromeStyle.cpp@@ -199,12 +199,12 @@ QFont chrome_title_font(QFont font)return font;}-static QColor chrome_destructive_hover()+QColor chrome_destructive_hover(){return QColor(196, 43, 28);}-static QColor chrome_destructive_text()+QColor chrome_destructive_text(){return QColor(255, 255, 255);}diff --git a/UI/Qt/ChromeStyle.h b/UI/Qt/ChromeStyle.hindex b6a89496d2a..b30f7ab71c7 100644--- a/UI/Qt/ChromeStyle.h+++ b/UI/Qt/ChromeStyle.h@@ -27,12 +27,14 @@ constexpr inline int LOCATION_EDIT_CORNER_RADIUS = 7;constexpr inline int LOADING_RING_PERIOD_MS = 900;// Before the site responds, the ring turns more slowly, at half opacity.constexpr inline int LOADING_RING_WAITING_PERIOD_MS = 1600;+enum class LoadingRingSize : u8 {// 20 px, reaching 2 px past a tab's favicon slot.Favicon,// 23 px, filling a toolbar button.ToolbarButton,};+enum class LoadingPhase : u8 {WaitingForResponse,Receiving,@@ -46,9 +48,13 @@ constexpr qreal drop_shadow_blur_radius(qreal css_blur_radius){return css_blur_radius * 2.5;}+QColor mix(QColor const& from, QColor const& to, double amount);QColor chrome_text(QPalette const&);QColor chrome_button_text(QPalette const&);+QColor chrome_destructive_hover();+QColor chrome_destructive_text();+enum class WindowActivity : u8 {Active,Inactive,diff --git a/UI/Qt/WindowControlButton.cpp b/UI/Qt/WindowControlButton.cppindex a414616a10c..b0f3064f602 100644--- a/UI/Qt/WindowControlButton.cpp+++ b/UI/Qt/WindowControlButton.cpp@@ -91,11 +91,14 @@ void WindowControlButton::paintEvent(QPaintEvent* event)painter.setRenderHint(QPainter::Antialiasing, true);QRectF circle { static_cast<qreal>(width() - ROUND_BUTTON_SIZE), (height() - ROUND_BUTTON_SIZE) / 2.0, ROUND_BUTTON_SIZE, ROUND_BUTTON_SIZE };auto const& chrome = Theme::chrome(*this);+ auto is_hovered = isDown() || underMouse();+ auto is_close_hovered = m_type == ControlButton::Close && is_hovered;painter.setPen(Qt::NoPen);painter.setBrush(chrome.field);painter.drawEllipse(circle);- if (isDown() || underMouse()) {- painter.setBrush(isDown() ? Theme::panel().pressed : chrome.hover);+ if (is_hovered) {+ painter.setBrush(is_close_hovered ? ChromeStyle::chrome_destructive_hover() : isDown() ? Theme::panel().pressed+ : chrome.hover);painter.drawEllipse(circle);}@@ -116,8 +119,11 @@ void WindowControlButton::paintEvent(QPaintEvent* event)break;}auto inactive = ChromeStyle::window_activity(*this) == ChromeStyle::WindowActivity::Inactive;+ auto glyph_color = inactive ? chrome.muted : chrome.icon;+ if (is_close_hovered)+ glyph_color = ChromeStyle::chrome_destructive_text();painter.translate(circle.center() - QPointF(ROUND_BUTTON_GLYPH_SIZE / 2, ROUND_BUTTON_GLYPH_SIZE / 2));- painter.setPen(QPen(inactive ? chrome.muted : chrome.icon, ROUND_BUTTON_GLYPH_STROKE_WIDTH, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));+ painter.setPen(QPen(glyph_color, ROUND_BUTTON_GLYPH_STROKE_WIDTH, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));painter.setBrush(Qt::NoBrush);painter.drawPath(glyph);}