[PATCH 5 of 8 DarkThemeSeries 1] messageentry: apply dark theme styling to commit message editor

0 views
Skip to first unread message

Peter Demcak

unread,
Mar 7, 2026, 1:27:56 PM (3 days ago) Mar 7
to thg...@googlegroups.com
# HG changeset patch
# User Peter Demcak <majs...@gmail.com>
# Date 1772736996 -3600
# Thu Mar 05 19:56:36 2026 +0100
# Node ID 10a94641ed6c10d352cee52f7a02b0f40d35ba23
# Parent 2b63ea12ba5dde4f32a77a3a8ac9e63ceabc31d2
messageentry: apply dark theme styling to commit message editor

Add theme-aware colors for the MessageEntry Scintilla widget including
background/foreground, selection, caret and brace matching.

diff -r 2b63ea12ba5d -r 10a94641ed6c tortoisehg/hgqt/messageentry.py
--- a/tortoisehg/hgqt/messageentry.py Thu Mar 05 19:56:11 2026 +0100
+++ b/tortoisehg/hgqt/messageentry.py Thu Mar 05 19:56:36 2026 +0100
@@ -36,6 +36,7 @@
qscilib,
qtlib,
)
+from .theme import THEME

class MessageEntry(qscilib.Scintilla):

@@ -68,6 +69,39 @@

self._re_boundary = re.compile(r'[0-9i#]+\.|\(?[0-9i#]+\)|\(@\)')

+ if THEME.enabled:
+
+ # Base editor colors
+ self.setPaper(THEME.background)
+ self.setColor(THEME.text)
+
+ # Force STYLE_DEFAULT
+ self.SendScintilla(QsciScintilla.SCI_STYLESETBACK, QsciScintilla.STYLE_DEFAULT, THEME.background)
+ self.SendScintilla(QsciScintilla.SCI_STYLESETFORE, QsciScintilla.STYLE_DEFAULT, THEME.text)
+ self.SendScintilla(QsciScintilla.SCI_STYLECLEARALL)
+
+ # Braces
+ self.setBraceMatching(QsciScintilla.BraceMatch.SloppyBraceMatch)
+
+ # Bad brace
+ self.SendScintilla(QsciScintilla.SCI_STYLESETBACK, QsciScintilla.STYLE_BRACEBAD, THEME.brace_bad_bg)
+ self.SendScintilla(QsciScintilla.SCI_STYLESETFORE, QsciScintilla.STYLE_BRACEBAD, THEME.brace_bad_fg)
+
+ # Matched braces
+ self.SendScintilla(QsciScintilla.SCI_STYLESETBACK, QsciScintilla.STYLE_BRACELIGHT, THEME.brace_match_bg)
+ self.SendScintilla(QsciScintilla.SCI_STYLESETFORE, QsciScintilla.STYLE_BRACELIGHT, THEME.brace_match_fg)
+
+ # Selection
+ self.setSelectionBackgroundColor(THEME.selection_background)
+ self.setSelectionForegroundColor(THEME.selection_text)
+
+ # Cursor
+ self.setCaretForegroundColor(THEME.control_text)
+
+ # Caret
+ self.setCaretForegroundColor(THEME.control_text)
+ self.setCaretLineBackgroundColor(THEME.backgroundLighter)
+
def setText(self, text):
result = super().setText(text)
self.setDefaultEolMode()

Reply all
Reply to author
Forward
0 new messages