[PATCH 4 of 8 DarkThemeSeries 2] blockmatch: use theme-aware colors for diff block indicators

0 views
Skip to first unread message

Peter Demcak

unread,
Mar 6, 2026, 2:42:25 PM (4 days ago) Mar 6
to thg...@googlegroups.com
# HG changeset patch
# User Peter Demcak <majs...@gmail.com>
# Date 1772737195 -3600
# Thu Mar 05 19:59:55 2026 +0100
# Node ID 2371f283a34149ea30f324a955d5ae918435d0ff
# Parent fe7f62674b3ee739f4dd06816712b5cd6ac7a4ac
blockmatch: use theme-aware colors for diff block indicators

Use normalizeColorHsl to ensure diff-block indicators remain visible on dark themes.

diff -r fe7f62674b3e -r 2371f283a341 tortoisehg/hgqt/blockmatcher.py
--- a/tortoisehg/hgqt/blockmatcher.py Thu Mar 05 19:59:33 2026 +0100
+++ b/tortoisehg/hgqt/blockmatcher.py Thu Mar 05 19:59:55 2026 +0100
@@ -38,6 +38,11 @@
)

from . import qtlib
+from .theme import THEME
+
+def normalizeColorHsl(c: QColor, sat=0.35, light=0.4):
+ h, _, _, a = c.getHslF()
+ return QColor.fromHslF(h, sat, light, a)

class BlockList(QWidget):
"""
@@ -58,7 +63,14 @@
self._blocks = set()
self._minimum = 0
self._maximum = 100
- self.blockTypes = {'+': QColor(0xA0, 0xFF, 0xB0, ),#0xa5),
+ if THEME.enabled:
+ self.blockTypes = {'+': normalizeColorHsl(THEME.diff_added_bg),
+ '-': normalizeColorHsl(THEME.diff_added2_bg),
+ 'x': normalizeColorHsl(THEME.diff_added2_bg),
+ 's': normalizeColorHsl(THEME.diff_added_bg),
+ }
+ else:
+ self.blockTypes = {'+': QColor(0xA0, 0xFF, 0xB0, ),#0xa5),
'-': QColor(0xFF, 0xA0, 0xA0, ),#0xa5),
'x': QColor(0xA0, 0xA0, 0xFF, ),#0xa5),
's': QColor(0xFF, 0xA5, 0x00, ),#0xa5),
@@ -180,7 +192,15 @@
self._blocks = set()
self._minimum = {'left': 0, 'right': 0}
self._maximum = {'left': 100, 'right': 100}
- self.blockTypes = {'+': QColor(0xA0, 0xFF, 0xB0, ),#0xa5),
+
+ if THEME.enabled:
+ self.blockTypes = {
+ '+': normalizeColorHsl(THEME.diff_added_bg),
+ '-': normalizeColorHsl(THEME.diff_added2_bg),
+ 'x': normalizeColorHsl(THEME.diff_added2_bg),
+ }
+ else:
+ self.blockTypes = {'+': QColor(0xA0, 0xFF, 0xB0, ),#0xa5),
'-': QColor(0xFF, 0xA0, 0xA0, ),#0xa5),
'x': QColor(0xA0, 0xA0, 0xFF, ),#0xa5),
}

Reply all
Reply to author
Forward
0 new messages