From 3855552c193dceb8a75dbe1a29fbc40f004133c3 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Tue, 22 Oct 2024 09:58:46 +0530 Subject: [PATCH] Fix #2085312 [Tweaks editor - improve contrast in dark mode](https://bugs.launchpad.net/calibre/+bug/2085312) --- src/calibre/gui2/widgets.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/calibre/gui2/widgets.py b/src/calibre/gui2/widgets.py index f041e372a0e0..9524571cf36c 100644 --- a/src/calibre/gui2/widgets.py +++ b/src/calibre/gui2/widgets.py @@ -980,15 +980,16 @@ def initializeFormats(cls): baseFormat = QTextCharFormat() baseFormat.setFontFamilies(['monospace']) p = QApplication.instance().palette() + is_dark = QApplication.instance().is_dark_theme for name, color, bold, italic in ( ("normal", None, False, False), ("keyword", p.color(QPalette.ColorRole.Link).name(), True, False), ("builtin", p.color(QPalette.ColorRole.Link).name(), False, False), ("constant", p.color(QPalette.ColorRole.Link).name(), False, False), ("decorator", "#0000E0", False, False), - ("comment", "#007F00", False, True), - ("string", "#808000", False, False), - ("number", "#924900", False, False), + ("comment", '#00c700' if is_dark else "#007F00", False, True), + ("string", '#b6b600' if is_dark else "#808000", False, False), + ("number", '#d96d00' if is_dark else "#924900", False, False), ("error", "#FF0000", False, False), ("pyqt", "#50621A", False, False)):