summaryrefslogtreecommitdiff
path: root/Source/Core/DolphinQt2/Debugger/CodeViewWidget.cpp
diff options
context:
space:
mode:
authorJack Andersen <jackoalan@gmail.com>2018-05-15 14:24:29 -1000
committerJack Andersen <jackoalan@gmail.com>2018-05-15 18:59:40 -1000
commitd14f6e9ee6d144e14e94583f8043c705839e8883 (patch)
treed71b71bcdbc32c155b23aa3ce7a958601a0478fd /Source/Core/DolphinQt2/Debugger/CodeViewWidget.cpp
parent51ce30e09d662c11a5fcc4f534f0ff5c6b62b7a8 (diff)
Qt/CodeViewWidget: Dynamic background dimming for dark themes
Diffstat (limited to 'Source/Core/DolphinQt2/Debugger/CodeViewWidget.cpp')
-rw-r--r--Source/Core/DolphinQt2/Debugger/CodeViewWidget.cpp15
1 files changed, 8 insertions, 7 deletions
diff --git a/Source/Core/DolphinQt2/Debugger/CodeViewWidget.cpp b/Source/Core/DolphinQt2/Debugger/CodeViewWidget.cpp
index 7ecffdd9d7..f3dfad215a 100644
--- a/Source/Core/DolphinQt2/Debugger/CodeViewWidget.cpp
+++ b/Source/Core/DolphinQt2/Debugger/CodeViewWidget.cpp
@@ -100,6 +100,8 @@ void CodeViewWidget::Update()
if (Core::GetState() != Core::State::Paused && PowerPC::debug_interface.IsBreakpoint(pc))
Core::SetState(Core::State::Paused);
+ const bool dark_theme = qApp->palette().color(QPalette::Base).valueF() < 0.5;
+
for (int i = 0; i < rowCount(); i++)
{
u32 addr = m_address - ((rowCount() / 2) * 4) + i * 4;
@@ -123,15 +125,14 @@ void CodeViewWidget::Update()
item->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable);
item->setData(Qt::UserRole, addr);
- if (color != 0xFFFFFF)
+ if (addr == pc && item != bp_item)
{
- item->setForeground(Qt::black);
- item->setBackground(QColor(color));
+ item->setBackground(QColor(Qt::green));
+ item->setForeground(QColor(Qt::black));
}
- if (addr == pc && item != bp_item)
+ else if (color != 0xFFFFFF)
{
- item->setBackground(Qt::green);
- item->setForeground(Qt::black);
+ item->setBackground(dark_theme ? QColor(color).darker(240) : QColor(color));
}
}
@@ -151,7 +152,7 @@ void CodeViewWidget::Update()
}
if (ins == "blr")
- ins_item->setForeground(Qt::darkGreen);
+ ins_item->setForeground(dark_theme ? QColor(0xa0FFa0) : Qt::darkGreen);
if (PowerPC::debug_interface.IsBreakpoint(addr))
{