diff --git a/js/ui/loginModalController.js b/js/ui/loginModalController.js
index d4e096f5..97a1a8bd 100644
--- a/js/ui/loginModalController.js
+++ b/js/ui/loginModalController.js
@@ -1297,28 +1297,24 @@ export default class LoginModalController {
if (qrContainer instanceof HTMLElement) {
qrContainer.innerHTML = "";
- const resolveTokenColor = (tokenName, fallback) => {
- if (!tokenName) {
- return fallback;
+ // Force high-contrast black-on-white for the QR code to ensure
+ // it remains readable and scannable regardless of the application theme.
+ // We resolve these from the unified token system to ensure consistency.
+ let qrLightColor = "#ffffff";
+ let qrDarkColor = "#000000";
+
+ if (this.window && typeof this.window.getComputedStyle === "function") {
+ try {
+ const style = this.window.getComputedStyle(this.document.documentElement);
+ const white = style.getPropertyValue("--color-white").trim();
+ const black = style.getPropertyValue("--color-black").trim();
+ if (white) qrLightColor = white;
+ if (black) qrDarkColor = black;
+ } catch (error) {
+ // Fallback to hardcoded values if style resolution fails
}
- const doc = this.document;
- const win = this.window;
- if (!doc || !win || typeof win.getComputedStyle !== "function") {
- return fallback;
- }
- const root = doc.documentElement;
- if (!root) {
- return fallback;
- }
- const computed = win.getComputedStyle(root);
- if (!computed) {
- return fallback;
- }
- const value = computed.getPropertyValue(tokenName);
- return value && value.trim() ? value.trim() : fallback;
- };
- const qrLightColor = resolveTokenColor("--color-white", "#ffffff");
- const qrDarkColor = resolveTokenColor("--color-black", "#000000");
+ }
+
if (uri) {
try {
qrInstance = renderQrCode(qrContainer, uri, {