~95% on SimpleQA (e.g. Qwen3.6-27B on a 3090). Supports all local and cloud LLMs (llama.cpp, Ollama, Google, ...). 10+ search engines - arXiv, PubMed, your private documents. Everything Local & Encrypted.
Python academiaanthropicarxivbravedeep-researchencryptionhome-automationhomeserverlocallocal-deep-researchlocal-llmmistralollamaopenaipubmedresearchresearch-toolretrieval-augmented-generationsearxngself-hosted
fix(ui): use a shared dark theme default (#7899)
LearningCircuit55add4754aa1
diff --git a/changelog.d/+default-dark-theme.misc.md b/changelog.d/+default-dark-theme.misc.mdnew file mode 100644index 0000000000..83f2531462--- /dev/null+++ b/changelog.d/+default-dark-theme.misc.md@@ -0,0 +1 @@+Use Hashed (dark) as the default theme while light themes are being refined; saved theme preferences still apply, and System and light themes remain available. Improve contrast for active navigation and research mode descriptions in the default dark theme.diff --git a/docs/CONFIGURATION.md b/docs/CONFIGURATION.mdindex 89befa4c19..20c5277265 100644--- a/docs/CONFIGURATION.md+++ b/docs/CONFIGURATION.md@@ -69,7 +69,7 @@ They are not available in the Web UI because they are needed to start the applic| `app.max_user_query_length` | `LDR_APP_MAX_USER_QUERY_LENGTH` | `300` | Maximum character length for user queries before disabling direct search. Longer queries will use LLM-generated questions only. | SEARCH || `app.port` | `LDR_APP_PORT` | `5000` | TCP port used only as a fallback when generating notification links while app.external_url is unset. This setting does not control the web listener. To change the listening port, set LDR_WEB_PORT; web.port is the corresponding internal key, not a user-editable listener control. | APP || `app.queue_mode` | `LDR_QUEUE_MODE` | `direct` | How new research requests are handled. 'Direct' starts research immediately if a concurrent slot is available. 'Queue' always adds to a background queue for sequential processing in order. | APP |-| `app.theme` | `LDR_APP_THEME` | `system` | User interface color theme. Choose from 33 themes including popular developer themes. | APP |+| `app.theme` | `LDR_APP_THEME` | `hashed` | User interface color theme. Hashed is the existing dark theme, used by default because light themes still need refinement for everyday use. Choose from 33 themes including popular developer themes. | APP || `app.timezone` | `TZ` | `UTC` | Timezone for date calculations (e.g., news subscription YYYY-MM-DD placeholder). Use 'UTC' for server time or specify your local timezone. | APP || `app.warnings.dismiss_adaptive_scope_info` | `LDR_APP_WARNINGS_DISMISS_ADAPTIVE_SCOPE_INFO` | `false` | Permanently hide the informational banner that states what the Adaptive egress scope resolves to (public / private / both) for the current primary engine. | APP || `app.warnings.dismiss_cloud_embeddings` | `LDR_APP_WARNINGS_DISMISS_CLOUD_EMBEDDINGS` | `false` | Permanently hide the 'document chunks will be sent to OpenAI' (cloud embeddings) banner. Separate from the public-egress dismiss flag so acknowledging fresh-install noise never suppresses this critical warning. | APP |diff --git a/src/local_deep_research/defaults/__init__.py b/src/local_deep_research/defaults/__init__.pyindex 71c0a5fce8..731340a171 100644--- a/src/local_deep_research/defaults/__init__.py+++ b/src/local_deep_research/defaults/__init__.py@@ -5,9 +5,12 @@ This module is responsible for loading and initializing defaultconfiguration files and resources used throughout the application."""-from loguru import logger+import json+from functools import cachefrom pathlib import Path+from loguru import logger+# Define the path to the package's defaults directoryDEFAULTS_DIR = Path(__file__).parent@@ -19,6 +22,24 @@ DEFAULT_FILES = {}+@cache+def get_default_theme() -> str:+ """Read the shipped theme default once for server and browser consumers.++ ``hashed`` is the registered ID of the existing Hashed dark palette,+ preferred while light themes still need refinement. Read ``app.theme``+ so account defaults, initial rendering and repairs share that choice.+ """+ # nosemgrep: semgrep.rules.path-traversal-risk, reason: Only a fixed filename beneath the installed defaults package is opened+ with (DEFAULTS_DIR / "default_settings.json").open(+ encoding="utf-8-sig"+ ) as settings_file:+ theme = json.load(settings_file)["app.theme"]["value"]+ if not isinstance(theme, str):+ raise ValueError("The default app.theme value must be a string")+ return theme++def get_default_file_path(filename):"""Get the path to a default configuration file."""if filename in DEFAULT_FILES:diff --git a/src/local_deep_research/defaults/default_settings.json b/src/local_deep_research/defaults/default_settings.jsonindex bb0330f897..5124798691 100644--- a/src/local_deep_research/defaults/default_settings.json+++ b/src/local_deep_research/defaults/default_settings.json@@ -213,15 +213,15 @@},"app.theme": {"category": "app_interface",- "description": "User interface color theme. Choose from 33 themes including popular developer themes.",+ "description": "User interface color theme. Hashed is the existing dark theme, used by default because light themes still need refinement for everyday use. Choose from 33 themes including popular developer themes.","editable": true,"max_value": null,"min_value": null,"name": "UI Theme","options": [{- "label": "Dark (Default)",- "value": "dark"+ "label": "Hashed (Default)",+ "value": "hashed"},{"label": "Light",@@ -307,7 +307,7 @@"step": null,"type": "APP","ui_element": "select",- "value": "system",+ "value": "hashed","visible": true},"app.web_interface": {diff --git a/src/local_deep_research/settings/manager.py b/src/local_deep_research/settings/manager.pyindex 2950ab9d84..5864677896 100644--- a/src/local_deep_research/settings/manager.py+++ b/src/local_deep_research/settings/manager.py@@ -268,8 +268,9 @@ def validate_imported_setting_value(# runtime, had no ``dark`` entry. This guard is what let that invalid# default seed successfully — and therefore what kept it invisible# until the no-JS Save path validated it and reported the user's- # untouched theme as "failing". The default is now ``system``, which- # the registry does serve.+ # untouched theme as "failing". The current default, ``hashed``,+ # is the registry ID of the existing Hashed dark palette, selected+ # while light themes still need refinement.return Nonetry:diff --git a/src/local_deep_research/web/fastapi_app.py b/src/local_deep_research/web/fastapi_app.pyindex 4d716980a2..e162c271cd 100644--- a/src/local_deep_research/web/fastapi_app.py+++ b/src/local_deep_research/web/fastapi_app.py@@ -2504,8 +2504,12 @@ def _setup_template_globals() -> None:env.globals["get_flashed_messages"] = lambda with_categories=False: []# Theme helpers+ from ..defaults import get_default_themefrom .themes import get_theme_metadata, get_themes, get_themes_json+ # Hashed is the registered dark palette, preferred while light themes+ # need refinement. Export the shared setting for HTML and browser startup.+ env.globals["default_theme"] = get_default_theme()env.globals["get_themes"] = get_themesenv.globals["get_themes_json"] = get_themes_jsonenv.globals["get_theme_metadata"] = get_theme_metadatadiff --git a/src/local_deep_research/web/routers/settings.py b/src/local_deep_research/web/routers/settings.pyindex a33519721a..efc7c7e959 100644--- a/src/local_deep_research/web/routers/settings.py+++ b/src/local_deep_research/web/routers/settings.py@@ -81,6 +81,7 @@ from ...database.models.settings import Setting, SettingTypefrom ...database.session_context import get_user_db_sessionfrom ...database.encrypted_db import db_managerfrom ...database.sqlcipher_utils import retry_on_db_lock+from ...defaults import get_default_themefrom ...llm.providers.base import normalize_providerfrom ...security.egress.policy import (DEFAULT_EGRESS_SCOPE,@@ -2020,10 +2021,10 @@ def _save_all_settings_sync(form_data: dict, username: str):elif key == "search.tool":value = DEFAULT_SEARCH_TOOLelif key in ["app.theme", "app.default_theme"]:- # Must stay a value the theme registry actually- # serves; "dark" was reset here for a long time- # after the registry stopped having it.- value = "system"+ # Hashed (ID "hashed") is the chosen dark default+ # while light themes need refinement; repairs use+ # that same registered value from app.theme.+ value = get_default_theme()else:value = Nonediff --git a/src/local_deep_research/web/static/js/services/theme.js b/src/local_deep_research/web/static/js/services/theme.jsindex cbf6780b87..e7748064de 100644--- a/src/local_deep_research/web/static/js/services/theme.js+++ b/src/local_deep_research/web/static/js/services/theme.js@@ -17,6 +17,10 @@const STORAGE_KEY_PREFIX = 'ldr-theme';const SETTING_KEY = 'app.theme';+ // Hashed (ID "hashed") is the existing dark palette, preferred while+ // light themes need refinement. The server injects the shared setting+ // so browser fallbacks follow the same choice as new accounts.+ const DEFAULT_THEME = window.LDR_DEFAULT_THEME;// Themes are auto-detected from CSS and injected by base.html// window.LDR_THEME_METADATA is set before this script loads@@ -73,7 +77,8 @@*/function getEffectiveTheme(theme) {if (theme === 'system') {- // Follow the OS preference using the default light and dark palettes.+ // An explicit System choice maps OS dark mode to Hashed, whose+ // registered palette ID is "hashed", and OS light mode to Light.return window.matchMedia('(prefers-color-scheme: dark)').matches ? 'hashed' : 'light';}return theme;@@ -84,7 +89,7 @@*/function getCurrentTheme() {const storageKey = getStorageKey();- return localStorage.getItem(storageKey) || 'system';+ return localStorage.getItem(storageKey) || DEFAULT_THEME;}/**@@ -171,8 +176,8 @@themeIntentGeneration++;// Validate theme using VALID_THEMES arrayif (!VALID_THEMES.includes(theme)) {- SafeLogger.warn('Invalid theme:', theme, '- falling back to hashed');- theme = 'hashed';+ SafeLogger.warn('Invalid theme:', theme, '- falling back to', DEFAULT_THEME);+ theme = DEFAULT_THEME;}applyTheme(theme);@@ -289,7 +294,7 @@// Set tooltip for next theme in cycleconst nextIndex = (THEME_CYCLE.indexOf(rawTheme) + 1) % THEME_CYCLE.length;- const nextTheme = THEME_CYCLE[nextIndex] || 'hashed';+ const nextTheme = THEME_CYCLE[nextIndex] || DEFAULT_THEME;quickToggle.setAttribute('title', `Switch to ${THEMES[nextTheme]?.label || nextTheme} theme`);quickToggle.setAttribute('aria-label', `Current theme: ${THEMES[rawTheme]?.label || rawTheme}. Click to switch.`);}@@ -355,9 +360,9 @@// Validate stored theme (in case localStorage was corrupted)// timing comparison on public theme names, not secrets// bearer:disable javascript_lang_observable_timing- const validatedTheme = VALID_THEMES.includes(storedTheme) ? storedTheme : 'hashed';+ const validatedTheme = VALID_THEMES.includes(storedTheme) ? storedTheme : DEFAULT_THEME;if (validatedTheme !== storedTheme) {- SafeLogger.warn('Invalid stored theme, resetting to hashed');+ SafeLogger.warn('Invalid stored theme, resetting to', DEFAULT_THEME);applyTheme(validatedTheme);}diff --git a/src/local_deep_research/web/templates/base.html b/src/local_deep_research/web/templates/base.htmlindex 454a4b47b6..1d0948ee71 100644--- a/src/local_deep_research/web/templates/base.html+++ b/src/local_deep_research/web/templates/base.html@@ -1,5 +1,6 @@<!DOCTYPE html>-<html lang="en" data-theme="hashed">+{# Hashed is the registered dark palette, preferred while light themes need refinement. #}+<html lang="en" data-theme="{{ default_theme }}"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0">@@ -17,16 +18,21 @@var validThemes = {{ get_themes_json() }};// Store theme metadata for JavaScript (used by theme.js)window.LDR_THEME_METADATA = {{ get_theme_metadata() }};+ // Share the chosen Hashed dark default with theme.js for first renders+ // without a saved preference while light themes need refinement.+ window.LDR_DEFAULT_THEME = {{ default_theme|tojson }};var userId = {{ session.username|default("anonymous", true)|tojson }};var storageKey = 'ldr-theme-' + userId;- var theme = localStorage.getItem(storageKey) || 'system';+ var theme = localStorage.getItem(storageKey) || window.LDR_DEFAULT_THEME;// Validate themeif (validThemes.indexOf(theme) === -1) {- theme = 'hashed';+ theme = window.LDR_DEFAULT_THEME;}var effectiveTheme = theme;if (theme === 'system') {+ // Hashed's registered ID is "hashed"; System still resolves+ // an explicit OS-dark preference to that dark palette.effectiveTheme = window.matchMedia('(prefers-color-scheme: dark)').matches ? 'hashed' : 'light';}document.documentElement.setAttribute('data-theme', effectiveTheme);diff --git a/src/local_deep_research/web/themes/core/hashed.css b/src/local_deep_research/web/themes/core/hashed.cssindex 0d20b9941d..39b7442670 100644--- a/src/local_deep_research/web/themes/core/hashed.css+++ b/src/local_deep_research/web/themes/core/hashed.css@@ -57,3 +57,15 @@ is_default = true--primary-color: var(--accent-primary);--card-bg: var(--bg-secondary);}++/* Hashed (ID "hashed") is the dark default while light themes are refined.+ Primary text stays readable on its highlighted navigation background. */+[data-theme="hashed"] .ldr-sidebar-nav li.active a {+ color: var(--text-primary);+}++/* The default Hashed palette needs secondary text on these card surfaces;+ its muted text falls below the normal-text contrast requirement here. */+[data-theme="hashed"] .ldr-mode-info p {+ color: var(--text-secondary);+}diff --git a/tests/database/test_upgrade_from_pre_migration_install.py b/tests/database/test_upgrade_from_pre_migration_install.pyindex 1feb9278b3..0e5ca68480 100644--- a/tests/database/test_upgrade_from_pre_migration_install.py+++ b/tests/database/test_upgrade_from_pre_migration_install.py@@ -980,10 +980,15 @@ def test_fresh_install_receives_the_new_defaults(tmp_path, request):)initialize_database(engine, session)- assert _stored_value(Session, "app.theme") == "system", (- "a fresh install did not get this PR's new app.theme default, so the "- "'user choice survives a changed default' tests are not actually "- "exercising a changed default"+ default_theme = SettingsManager(db_session=None).default_settings[+ "app.theme"+ ]["value"]+ assert default_theme != USER_CHOICES["app.theme"], (+ "the shipped theme default must differ from the seeded old choice "+ "for the preservation checks to exercise a changed default"+ )+ assert _stored_value(Session, "app.theme") == default_theme, (+ "a fresh install did not get the registered app.theme default")assert _stored_value(Session, "web.host") == "127.0.0.1", ("a fresh install did not get this PR's new web.host default"diff --git a/tests/defaults/test_defaults.py b/tests/defaults/test_defaults.pyindex 8459162d37..29942a609d 100644--- a/tests/defaults/test_defaults.py+++ b/tests/defaults/test_defaults.py@@ -1,8 +1,50 @@"""Tests for defaults module."""+import jsonfrom pathlib import Pathfrom unittest.mock import patch+import pytest+++def theme_defaults_file(tmp_path, monkeypatch):+ from local_deep_research import defaults++ monkeypatch.setattr(defaults, "DEFAULTS_DIR", tmp_path)+ defaults.get_default_theme.cache_clear()+ try:+ yield tmp_path / "default_settings.json"+ finally:+ defaults.get_default_theme.cache_clear()+++class TestDefaultTheme:+ # Hashed is the chosen dark default while light themes need refinement;+ # Nord verifies that the helper also reads another configured palette.+ @pytest.mark.parametrize("theme", ["hashed", "nord"])+ def test_reads_account_default_from_settings_file(+ self, theme_defaults_file, theme+ ):+ from local_deep_research import defaults++ theme_defaults_file.write_text(+ json.dumps({"app.theme": {"value": theme}}), encoding="utf-8"+ )+ assert defaults.get_default_theme() == theme++ @pytest.mark.parametrize("theme", [None, True, 42, [], {}])+ def test_rejects_non_string_defaults(self, theme_defaults_file, theme):+ from local_deep_research import defaults++ theme_defaults_file.write_text(+ json.dumps({"app.theme": {"value": theme}}), encoding="utf-8"+ )+ with pytest.raises(+ ValueError, match="app.theme value must be a string"+ ):+ defaults.get_default_theme()+class TestDefaultsDir:def test_defaults_dir_exists(self):diff --git a/tests/js/services/theme-bootstrap-runtime.test.js b/tests/js/services/theme-bootstrap-runtime.test.jsindex 4be074edfa..3a66871d7b 100644--- a/tests/js/services/theme-bootstrap-runtime.test.js+++ b/tests/js/services/theme-bootstrap-runtime.test.js@@ -5,7 +5,12 @@ import { resolve } from 'node:path';const template = readFileSync(resolve(__dirname, '../../../src/local_deep_research/web/templates/base.html',), 'utf8');-const metadata = Object.fromEntries(['system', 'light', 'hashed', 'sepia']+const defaultTheme = JSON.parse(readFileSync(resolve(+ __dirname, '../../../src/local_deep_research/defaults/default_settings.json',+), 'utf8'))['app.theme'].value;+// "hashed" is Hashed's registered dark-palette ID, used for the shipped+// default and for resolving explicit System preferences on a dark OS.+const metadata = Object.fromEntries(['system', 'light', 'hashed', 'sepia', 'nord'].map(id => [id, { label: id }]));// Supply only the server-rendered values; execute the checked-in browser logic.const bootstrap = template.match(/<script>([\s\S]*?)<\/script>/)[1]@@ -13,8 +18,11 @@ const bootstrap = template.match(/<script>([\s\S]*?)<\/script>/)[1].replace('{{ get_theme_metadata() }}', JSON.stringify(metadata)).replace('{{ session.username|default("anonymous", true)|tojson }}', JSON.stringify('reader'));-// This source comes from our template above, never from user-controlled input.-const applyInitialTheme = new Function(bootstrap); // eslint-disable-line no-new-func+function applyInitialTheme(injectedDefault = defaultTheme) {+ const script = bootstrap.replace('{{ default_theme|tojson }}', JSON.stringify(injectedDefault));+ // This source comes from our template above, never from user-controlled input.+ new Function(script)(); // eslint-disable-line no-new-func+}beforeEach(() => {localStorage.clear();@@ -24,11 +32,14 @@ beforeEach(() => {afterEach(() => {localStorage.clear();delete window.LDR_THEME_METADATA;+ delete window.LDR_DEFAULT_THEME;vi.restoreAllMocks();});+// With no saved preference, use Hashed while light themes need refinement. Explicit+// System choices still select the appropriate light or dark OS palette.it.each([- { preference: null, dark: false, expected: 'light' },+ { preference: null, dark: false, expected: 'hashed' },{ preference: null, dark: true, expected: 'hashed' },{ preference: 'system', dark: false, expected: 'light' },{ preference: 'system', dark: true, expected: 'hashed' },@@ -45,3 +56,13 @@ it.each([// Resolving System must not turn it into an explicit saved Light/Hashed choice.expect(localStorage.getItem('ldr-theme-reader')).toBe(preference);});++it.each([null, 'removed-theme'])('uses the injected default for preference=%s', preference => {+ if (preference) localStorage.setItem('ldr-theme-reader', preference);++ applyInitialTheme('nord');++ expect(document.documentElement.dataset.theme).toBe('nord');+ expect(window.LDR_DEFAULT_THEME).toBe('nord');+ expect(localStorage.getItem('ldr-theme-reader')).toBe(preference);+});diff --git a/tests/js/services/theme-lifecycle-runtime.test.js b/tests/js/services/theme-lifecycle-runtime.test.jsindex 8740728388..d808232bc0 100644--- a/tests/js/services/theme-lifecycle-runtime.test.js+++ b/tests/js/services/theme-lifecycle-runtime.test.js@@ -20,6 +20,9 @@ const mediaQuery = {let theme;beforeAll(async () => {+ // Hashed is the shipped dark default while light themes need refinement.+ // Injecting Nord verifies that fallbacks follow the configured default.+ window.LDR_DEFAULT_THEME = 'nord';Object.defineProperty(document, 'readyState', {configurable: true,get: () => 'loading',@@ -66,6 +69,7 @@ afterAll(() => {localStorage.clear();document.body.replaceChildren();delete window.LDR_THEME_METADATA;+ delete window.LDR_DEFAULT_THEME;delete window.api;vi.unstubAllGlobals();if (originalReadyState) {@@ -96,12 +100,12 @@ it('isolates persisted themes by meta user, body user, and anonymous context', (meta.remove();document.body.dataset.userId = ' bob ';- expect(theme.getCurrentTheme()).toBe('system');+ expect(theme.getCurrentTheme()).toBe('nord');theme.setTheme('nord', false);expect(localStorage.getItem('ldr-theme-bob')).toBe('nord');delete document.body.dataset.userId;- expect(theme.getCurrentTheme()).toBe('system');+ expect(theme.getCurrentTheme()).toBe('nord');theme.setTheme('hashed', false);expect(localStorage.getItem('ldr-theme-anonymous')).toBe('hashed');});@@ -137,8 +141,15 @@ it('resets a corrupted stored theme before server hydration settles', () => {theme.initializeTheme();- expect(theme.getCurrentTheme()).toBe('hashed');- expect(document.documentElement.dataset.theme).toBe('hashed');+ expect(theme.getCurrentTheme()).toBe('nord');+ expect(document.documentElement.dataset.theme).toBe('nord');+});++it('uses the injected default when a requested theme is invalid', () => {+ theme.setTheme('removed-theme', false);++ expect(theme.getCurrentTheme()).toBe('nord');+ expect(document.documentElement.dataset.theme).toBe('nord');});it('reacts to a system color-scheme change only for the system preference', () => {diff --git a/tests/js/services/theme.test.js b/tests/js/services/theme.test.jsindex f809a41cd9..84d2685be9 100644--- a/tests/js/services/theme.test.js+++ b/tests/js/services/theme.test.js@@ -24,6 +24,9 @@ function deferred() {}beforeAll(async () => {+ // Mirror the shipped choice: "hashed" is the existing Hashed dark+ // palette's ID, preferred while light themes still need refinement.+ window.LDR_DEFAULT_THEME = 'hashed';// Set up theme metadata before loading the modulewindow.LDR_THEME_METADATA = {'hashed': { label: 'Hashed', icon: 'fa-hashtag', group: 'core' },@@ -76,9 +79,10 @@ describe('themeService', () => {});describe('getCurrentTheme / setTheme', () => {- it('defaults to system when no theme stored', () => {+ it('defaults to hashed when no theme stored', () => {localStorage.clear();- expect(theme.getCurrentTheme()).toBe('system');+ // Missing preferences must start with the chosen Hashed dark palette.+ expect(theme.getCurrentTheme()).toBe('hashed');});it('stores and retrieves theme', () => {@@ -142,7 +146,8 @@ describe('themeService', () => {theme.setTheme('nord', false);expect(theme.getCurrentTheme()).toBe('nord');theme.clearTheme();- expect(theme.getCurrentTheme()).toBe('system');+ // Clearing a preference restores the chosen Hashed dark default.+ expect(theme.getCurrentTheme()).toBe('hashed');});});diff --git a/tests/security/test_injection_and_template_safety.py b/tests/security/test_injection_and_template_safety.pyindex 63da2a99d4..018ee81681 100644--- a/tests/security/test_injection_and_template_safety.py+++ b/tests/security/test_injection_and_template_safety.py@@ -834,6 +834,7 @@ def test_shipped_theme_json_cannot_break_out_of_the_script_block():@pytest.mark.parametrize("payload", [BREAKOUT_HTML, "<>&'\" café", "</ScRiPt>"])def test_theme_json_escapes_metadata_before_inline_render(monkeypatch, payload):"""Real helpers and the base template preserve data without HTML breakout."""+ from local_deep_research.defaults import get_default_themefrom local_deep_research.web import themes as themes_moduletheme = themes_module.ThemeMetadata(@@ -860,6 +861,7 @@ def test_theme_json_escapes_metadata_before_inline_render(monkeypatch, payload):.render(get_themes_json=themes_module.get_themes_json,get_theme_metadata=themes_module.get_theme_metadata,+ default_theme=get_default_theme(),session={"username": "alice"},))diff --git a/tests/settings/golden_master_settings.json b/tests/settings/golden_master_settings.jsonindex acbb89ab32..c9e5982574 100644--- a/tests/settings/golden_master_settings.json+++ b/tests/settings/golden_master_settings.json@@ -193,7 +193,7 @@},"app.theme": {"category": "app_interface",- "description": "User interface color theme. Choose from 33 themes including popular developer themes.",+ "description": "User interface color theme. Hashed is the existing dark theme, used by default because light themes still need refinement for everyday use. Choose from 33 themes including popular developer themes.","editable": true,"max_value": null,"min_value": null,@@ -335,7 +335,7 @@"step": null,"type": "APP","ui_element": "select",- "value": "system",+ "value": "hashed","visible": true},"app.timezone": {diff --git a/tests/web/routers/test_settings_routes_corrupted_coverage_port.py b/tests/web/routers/test_settings_routes_corrupted_coverage_port.pyindex 92572b0095..c31971c9a1 100644--- a/tests/web/routers/test_settings_routes_corrupted_coverage_port.py+++ b/tests/web/routers/test_settings_routes_corrupted_coverage_port.py@@ -140,12 +140,11 @@ class TestSaveAllSettingsCorruptedValues:assert kwargs["key"] == "search.tool"assert kwargs["value"] == DEFAULT_SEARCH_TOOL- def test_empty_braces_detected_as_corrupted_for_app_theme(self):- """Value '{}' is detected as corrupted; app.theme gets its default.-- Main repaired to ``"dark"``; the branch repairs to ``"system"``- (741193b30) because the theme registry stopped serving ``dark``.- """+ # Hashed is the shipped dark default while light themes are refined;+ # Nord verifies that repair follows another configured default too.+ @pytest.mark.parametrize("theme", ["hashed", "nord"])+ def test_empty_braces_detected_as_corrupted_for_app_theme(self, theme):+ """Corrupted app.theme uses the shared shipped default."""setting = _make_setting(key="app.theme",value="system",@@ -154,11 +153,12 @@ class TestSaveAllSettingsCorruptedValues:setting_type="app",)- result, mock_coerce = self._run(setting, {"app.theme": "{}"})+ with patch(f"{S}.get_default_theme", return_value=theme):+ result, mock_coerce = self._run(setting, {"app.theme": "{}"})assert result["status"] == "success"_, kwargs = mock_coerce.call_args- assert kwargs["value"] == "system"+ assert kwargs["value"] == themedef test_corrupted_report_key_gets_empty_dict(self):"""report.* keys with corrupted values get replaced with empty dict."""diff --git a/tests/web/routers/test_settings_routes_coverage_port.py b/tests/web/routers/test_settings_routes_coverage_port.pyindex d5de72e805..1b71d388a7 100644--- a/tests/web/routers/test_settings_routes_coverage_port.py+++ b/tests/web/routers/test_settings_routes_coverage_port.py@@ -829,12 +829,9 @@ class TestSaveAllSettings:assert mock_coerce.call_args.kwargs["value"] == DEFAULT_SEARCH_TOOLdef test_corrupted_app_theme(self, no_side_effects):- """Corrupted app.theme gets corrected to a theme the registry serves.+ """Repair to the registered Hashed dark palette (ID ``hashed``).- Main repaired to "dark"; the branch repairs to "system" (the value- default_settings.json ships). The *assertion* main made — that the- repair produces a non-corrupt concrete theme rather than passing the- corrupted value through — is what is pinned here.+ Hashed is the default while light themes still need refinement."""setting = _make_setting(key="app.theme", value="dark", ui_element="text", editable=True@@ -843,14 +840,15 @@ class TestSaveAllSettings:session = _session_with([[setting], [setting]])with (patch(- f"{MODULE}.coerce_setting_for_write", return_value="system"+ f"{MODULE}.coerce_setting_for_write", return_value="hashed") as mock_coerce,patch(f"{MODULE}.validate_setting", return_value=(True, None)),patch(f"{MODULE}.set_setting", return_value=True),):result = _save_all({"app.theme": "{}"}, session)assert _status(result) == 200- assert mock_coerce.call_args.kwargs["value"] in ("dark", "system")+ # The repair must use Hashed's registry ID, matching the dark default.+ assert mock_coerce.call_args.kwargs["value"] == "hashed"# ===========================================================================diff --git a/tests/web/themes/test_theme_jinja_globals.py b/tests/web/themes/test_theme_jinja_globals.pyindex 3dedbab7d2..f261dd5a22 100644--- a/tests/web/themes/test_theme_jinja_globals.py+++ b/tests/web/themes/test_theme_jinja_globals.py@@ -31,6 +31,9 @@ Both halves are restored here as identity assertions against the livetemplate environment the app serves from."""+import json+import re+import pytestfrom local_deep_research.web import themes as themes_module@@ -94,3 +97,33 @@ def test_get_themes_returns_the_registrys_ids(env_globals):assert result, ("the registry loaded no themes; the assertion above is vacuous")+++def test_default_theme_matches_the_registered_account_default(env_globals):+ from local_deep_research.defaults import get_default_theme+ from local_deep_research.settings import SettingsManager++ account_default = SettingsManager(db_session=None).default_settings[+ "app.theme"+ ]["value"]+ assert (+ env_globals["default_theme"] == get_default_theme() == account_default+ )+ assert themes_module.theme_registry.is_valid_theme(account_default)+++# Hashed is the chosen dark default while light themes need refinement;+# Nord verifies that HTML and browser injection share other defaults too.[email protected]("theme", ["hashed", "nord"])+def test_initial_html_and_browser_share_the_injected_default(+ env_globals, theme+):+ source, _, _ = templates.env.loader.get_source(templates.env, "base.html")+ # Render the real initial HTML and startup script, before page assets.+ head = source.split("</script>", 1)[0] + "</script>"+ rendered = templates.env.from_string(head).render(default_theme=theme)++ assert f'data-theme="{theme}"' in rendered+ exported = re.search(r"window\.LDR_DEFAULT_THEME = (.+?);", rendered)+ assert exported is not None+ assert json.loads(exported.group(1)) == theme