From bc3d7574bc5b926bab61d337787d85f5d7e05f4a Mon Sep 17 00:00:00 2001 From: shocoman Date: Fri, 8 Sep 2023 00:03:33 +0700 Subject: [PATCH] Dark theme: fix several visibility issues --- bin/themes/Dark/style.css | 41 ++++++++++++++++++++-------- bin/themes/Dark/style.ini | 2 +- src/gui/Src/Gui/DisassemblyPopup.cpp | 8 ++++++ 3 files changed, 39 insertions(+), 12 deletions(-) diff --git a/bin/themes/Dark/style.css b/bin/themes/Dark/style.css index 2b500bba..65f60d66 100644 --- a/bin/themes/Dark/style.css +++ b/bin/themes/Dark/style.css @@ -196,9 +196,9 @@ QMenuBar::item:disabled:selected { } QMenu { - border: 1px solid #212121; + border: 1px solid #808080; color: #e0e0e0; - margin: 2px; + padding: 2px; } QMenu::icon { @@ -281,7 +281,7 @@ QMenu::right-arrow { } QWidget:disabled { - color: #454545; + color: #646464; background-color: #212121; } @@ -313,6 +313,11 @@ QLineEdit { color: #e0e0e0; } +/* e.g. "System breakpoint scripts" dialog */ +QLineEdit:disabled { + background-color: #282828; +} + QAbstractItemView QLineEdit { padding: 0; } @@ -501,7 +506,7 @@ QMainWindow::separator:hover { QMenu::separator { height: 1px; - background-color: #2a2b2f; + background-color: #808080; color: white; padding-left: 4px; margin-left: 10px; @@ -550,7 +555,7 @@ QPushButton { color: #e0e0e0; background-color: #212121; border-width: 1px; - border-color: #2a2b2f; + border-color: #808080; border-style: solid; padding: 5px; border-radius: 2px; @@ -567,7 +572,7 @@ QPushButton:disabled { padding-left: 10px; padding-right: 10px; border-radius: 2px; - color: #454545; + color: #646464; } QPushButton:focus { @@ -581,11 +586,11 @@ QPushButton:pressed { padding-bottom: -17px; } -QComboBox { +QComboBox, QFontComboBox { selection-background-color: #89a2f6; selection-color: #000000; border-style: solid; - border: 1px solid #212121; + border: 1px solid #424242; border-radius: 2px; padding: 5px; min-width: 75px; @@ -596,15 +601,19 @@ QPushButton:checked { border-color: #2a2b2f; } +QPushButton:hover { + border: 1px solid #e0e0e0; + color: #e0e0e0; +} + QComboBox:hover, -QPushButton:hover, QAbstractSpinBox:hover, QLineEdit:hover, QTextEdit:hover, QPlainTextEdit:hover, QAbstractView:hover, QTreeView:hover { - border: 1px solid #414141; + border: 1px solid #646464; color: #e0e0e0; } @@ -619,6 +628,7 @@ QComboBox QAbstractItemView { border-radius: 2px; border: 1px solid #212121; selection-background-color: #414141; + selection-color: #ffffff; /* e.g. calling convention ComboBox */ } QComboBox::drop-down { @@ -1096,4 +1106,13 @@ QTabWidget::pane { QTabBar::tear { width: 0px; border: none; -} \ No newline at end of file +} + +/* e.g. "Exception filters" list, "Patch file" modules list, "Set page memory rights" table, "Select font" list, etc */ +QTableView, QListView { + selection-color: #c8c8c8; +} + +DisassemblyPopup { + border: 1px solid #c0c0c0; +} diff --git a/bin/themes/Dark/style.ini b/bin/themes/Dark/style.ini index c6498339..bd0113e6 100644 --- a/bin/themes/Dark/style.ini +++ b/bin/themes/Dark/style.ini @@ -51,7 +51,7 @@ DisassemblyCommentColor=#E0E0E0 DisassemblyConditionalJumpLineFalseColor=#808080 DisassemblyConditionalJumpLineTrueColor=#AA0000 DisassemblyFunctionColor=#F88478 -DisassemblyHardwareBreakpointBackgroundColor=#XXXXXX +DisassemblyHardwareBreakpointBackgroundColor=#000000 DisassemblyHardwareBreakpointColor=#E6E976 DisassemblyLabelBackgroundColor=#XXXXXX DisassemblyLabelColor=#B794F6 diff --git a/src/gui/Src/Gui/DisassemblyPopup.cpp b/src/gui/Src/Gui/DisassemblyPopup.cpp index 736f0dc6..b6dbc779 100644 --- a/src/gui/Src/Gui/DisassemblyPopup.cpp +++ b/src/gui/Src/Gui/DisassemblyPopup.cpp @@ -4,6 +4,7 @@ #include "StringUtil.h" #include "MiscUtil.h" #include +#include DisassemblyPopup::DisassemblyPopup(QWidget* parent) : QFrame(parent, Qt::Tool | Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint | Qt::WindowDoesNotAcceptFocus), @@ -84,6 +85,13 @@ void DisassemblyPopup::paintEvent(QPaintEvent* event) RichTextPainter::paintRichText(&p, 3, y, mWidth - 3, charHeight, 0, instruction.first, mFontMetrics); y += charHeight; } + + // The code above will destroy the stylesheet adjustments, making it impossible to change the border color. + // To remedy this, we redraw a thin 'stylizable' frame here + QStyleOptionFrame opt; + initStyleOption(&opt); + style()->drawPrimitive(QStyle::PE_Frame, &opt, &p, this); + QFrame::paintEvent(event); }