Qt wallet: add a dark mode #49
Labels
No labels
do-not-open-till-X-Day
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
SubGeniusFinance/dobbscoin-source#49
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Requested by dokfaux on Dobbscord: the Qt wallet needs a dark mode.
Right now the wallet ignores dark desktop themes, and when the OS palette is dark some of it goes unreadable. The problem is that colors are hardcoded in a handful of places instead of coming from the palette:
src/qt/dobbscoin.cpp:547andsrc/qt/dobbscoingui.cpp:110paint thebgtilebackground image behind the main window and wallet framesrc/qt/dobbscoingui.cpp:211sync progress bar has a fixed#e8e8e8backgroundsrc/qt/intro.cpp:213,225error and free-space labels in#800000, which nearly vanishes on dark backgroundssrc/qt/coincontroldialog.cpp:619-621,src/qt/optionsdialog.cpp:252,284plaincolor:redstyleSheetproperties baked intoforms/overviewpage.ui(4),sendcoinsdialog.ui(5),intro.ui,optionsdialog.uioverviewpage.cppalready readsQPalette::Textfor the transaction list, so that part is fine.Proposal
-theme=startup arg to match.QPalette. No big stylesheet, so stock widgets pick it up for free.AppsUseLightTheme, macOS appearance). Elsewhere it falls back to Light.Done when
Scope
Sized against
main@3f047b7f.Constraints
QStyleHints::colorScheme()is Qt 6.5+, so "System" detection has to be per-platform code (Windows registry, macOSNSApp.effectiveAppearance). Linux falls back to Light unless the desktop palette is already dark.PlatformStyle(0.12), which is what upstream uses to recolor icons. We'd backport a slim version of it.Work items
-theme=arg + Fusion/darkQPaletteat startup (dobbscoin.cpp,optionsmodel,optionsdialog.ui). Small.guiconstants.hCOLOR_*, used bytransactiontablemodel.cppandoverviewpage.cpp.COLOR_BLACKattransactiontablemodel.cpp:482gives black-on-dark text in the history tab. This is the worst one.trafficgraphwidget.cppalready draws on black, so it's fine as issplashscreen.cpp:53,125setStyleSheetsites already listed above.uistylesheets:color:#000000and the#F0D0A0→#F8D488gradient inoverviewpage.ui,#808080, threeredQIcon(":/icons/...")call sites. BackportPlatformStyle::SingleColorIconto recolor the monochrome ones at load. The colored ones (tx status, connection bars) probably stay as they are. Medium.bgtilebackground: add a dark tile or skip it in Dark. Needs art, or just a decision.Estimate: roughly 2–3 focused days, most of it items 2–3 and QA. Item 1 alone (Fusion + dark palette, no icon work) is about half a day and would already be usable, with some dark-on-dark icons. That could ship first as a stopgap.
Open question: does the background tile stay in Dark, or do we drop it?
Revised: ship a dark image set instead of recoloring
Looking at the actual art, auto-recoloring (
PlatformStyle::SingleColorIcon) is wrong for this wallet. Our icons are clip-art with interior linework: Dobbs heads, the golfer, the frog, the spider. A single-color tint turns them into flat white blobs. Hand-made dark variants keep the art.Needs a dark variant (~21): the black line art and silhouettes
address-book,connect4_16,debugwindow,overview,receive,send,synced,transaction0,transaction2,transaction_conflicted,tx_inout,tx_input,tx_mined,tx_output,unit_bob,unit_mbob,unit_ubob,dobbscoin_testnet, plus the overview artoverviewLeftTop,overviewLeftBottom,overviewRightand thebgtilebackground.Fine as is: the colored icons (clocks, locks, add/remove/quit, eyes, key, edit/copy/paste, filesave, export, configure, connect0-3 bars, history,
bob/dobbscoincoin),splash*(already on black),about,qrcode(keep it black on white so it scans).Mechanism: put the variants in
src/qt/res/icons-dark/andimages-dark/under the same filenames, and add them to the qrc. A smallthemedIcon(name)helper returns:/icons-dark/namewhen Dark is active and that file exists, and falls back to:/icons/nameotherwise. The 39QIcon(":/icons/...")call sites switch to the helper. That's simpler than backporting PlatformStyle, and a missing dark file degrades gracefully. The.uifiles reference icons directly, so those get re-set in code or moved to the helper.Art first pass: for pure black-on-transparent line art, inverting to near-white (
#e8e8e8, not pure white) is a scripted starting point. Then hand-touch the Dobbs heads and the overview art so the faces don't read as photo negatives.This replaces work item 3 above. The estimate shifts from code to art: about 1 day of code, plus however long the art pass takes.
Art pushed on branch
feat/49-dark-mode-art(6f55433d): 22 dark variants insrc/qt/res/icons-dark/andimages-dark/, inverted for the silhouettes and outlined for the Dobbs heads and overview drawings. Not wired into the qrc yet. The theme switch and loader come next on the same branch.Theme switch pushed on
feat/49-dark-mode-art(b4c219f7).-theme=on the command line. It takes effect after a restart, like Language.GUIUtil::ThemedIcon()/ThemedResource(), which falls back to the original when a file has no dark variant.Built and run on Linux (regtest, Xvfb), Overview tab:
Dark

Light (unchanged)

Correction to the scope comment:
COLOR_BLACKattransactiontablemodel.cpp:482is a decoration fallback, not history text, so it was never the readability bug I called it.Not yet checked: the other tabs and dialogs, Windows, macOS, and the 16px unit heads at real size.
Dark theme, every tab, from
feat/49-dark-mode-art@86893c1f. Linux, regtest wallet with 103 mined blocks and one send-to-self, started with-theme=dark.86893c1falso fixes the Mining page's "Mine (BOB)" checkbox, which was invisible on the near-black tile.Overview

Send

Receive

Mining (checkbox fixed)

Transactions: immature amounts in brackets are dim gray, same as in Light.

Options > Display: the Theme row reads System because the

-theme=darkcommand-line override wins, and the dialog lists that override underneath.Debug console

Not yet checked: Windows, macOS, and the debug window's Information, Network Traffic and Peers tabs.
Windows test build of PR #50 is up as a pre-release: https://git.subgenius.finance/SubGeniusFinance/dobbscoin-source/releases/tag/wallet-darkmode-20261110
Direct download: https://git.subgenius.finance/SubGeniusFinance/dobbscoin-source/releases/download/wallet-darkmode-20261110/dobbscoin-darkmode-20261110-86893c1f-win64.zip
sha256
6262ea24aedebc9046bc5ff647b79670f5c1f334de64b7830cf000bcb1f5c284Options > Display > Theme, then restart. Please report here:
Back up
wallet.datfirst, as with any test build. No installer: unzip and rundobbscoin-qt.exe. Help > About showsv0.14.0.0-86893c1f.