Skip to content

~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.

feat: add multi-theme support with 5 preset themes

LearningCircuitb60073c25960
diff --git a/src/local_deep_research/defaults/default_settings.json b/src/local_deep_research/defaults/default_settings.json
index 297c335c65..3ba73bff2c 100644
--- a/src/local_deep_research/defaults/default_settings.json
+++ b/src/local_deep_research/defaults/default_settings.json
@@ -198,7 +198,7 @@
},
"app.theme": {
"category": "app_interface",
- "description": "User interface theme",
+ "description": "User interface color theme. 'System' follows your operating system preference.",
"editable": true,
"max_value": null,
"min_value": null,
@@ -212,6 +212,18 @@
"label": "Light",
"value": "light"
},
+ {
+ "label": "Sepia (Reading)",
+ "value": "sepia"
+ },
+ {
+ "label": "High Contrast",
+ "value": "high-contrast"
+ },
+ {
+ "label": "Midnight Blue",
+ "value": "midnight"
+ },
{
"label": "System Default",
"value": "system"
diff --git a/src/local_deep_research/web/static/css/collection_details.css b/src/local_deep_research/web/static/css/collection_details.css
index b4abe900b2..66662c503c 100644
--- a/src/local_deep_research/web/static/css/collection_details.css
+++ b/src/local_deep_research/web/static/css/collection_details.css
@@ -1,11 +1,13 @@
/* Individual Collection Page Styling */
+/* Uses CSS variables from styles.css for theme support */
+
.ldr-rag-manager-container {
max-width: 1200px;
margin: 0 auto;
padding: 2rem;
- background: var(--bg-primary, #121212) !important;
+ background: var(--bg-primary);
min-height: 100vh;
- color: var(--text-primary, #e4e4e4) !important;
+ color: var(--text-primary);
}
@media (prefers-reduced-motion: no-preference) {
@@ -16,13 +18,13 @@
/* Header Section */
.ldr-rag-header {
- background: var(--card-bg, #1e1e2d) !important;
+ background: var(--card-bg);
border-radius: 16px;
padding: 30px;
margin-bottom: 25px;
- box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
- border: 1px solid var(--border-color, #333);
- color: var(--text-primary, #e4e4e4) !important;
+ box-shadow: var(--card-shadow);
+ border: 1px solid var(--border-color);
+ color: var(--text-primary);
}
@media (prefers-reduced-motion: no-preference) {
@@ -32,7 +34,7 @@
}
.ldr-rag-header h1 {
- color: var(--text-primary, #e4e4e4) !important;
+ color: var(--text-primary);
font-size: 2.5rem;
font-weight: 700;
margin: 15px 0;
@@ -42,11 +44,11 @@
}
.ldr-rag-header h1 i {
- color: #667eea;
+ color: var(--accent-primary);
}
.ldr-subtitle {
- color: var(--text-secondary, #999);
+ color: var(--text-secondary);
font-size: 1.1rem;
margin: 10px 0 0 0;
font-style: italic;
@@ -54,12 +56,12 @@
/* Section Styling */
.ldr-rag-section {
- background: var(--card-bg, #1e1e2d);
+ background: var(--card-bg);
border-radius: 16px;
padding: 25px;
margin-bottom: 25px;
- box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
- border: 1px solid var(--border-color, #333);
+ box-shadow: var(--card-shadow);
+ border: 1px solid var(--border-color);
transition: transform 0.3s ease, box-shadow 0.3s ease;
}
@@ -80,11 +82,11 @@
align-items: center;
margin-bottom: 20px;
padding-bottom: 15px;
- border-bottom: 2px solid var(--border-color, #444);
+ border-bottom: 2px solid var(--border-color);
}
.ldr-section-header h2 {
- color: var(--text-primary, #e4e4e4);
+ color: var(--text-primary);
font-size: 1.5rem;
font-weight: 600;
display: flex;
@@ -93,7 +95,7 @@
}
.ldr-section-header h2 i {
- color: #667eea;
+ color: var(--accent-primary);
}
/* Collection Actions Grid */
@@ -129,7 +131,7 @@
left: -100%;
width: 100%;
height: 100%;
- background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
+ background: linear-gradient(90deg, transparent, rgba(var(--text-primary-rgb), 0.2), transparent);
transition: left 0.5s ease;
}
@@ -138,58 +140,59 @@
}
.ldr-btn-primary {
- background: linear-gradient(135deg, #48bb78, #38a169);
+ background: linear-gradient(135deg, var(--success-color), #2f9e6a);
color: white;
}
.ldr-btn-primary:hover {
- background: linear-gradient(135deg, #38a169, #2f855a);
+ filter: brightness(1.1);
transform: translateY(-2px);
- box-shadow: 0 8px 25px rgba(72, 187, 120, 0.3);
+ box-shadow: 0 8px 25px rgba(var(--success-color-rgb), 0.3);
}
.ldr-btn-success {
- background: linear-gradient(135deg, #4299e1, #3182ce);
+ background: linear-gradient(135deg, var(--accent-tertiary), var(--accent-primary));
color: white;
}
.ldr-btn-success:hover {
- background: linear-gradient(135deg, #3182ce, #2c5282);
+ filter: brightness(1.1);
transform: translateY(-2px);
- box-shadow: 0 8px 25px rgba(66, 153, 225, 0.3);
+ box-shadow: 0 8px 25px rgba(var(--accent-tertiary-rgb), 0.3);
}
.ldr-btn-warning {
- background: linear-gradient(135deg, #ed8936, #dd6b20);
- color: white;
+ background: linear-gradient(135deg, var(--warning-color), #d9a00a);
+ color: var(--bg-primary);
}
.ldr-btn-warning:hover {
- background: linear-gradient(135deg, #dd6b20, #c05621);
+ filter: brightness(1.1);
transform: translateY(-2px);
- box-shadow: 0 8px 25px rgba(237, 137, 54, 0.3);
+ box-shadow: 0 8px 25px rgba(var(--warning-color-rgb), 0.3);
}
.ldr-btn-danger {
- background: linear-gradient(135deg, #f56565, #e53e3e);
+ background: linear-gradient(135deg, var(--error-color), #d93a5c);
color: white;
}
.ldr-btn-danger:hover {
- background: linear-gradient(135deg, #e53e3e, #c53030);
+ filter: brightness(1.1);
transform: translateY(-2px);
- box-shadow: 0 8px 25px rgba(245, 101, 101, 0.3);
+ box-shadow: 0 8px 25px rgba(var(--error-color-rgb), 0.3);
}
.ldr-btn-secondary {
- background: linear-gradient(135deg, #a0aec0, #718096);
- color: white;
+ background: var(--bg-tertiary);
+ color: var(--text-secondary);
+ border: 1px solid var(--border-color);
}
.ldr-btn-secondary:hover {
- background: linear-gradient(135deg, #718096, #4a5568);
+ background: var(--bg-secondary);
+ border-color: var(--accent-primary);
transform: translateY(-2px);
- box-shadow: 0 8px 25px rgba(160, 174, 192, 0.3);
}
/* Statistics Grid */
@@ -201,7 +204,7 @@
}
.ldr-stat-card {
- background: linear-gradient(135deg, #f7fafc, #edf2f7);
+ background: var(--bg-tertiary);
border-radius: 12px;
padding: 20px;
text-align: center;
@@ -218,36 +221,36 @@
left: 0;
right: 0;
height: 4px;
- background: linear-gradient(90deg, #667eea, #764ba2);
+ background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
}
.ldr-stat-card:hover {
transform: translateY(-5px);
box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
- border-color: #667eea;
+ border-color: var(--accent-primary);
}
.ldr-stat-success::before {
- background: linear-gradient(90deg, #48bb78, #38a169);
+ background: linear-gradient(90deg, var(--success-color), #2f9e6a);
}
.ldr-stat-warning::before {
- background: linear-gradient(90deg, #ed8936, #dd6b20);
+ background: linear-gradient(90deg, var(--warning-color), #d9a00a);
}
.ldr-stat-value {
font-size: 2.5rem;
font-weight: 700;
- color: #2d3748;
+ color: var(--text-primary);
margin-bottom: 5px;
- background: linear-gradient(135deg, #2d3748, #4a5568);
+ background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
background-clip: text;
}
.ldr-stat-label {
- color: #718096;
+ color: var(--text-muted);
font-size: 0.9rem;
font-weight: 500;
text-transform: uppercase;
@@ -265,21 +268,21 @@
border-radius: 8px;
font-size: 0.9rem;
font-weight: 500;
- border: 2px solid #e2e8f0;
- background: rgba(255, 255, 255, 0.1);
- color: #4a5568;
+ border: 2px solid var(--border-color);
+ background: rgba(var(--bg-tertiary-rgb), 0.5);
+ color: var(--text-secondary);
transition: all 0.3s ease;
}
.ldr-filter-controls .btn.active {
- background: linear-gradient(135deg, #667eea, #764ba2);
+ background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
color: white;
- border-color: #667eea;
+ border-color: var(--accent-primary);
}
.ldr-filter-controls .btn:hover {
- border-color: #667eea;
- color: #667eea;
+ border-color: var(--accent-primary);
+ color: var(--accent-primary);
}
.ldr-filter-controls .btn.active:hover {
@@ -298,44 +301,44 @@
}
.ldr-documents-list::-webkit-scrollbar-track {
- background: #f1f1f1;
+ background: var(--bg-tertiary);
border-radius: 10px;
}
.ldr-documents-list::-webkit-scrollbar-thumb {
- background: linear-gradient(135deg, #667eea, #764ba2);
+ background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
border-radius: 10px;
}
.ldr-documents-list::-webkit-scrollbar-thumb:hover {
- background: linear-gradient(135deg, #5a67d8, #6b46c1);
+ filter: brightness(1.1);
}
/* Loading Spinner */
.ldr-loading-spinner {
text-align: center;
padding: 40px;
- color: #718096;
+ color: var(--text-muted);
font-size: 1.1rem;
}
.ldr-loading-spinner i {
font-size: 2rem;
margin-bottom: 15px;
- color: #667eea;
+ color: var(--accent-primary);
}
/* Empty State */
.ldr-empty-state {
text-align: center;
padding: 60px 20px;
- color: #718096;
+ color: var(--text-muted);
}
.ldr-empty-state i {
font-size: 4rem;
margin-bottom: 20px;
- color: #cbd5e0;
+ color: var(--text-muted);
}
.ldr-empty-state p {
@@ -358,7 +361,7 @@
.ldr-progress-bar {
width: 100%;
height: 12px;
- background: #e2e8f0;
+ background: var(--bg-tertiary);
border-radius: 10px;
overflow: hidden;
margin-bottom: 10px;
@@ -366,7 +369,7 @@
.ldr-progress-fill {
height: 100%;
- background: linear-gradient(90deg, #667eea, #764ba2);
+ background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
border-radius: 10px;
transition: width 0.3s ease;
position: relative;
@@ -383,7 +386,7 @@
background: linear-gradient(
90deg,
transparent,
- rgba(255, 255, 255, 0.3),
+ rgba(var(--text-primary-rgb), 0.3),
transparent
);
animation: shimmer 2s infinite;
@@ -391,31 +394,31 @@
.ldr-progress-text {
text-align: center;
- color: #2b6cb0;
+ color: var(--accent-tertiary);
font-weight: 600;
font-size: 1.1rem;
margin-top: 10px;
}
.ldr-progress-log {
- background: #f7fafc;
+ background: var(--bg-tertiary);
border-radius: 8px;
padding: 15px;
max-height: 200px;
overflow-y: auto;
font-family: 'Courier New', monospace;
font-size: 0.9rem;
- color: #4a5568;
- border: 1px solid #e2e8f0;
+ color: var(--text-secondary);
+ border: 1px solid var(--border-color);
}
/* Document Items */
.ldr-document-item {
- background: rgba(255, 255, 255, 0.8);
+ background: var(--bg-secondary);
border-radius: 12px;
padding: 20px;
margin-bottom: 15px;
- border: 2px solid #e2e8f0;
+ border: 2px solid var(--border-color);
transition: all 0.3s ease;
position: relative;
overflow: hidden;
@@ -437,8 +440,8 @@
.ldr-document-item .ldr-document-actions button {
background: transparent;
- border: 1px solid #cbd5e0;
- color: #718096;
+ border: 1px solid var(--border-color);
+ color: var(--text-muted);
padding: 8px 12px;
border-radius: 8px;
cursor: pointer;
@@ -447,32 +450,32 @@
}
.ldr-document-item .ldr-document-actions button:hover {
- background: #edf2f7;
- color: #2d3748;
+ background: var(--bg-tertiary);
+ color: var(--text-primary);
}
.ldr-document-item .ldr-document-actions .ldr-btn-delete-doc:hover {
- background: rgba(220, 53, 69, 0.15);
- border-color: #dc3545;
- color: #dc3545;
+ background: rgba(var(--error-color-rgb), 0.15);
+ border-color: var(--error-color);
+ color: var(--error-color);
}
.ldr-document-item .ldr-document-actions .ldr-btn-remove-from-collection:hover {
- background: rgba(255, 193, 7, 0.15);
- border-color: #ffc107;
- color: #d69e00;
+ background: rgba(var(--warning-color-rgb), 0.15);
+ border-color: var(--warning-color);
+ color: var(--warning-color);
}
.ldr-document-item .ldr-document-title {
font-size: 1.2rem;
font-weight: 600;
- color: #2d3748;
+ color: var(--text-primary);
margin-bottom: 8px;
}
.ldr-document-item .ldr-document-meta {
font-size: 0.9rem;
- color: #718096;
+ color: var(--text-muted);
display: flex;
align-items: center;
gap: 10px;
@@ -491,13 +494,13 @@
}
.ldr-badge-success {
- background: linear-gradient(135deg, #48bb78, #38a169);
+ background: linear-gradient(135deg, var(--success-color), #2f9e6a);
color: white;
}
.ldr-badge-warning {
- background: linear-gradient(135deg, #ed8936, #dd6b20);
- color: white;
+ background: linear-gradient(135deg, var(--warning-color), #d9a00a);
+ color: var(--bg-primary);
}
/* Upload Results Messages */
@@ -505,11 +508,11 @@
margin-top: 15px;
padding: 15px;
border-radius: 8px;
- border: 1px solid #e2e8f0;
+ border: 1px solid var(--border-color);
}
.ldr-success-message {
- color: #38a169;
+ color: var(--success-color);
font-weight: 500;
display: flex;
align-items: center;
@@ -518,7 +521,7 @@
}
.ldr-error-message {
- color: #e53e3e;
+ color: var(--error-color);
font-weight: 500;
display: flex;
align-items: center;
@@ -532,7 +535,7 @@
}
.ldr-error-list li {
- color: #e53e3e;
+ color: var(--error-color);
margin-bottom: 5px;
}
@@ -547,21 +550,21 @@
}
.ldr-log-info {
- background: rgba(66, 153, 225, 0.15);
- color: #1a4971;
- border-left: 4px solid #3182ce;
+ background: rgba(var(--accent-tertiary-rgb), 0.15);
+ color: var(--accent-tertiary);
+ border-left: 4px solid var(--accent-tertiary);
}
.ldr-log-success {
- background: rgba(72, 187, 120, 0.1);
- color: #276749;
- border-left: 3px solid #48bb78;
+ background: rgba(var(--success-color-rgb), 0.1);
+ color: var(--success-color);
+ border-left: 3px solid var(--success-color);
}
.ldr-log-error {
- background: rgba(245, 101, 101, 0.1);
- color: #c53030;
- border-left: 3px solid #f56565;
+ background: rgba(var(--error-color-rgb), 0.1);
+ color: var(--error-color);
+ border-left: 3px solid var(--error-color);
}
.ldr-document-item::before {
@@ -571,7 +574,7 @@
left: 0;
width: 4px;
height: 100%;
- background: linear-gradient(135deg, #667eea, #764ba2);
+ background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
transform: scaleY(0);
transition: transform 0.3s ease;
}
@@ -581,17 +584,17 @@
}
.ldr-document-item:hover {
- border-color: #667eea;
- box-shadow: 0 8px 25px rgba(102, 126, 234, 0.15);
+ border-color: var(--accent-primary);
+ box-shadow: 0 8px 25px rgba(var(--accent-primary-rgb), 0.15);
transform: translateX(5px);
}
.ldr-document-item.indexed {
- border-left: 4px solid #48bb78;
+ border-left: 4px solid var(--success-color);
}
.ldr-document-item.unindexed {
- border-left: 4px solid #ed8936;
+ border-left: 4px solid var(--warning-color);
}
/* Animations */
@@ -695,142 +698,29 @@
}
}
-/* Dark Theme Support */
-@media (prefers-color-scheme: dark) {
- .ldr-rag-manager-container {
- background: linear-gradient(135deg, #2d3748 0%, #1a202c 100%);
- }
-
- .ldr-rag-header,
- .ldr-rag-section {
- background: rgba(45, 55, 72, 0.95);
- color: #f7fafc;
- }
-
- .ldr-rag-header h1 {
- background: linear-gradient(135deg, #9f7aea, #667eea);
- -webkit-background-clip: text;
- -webkit-text-fill-color: transparent;
- background-clip: text;
- }
-
- .ldr-section-header h2 {
- color: #f7fafc;
- }
-
- .ldr-stat-card {
- background: linear-gradient(135deg, #2d3748, #1a202c);
- color: #f7fafc;
- }
-
- .ldr-stat-value {
- background: linear-gradient(135deg, #f7fafc, #e2e8f0);
- -webkit-background-clip: text;
- -webkit-text-fill-color: transparent;
- background-clip: text;
- }
-
- .ldr-document-item {
- background: #2d3748;
- color: #f7fafc;
- border-color: #4a5568;
- }
-
- .ldr-document-item .ldr-document-title {
- color: #f7fafc;
- }
-
- .ldr-document-item .ldr-document-meta {
- color: #cbd5e0;
- }
-
- .ldr-document-item .ldr-document-actions button {
- border-color: #4a5568;
- color: #a0aec0;
- }
-
- .ldr-document-item .ldr-document-actions button:hover {
- background: #4a5568;
- color: #f7fafc;
- }
-
- .ldr-progress-bar {
- background: #4a5568;
- }
-
- .ldr-progress-log {
- background: #1a202c;
- color: #f7fafc;
- border-color: #4a5568;
- }
-
- .ldr-filter-controls .btn {
- background: #2d3748;
- color: #f7fafc;
- border-color: #4a5568;
- }
-
- .ldr-embedding-settings-card {
- background: rgba(45, 55, 72, 0.95) !important;
- border-color: #4a5568 !important;
- }
-
- .ldr-embedding-info h4 {
- color: #f7fafc !important;
- }
-
- .ldr-embedding-info .ldr-info-box {
- background: rgba(26, 32, 44, 0.8) !important;
- border-left-color: #667eea !important;
- }
-
- .ldr-embedding-info .ldr-info-label {
- color: #cbd5e0 !important;
- }
-
- .ldr-embedding-info .ldr-info-value {
- color: #f7fafc !important;
- }
-
- .ldr-progress-text {
- color: #63b3ed;
- }
-
- .ldr-log-info {
- background: rgba(99, 179, 237, 0.2);
- color: #90cdf4;
- border-left-color: #4299e1;
- }
-
- .ldr-log-entry {
- color: #e2e8f0;
- }
-}
-
/* Drop Zone Styles */
.ldr-drop-zone {
- border: 3px dashed #667eea;
+ border: 3px dashed var(--accent-primary);
border-radius: 12px;
padding: 40px 20px;
text-align: center;
- background-color: rgba(102, 126, 234, 0.05);
+ background-color: rgba(var(--accent-primary-rgb), 0.05);
cursor: pointer;
position: relative;
- /* No transition - instant feedback */
}
.ldr-drop-zone:hover {
- border-color: #764ba2;
- background-color: rgba(118, 75, 162, 0.1);
+ border-color: var(--accent-secondary);
+ background-color: rgba(var(--accent-secondary-rgb), 0.1);
}
/* Drag-over state - INSTANT, very visible */
.ldr-drop-zone.ldr-drag-over {
- border-color: #28a745;
+ border-color: var(--success-color);
border-style: solid;
border-width: 4px;
- background: linear-gradient(135deg, rgba(40, 167, 69, 0.15) 0%, rgba(32, 201, 151, 0.15) 100%);
- box-shadow: 0 0 20px rgba(40, 167, 69, 0.3), inset 0 0 30px rgba(40, 167, 69, 0.1);
+ background: linear-gradient(135deg, rgba(var(--success-color-rgb), 0.15) 0%, rgba(var(--success-color-rgb), 0.1) 100%);
+ box-shadow: 0 0 20px rgba(var(--success-color-rgb), 0.3), inset 0 0 30px rgba(var(--success-color-rgb), 0.1);
}
/* Spinner appears when dragging */
@@ -842,8 +732,8 @@
width: 50px;
height: 50px;
margin: -25px 0 0 -25px;
- border: 4px solid rgba(40, 167, 69, 0.2);
- border-top-color: #28a745;
+ border: 4px solid rgba(var(--success-color-rgb), 0.2);
+ border-top-color: var(--success-color);
border-radius: 50%;
animation: drop-spinner 0.6s linear infinite;
z-index: 10;
@@ -858,7 +748,7 @@
right: 0;
font-size: 1.1rem;
font-weight: 600;
- color: #28a745;
+ color: var(--success-color);
animation: pulse-text 0.8s ease-in-out infinite alternate;
}
@@ -881,7 +771,7 @@
.ldr-drop-zone-icon {
font-size: 3rem;
- color: #667eea;
+ color: var(--accent-primary);
margin-bottom: 10px;
}
@@ -893,13 +783,13 @@
.ldr-drop-zone-subtext {
margin: 5px 0 15px;
- color: #6c757d;
+ color: var(--text-muted);
}
.ldr-selected-files {
margin-top: 15px;
padding: 15px;
- background-color: rgba(248, 249, 250, 0.5);
+ background-color: rgba(var(--bg-tertiary-rgb), 0.5);
border-radius: 6px;
}
@@ -912,8 +802,8 @@
.ldr-selected-files li {
padding: 8px 12px;
margin: 5px 0;
- background-color: rgba(255, 255, 255, 0.6);
- border: 1px solid #dee2e6;
+ background-color: var(--bg-secondary);
+ border: 1px solid var(--border-color);
border-radius: 4px;
display: flex;
align-items: center;
@@ -921,7 +811,7 @@
}
.ldr-selected-files li i {
- color: #007bff;
+ color: var(--accent-tertiary);
}
/* Modal Styles - Optimized for performance */
@@ -933,8 +823,7 @@
top: 0;
width: 100%;
height: 100%;
- background-color: rgba(0, 0, 0, 0.75);
- /* Removed backdrop-filter for better performance - use darker overlay instead */
+ background-color: var(--overlay-color);
}
@media (prefers-reduced-motion: no-preference) {
@@ -953,15 +842,14 @@
}
.ldr-modal-content {
- background: #ffffff;
+ background: var(--bg-secondary);
margin: 5% auto;
- border: 1px solid rgba(0, 0, 0, 0.1);
+ border: 1px solid var(--border-color);
border-radius: 16px;
width: 90%;
max-width: 500px;
box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
overflow: hidden;
- /* Removed backdrop-filter for better performance */
}
@media (prefers-reduced-motion: no-preference) {
@@ -982,8 +870,8 @@
}
.ldr-modal-header {
- background: rgba(102, 126, 234, 0.1);
- color: #2d3748;
+ background: rgba(var(--accent-primary-rgb), 0.1);
+ color: var(--text-primary);
padding: 1.5rem;
display: flex;
justify-content: space-between;
@@ -997,7 +885,7 @@
}
.ldr-close {
- color: #2d3748;
+ color: var(--text-primary);
font-size: 1.5rem;
font-weight: bold;
cursor: pointer;
@@ -1012,7 +900,7 @@
.ldr-close:hover {
opacity: 1;
- background: rgba(255, 255, 255, 0.1);
+ background: rgba(var(--text-primary-rgb), 0.1);
}
.ldr-modal-body {
@@ -1028,7 +916,7 @@
display: block;
margin-bottom: 0.5rem;
font-weight: 600;
- color: var(--text-primary, #e4e4e4);
+ color: var(--text-primary);
font-size: 0.95rem;
}
@@ -1036,10 +924,10 @@
.ldr-form-group textarea {
width: 100%;
padding: 0.75rem 1rem;
- border: 2px solid var(--border-color, #444);
+ border: 2px solid var(--border-color);
border-radius: 10px;
- background-color: var(--input-bg, #1a1a1a);
- color: var(--text-primary, #e4e4e4);
+ background-color: var(--bg-primary);
+ color: var(--text-primary);
font-family: inherit;
font-size: 1rem;
transition: all 0.3s ease;
@@ -1048,8 +936,8 @@
.ldr-form-group input[type="text"]:focus,
.ldr-form-group textarea:focus {
outline: none;
- border-color: #667eea;
- box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
+ border-color: var(--accent-primary);
+ box-shadow: 0 0 0 4px rgba(var(--accent-primary-rgb), 0.1);
transform: translateY(-2px);
}
@@ -1064,11 +952,11 @@
justify-content: flex-end;
margin-top: 2rem;
padding-top: 1.5rem;
- border-top: 1px solid var(--border-color, #444);
+ border-top: 1px solid var(--border-color);
}
.ldr-form-help {
- color: var(--text-secondary, #999);
+ color: var(--text-secondary);
font-size: 0.9rem;
margin-top: 0.5rem;
font-style: italic;
@@ -1093,17 +981,17 @@
}
.ldr-btn-collections-primary {
- background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
+ background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
color: white;
- box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
- border: 3px solid #667eea;
+ box-shadow: 0 4px 15px rgba(var(--accent-primary-rgb), 0.3);
+ border: 3px solid var(--accent-primary);
}
-/* Featured button styling (extracted from inline styles) */
+/* Featured button styling */
.ldr-btn-featured {
text-decoration: none;
font-size: 1.1rem;
- box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
+ box-shadow: 0 6px 20px rgba(var(--accent-primary-rgb), 0.4);
font-weight: 600;
}
@@ -1116,62 +1004,62 @@
@keyframes gentle-pulse {
0%, 100% {
- box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
+ box-shadow: 0 6px 20px rgba(var(--accent-primary-rgb), 0.4);
}
50% {
- box-shadow: 0 8px 25px rgba(102, 126, 234, 0.5);
+ box-shadow: 0 8px 25px rgba(var(--accent-primary-rgb), 0.5);
}
}
.ldr-btn-collections-primary:hover {
transform: translateY(-2px);
- box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
+ box-shadow: 0 6px 20px rgba(var(--accent-primary-rgb), 0.4);
}
.ldr-btn-collections-secondary {
- background-color: rgba(255, 255, 255, 0.1);
- color: #718096;
- border: 2px solid #e2e8f0;
+ background-color: rgba(var(--bg-tertiary-rgb), 0.5);
+ color: var(--text-muted);
+ border: 2px solid var(--border-color);
}
.ldr-btn-collections-secondary:hover {
- background-color: rgba(255, 255, 255, 0.2);
- border-color: #667eea;
- color: #667eea;
+ background-color: var(--bg-tertiary);
+ border-color: var(--accent-primary);
+ color: var(--accent-primary);
transform: translateY(-2px);
}
.ldr-btn-collections-success {
- background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
+ background: linear-gradient(135deg, var(--success-color) 0%, #20c997 100%);
color: white;
- box-shadow: 0 4px 15px rgba(40, 167, 69, 0.3);
+ box-shadow: 0 4px 15px rgba(var(--success-color-rgb), 0.3);
}
.ldr-btn-collections-success:hover {
transform: translateY(-2px);
- box-shadow: 0 6px 20px rgba(40, 167, 69, 0.4);
+ box-shadow: 0 6px 20px rgba(var(--success-color-rgb), 0.4);
}
.ldr-btn-collections-warning {
- background: linear-gradient(135deg, #ffc107 0%, #fd7e14 100%);
- color: white;
- box-shadow: 0 4px 15px rgba(255, 193, 7, 0.3);
+ background: linear-gradient(135deg, var(--warning-color) 0%, #fd7e14 100%);
+ color: var(--bg-primary);
+ box-shadow: 0 4px 15px rgba(var(--warning-color-rgb), 0.3);
}
.ldr-btn-collections-warning:hover {
transform: translateY(-2px);
- box-shadow: 0 6px 20px rgba(255, 193, 7, 0.4);
+ box-shadow: 0 6px 20px rgba(var(--warning-color-rgb), 0.4);
}
.ldr-btn-collections-danger {
- background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
+ background: linear-gradient(135deg, var(--error-color) 0%, #c82333 100%);
color: white;
- box-shadow: 0 4px 15px rgba(220, 53, 69, 0.3);
+ box-shadow: 0 4px 15px rgba(var(--error-color-rgb), 0.3);
}
.ldr-btn-collections-danger:hover {
transform: translateY(-2px);
- box-shadow: 0 6px 20px rgba(220, 53, 69, 0.4);
+ box-shadow: 0 6px 20px rgba(var(--error-color-rgb), 0.4);
}
.ldr-btn-lg {
@@ -1182,63 +1070,62 @@
.ldr-btn-outline-primary {
background: transparent;
- color: #667eea;
- border: 2px solid #667eea;
+ color: var(--accent-primary);
+ border: 2px solid var(--accent-primary);
}
.ldr-btn-outline-primary:hover {
- background: #667eea;
+ background: var(--accent-primary);
color: white;
}
.ldr-btn-outline-success {
background: transparent;
- color: #28a745;
- border: 2px solid #28a745;
+ color: var(--success-color);
+ border: 2px solid var(--success-color);
}
.ldr-btn-outline-success:hover {
- background: #28a745;
+ background: var(--success-color);
color: white;
}
.ldr-btn-outline-warning {
background: transparent;
- color: #ffc107;
- border: 2px solid #ffc107;
+ color: var(--warning-color);
+ border: 2px solid var(--warning-color);
}
.ldr-btn-outline-warning:hover {
- background: #ffc107;
- color: white;
+ background: var(--warning-color);
+ color: var(--bg-primary);
}
.ldr-active {
- background: #667eea !important;
+ background: var(--accent-primary) !important;
color: white !important;
}
/* Embedding Settings Card - Optimized */
.ldr-embedding-settings-card {
- background: rgba(247, 250, 252, 0.95);
+ background: var(--bg-tertiary);
border-radius: 12px;
padding: 20px;
- border: 1px solid rgba(226, 232, 240, 0.8);
- /* Removed backdrop-filter for better performance */
+ border: 1px solid var(--border-color);
}
.ldr-embedding-info h4 {
- color: #2d3748;
+ color: var(--text-primary);
margin-bottom: 15px;
font-size: 1.2rem;
font-weight: 600;
}
.ldr-embedding-info .ldr-info-box {
- background: rgba(255, 255, 255, 0.8);
+ background: var(--bg-primary);
padding: 15px;
border-radius: 8px;
- border-left: 4px solid #667eea;
+ border-left: 4px solid var(--accent-primary);
margin-bottom: 15px;
}
@@ -1246,7 +1133,7 @@
display: flex;
justify-content: space-between;
padding: 8px 0;
- border-bottom: 1px solid rgba(0, 0, 0, 0.1);
+ border-bottom: 1px solid var(--border-color);
}
.ldr-embedding-info .ldr-info-item:last-child {
@@ -1255,16 +1142,15 @@
.ldr-embedding-info .ldr-info-label {
font-weight: 600;
- color: #4a5568;
+ color: var(--text-secondary);
}
.ldr-embedding-info .ldr-info-value {
- color: #2d3748;
+ color: var(--text-primary);
}
/* Performance Optimizations */
@media (prefers-reduced-motion: no-preference) {
- /* Hint to browser which properties will change for better optimization */
.ldr-btn-collections,
.ldr-stat-card,
.ldr-document-item {
@@ -1275,7 +1161,6 @@
will-change: width;
}
- /* Remove will-change after hover to free up resources */
.ldr-btn-collections:not(:hover),
.ldr-stat-card:not(:hover),
.ldr-document-item:not(:hover) {
@@ -1300,13 +1185,13 @@
}
.ldr-featured-section {
- background: linear-gradient(135deg, rgba(102, 126, 234, 0.15) 0%, rgba(118, 75, 162, 0.15) 100%), var(--card-bg, #1e1e2d) !important;
- border: 2px solid #667eea;
+ background: linear-gradient(135deg, rgba(var(--accent-primary-rgb), 0.15) 0%, rgba(var(--accent-secondary-rgb), 0.15) 100%), var(--card-bg) !important;
+ border: 2px solid var(--accent-primary);
}
.ldr-char-counter {
font-size: 0.875rem;
- color: var(--text-secondary, #999);
+ color: var(--text-secondary);
margin-top: 0.25rem;
}
@@ -1316,7 +1201,7 @@
.ldr-text-center-muted {
text-align: center;
- color: var(--text-secondary, #999);
+ color: var(--text-secondary);
font-style: italic;
margin-bottom: 1rem;
}
@@ -1339,7 +1224,7 @@
/* Guidelines styling */
.ldr-content-padding h3 {
- color: var(--text-primary, #e4e4e4);
+ color: var(--text-primary);
font-size: 1.1rem;
font-weight: 600;
margin-top: 1.5rem;
@@ -1354,7 +1239,7 @@
}
.ldr-content-padding h3 i {
- color: #667eea;
+ color: var(--accent-primary);
}
.ldr-content-padding ul {
@@ -1367,7 +1252,7 @@
padding: 0.5rem 0;
padding-left: 1.5rem;
position: relative;
- color: var(--text-primary, #e4e4e4);
+ color: var(--text-primary);
line-height: 1.6;
}
@@ -1375,14 +1260,14 @@
content: "→";
position: absolute;
left: 0;
- color: #667eea;
+ color: var(--accent-primary);
font-weight: bold;
}
/* Info Text */
.ldr-info-text {
font-size: 1rem;
- color: var(--text-primary, #e4e4e4);
+ color: var(--text-primary);
margin-bottom: 1rem;
line-height: 1.6;
}
@@ -1400,23 +1285,23 @@
align-items: flex-start;
gap: 1rem;
padding: 1rem;
- background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
- border-left: 3px solid #667eea;
+ background: linear-gradient(135deg, rgba(var(--accent-primary-rgb), 0.1) 0%, rgba(var(--accent-secondary-rgb), 0.1) 100%);
+ border-left: 3px solid var(--accent-primary);
border-radius: 8px;
}
.ldr-tip-item i {
- color: #667eea;
+ color: var(--accent-primary);
font-size: 1.25rem;
margin-top: 0.125rem;
flex-shrink: 0;
}
.ldr-tip-item div {
- color: var(--text-primary, #e4e4e4);
+ color: var(--text-primary);
line-height: 1.6;
}
.ldr-tip-item strong {
- color: #8b9cff;
+ color: var(--accent-secondary);
}
diff --git a/src/local_deep_research/web/static/css/document_details.css b/src/local_deep_research/web/static/css/document_details.css
index ef18e97041..64f158e241 100644
--- a/src/local_deep_research/web/static/css/document_details.css
+++ b/src/local_deep_research/web/static/css/document_details.css
@@ -1,23 +1,25 @@
/* Individual Document Page Styling */
+/* Uses CSS variables from styles.css for theme support */
+
.ldr-document-details-container {
max-width: 1200px;
margin: 0 auto;
padding: 20px;
- background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
+ background: var(--gradient-bg);
min-height: 100vh;
border-radius: 20px;
- box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
+ box-shadow: var(--card-shadow);
}
/* Document Header Section */
.ldr-document-header {
- background: rgba(255, 255, 255, 0.95);
- backdrop-filter: blur(10px);
+ background: rgba(var(--bg-secondary-rgb), 0.95);
+ backdrop-filter: var(--backdrop-blur);
border-radius: 16px;
padding: 30px;
margin-bottom: 25px;
- box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
- border: 1px solid rgba(255, 255, 255, 0.2);
+ box-shadow: var(--card-shadow);
+ border: 1px solid var(--border-color);
animation: slideDown 0.6s ease-out;
}
@@ -25,18 +27,18 @@
font-size: 2.5rem;
font-weight: 700;
margin: 20px 0 15px 0;
- color: #2d3748;
+ color: var(--text-primary);
display: flex;
align-items: center;
gap: 15px;
- background: linear-gradient(135deg, #667eea, #764ba2);
+ background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
background-clip: text;
}
.ldr-document-title i {
- background: linear-gradient(135deg, #667eea, #764ba2);
+ background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
background-clip: text;
@@ -44,7 +46,7 @@
.ldr-document-subtitle {
font-size: 1.2rem;
- color: #718096;
+ color: var(--text-muted);
margin-bottom: 25px;
font-style: italic;
}
@@ -59,12 +61,13 @@
}
.ldr-authors-list li {
- background: linear-gradient(135deg, #edf2f7, #e2e8f0);
+ background: var(--bg-tertiary);
padding: 6px 12px;
border-radius: 20px;
font-size: 0.9rem;
- color: #4a5568;
+ color: var(--text-secondary);
font-weight: 500;
+ border: 1px solid var(--border-color);
}
.ldr-authors-list li:not(:last-child):after {
@@ -99,68 +102,68 @@
}
.ldr-btn:hover {
- box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
+ box-shadow: 0 8px 25px rgba(var(--accent-primary-rgb), 0.3);
}
.ldr-btn-primary {
- background: linear-gradient(135deg, #4299e1, #3182ce);
- color: white;
+ background: linear-gradient(135deg, var(--accent-tertiary), var(--accent-primary));
+ color: var(--text-primary);
}
.ldr-btn-primary:hover {
- background: linear-gradient(135deg, #3182ce, #2c5282);
- box-shadow: 0 8px 25px rgba(66, 153, 225, 0.3);
+ filter: brightness(1.1);
}
.ldr-btn-secondary {
- background: linear-gradient(135deg, #a0aec0, #718096);
- color: white;
+ background: var(--bg-tertiary);
+ color: var(--text-secondary);
+ border: 1px solid var(--border-color);
}
.ldr-btn-secondary:hover {
- background: linear-gradient(135deg, #718096, #4a5568);
- box-shadow: 0 8px 25px rgba(160, 174, 192, 0.3);
+ background: var(--bg-secondary);
+ border-color: var(--accent-primary);
}
.ldr-btn-success {
- background: linear-gradient(135deg, #48bb78, #38a169);
+ background: linear-gradient(135deg, var(--success-color), #2f9e6a);
color: white;
}
.ldr-btn-success:hover {
- background: linear-gradient(135deg, #38a169, #2f855a);
- box-shadow: 0 8px 25px rgba(72, 187, 120, 0.3);
+ filter: brightness(1.1);
+ box-shadow: 0 8px 25px rgba(var(--success-color-rgb), 0.3);
}
.ldr-btn-danger {
- background: linear-gradient(135deg, #f56565, #e53e3e);
+ background: linear-gradient(135deg, var(--error-color), #d93a5c);
color: white;
}
.ldr-btn-danger:hover {
- background: linear-gradient(135deg, #e53e3e, #c53030);
- box-shadow: 0 8px 25px rgba(245, 101, 101, 0.3);
+ filter: brightness(1.1);
+ box-shadow: 0 8px 25px rgba(var(--error-color-rgb), 0.3);
}
.ldr-btn-info {
- background: linear-gradient(135deg, #4299e1, #3182ce);
+ background: linear-gradient(135deg, var(--accent-tertiary), var(--accent-primary));
color: white;
}
.ldr-btn-info:hover {
- background: linear-gradient(135deg, #3182ce, #2c5282);
- box-shadow: 0 8px 25px rgba(66, 153, 225, 0.3);
+ filter: brightness(1.1);
+ box-shadow: 0 8px 25px rgba(var(--accent-tertiary-rgb), 0.3);
}
/* Metadata Sections */
.ldr-metadata-section {
- background: rgba(255, 255, 255, 0.95);
- backdrop-filter: blur(10px);
+ background: rgba(var(--bg-secondary-rgb), 0.95);
+ backdrop-filter: var(--backdrop-blur);
border-radius: 16px;
padding: 25px;
margin-bottom: 25px;
- box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
- border: 1px solid rgba(255, 255, 255, 0.2);
+ box-shadow: var(--card-shadow);
+ border: 1px solid var(--border-color);
animation: fadeInUp 0.8s ease-out;
}
@@ -168,16 +171,16 @@
font-size: 1.5rem;
font-weight: 600;
margin-bottom: 20px;
- color: #2d3748;
+ color: var(--text-primary);
display: flex;
align-items: center;
gap: 12px;
padding-bottom: 15px;
- border-bottom: 2px solid #e2e8f0;
+ border-bottom: 2px solid var(--border-color);
}
.ldr-metadata-section h2 i {
- color: #667eea;
+ color: var(--accent-primary);
font-size: 1.3rem;
}
@@ -192,19 +195,19 @@
flex-direction: column;
gap: 8px;
padding: 15px;
- background: linear-gradient(135deg, #f7fafc, #edf2f7);
+ background: var(--bg-tertiary);
border-radius: 12px;
- border: 1px solid #e2e8f0;
+ border: 1px solid var(--border-color);
transition: border-color 0.3s ease;
}
.ldr-metadata-item:hover {
- border-color: #cbd5e0;
+ border-color: var(--accent-secondary);
}
.ldr-metadata-label {
font-weight: 600;
- color: #718096;
+ color: var(--text-muted);
font-size: 0.85rem;
text-transform: uppercase;
letter-spacing: 0.5px;
@@ -212,30 +215,31 @@
}
.ldr-metadata-value {
- color: #2d3748;
+ color: var(--text-primary);
font-size: 1rem;
word-break: break-word;
font-weight: 500;
}
.ldr-metadata-value code {
- background: #2d3748;
- color: #f7fafc;
+ background: var(--bg-primary);
+ color: var(--accent-tertiary);
padding: 4px 8px;
border-radius: 6px;
font-family: 'Courier New', monospace;
font-size: 0.9rem;
+ border: 1px solid var(--border-color);
}
.ldr-metadata-value a {
- color: #667eea;
+ color: var(--accent-tertiary);
text-decoration: none;
font-weight: 500;
transition: color 0.3s ease;
}
.ldr-metadata-value a:hover {
- color: #5a67d8;
+ color: var(--accent-secondary);
text-decoration: underline;
}
@@ -251,21 +255,21 @@
}
.ldr-badge-success {
- background: linear-gradient(135deg, #48bb78, #38a169);
+ background: linear-gradient(135deg, var(--success-color), #2f9e6a);
color: white;
- box-shadow: 0 4px 15px rgba(72, 187, 120, 0.3);
+ box-shadow: 0 4px 15px rgba(var(--success-color-rgb), 0.3);
}
.ldr-badge-info {
- background: linear-gradient(135deg, #4299e1, #3182ce);
+ background: linear-gradient(135deg, var(--accent-tertiary), var(--accent-primary));
color: white;
- box-shadow: 0 4px 15px rgba(66, 153, 225, 0.3);
+ box-shadow: 0 4px 15px rgba(var(--accent-tertiary-rgb), 0.3);
}
.ldr-badge-warning {
- background: linear-gradient(135deg, #ed8936, #dd6b20);
- color: white;
- box-shadow: 0 4px 15px rgba(237, 137, 54, 0.3);
+ background: linear-gradient(135deg, var(--warning-color), #d9a00a);
+ color: var(--bg-primary);
+ box-shadow: 0 4px 15px rgba(var(--warning-color-rgb), 0.3);
}
/* RAG Status */
@@ -274,9 +278,9 @@
align-items: center;
gap: 10px;
padding: 8px 12px;
- background: linear-gradient(135deg, #f7fafc, #edf2f7);
+ background: var(--bg-tertiary);
border-radius: 8px;
- border: 1px solid #e2e8f0;
+ border: 1px solid var(--border-color);
}
.ldr-rag-status i {
@@ -285,30 +289,30 @@
.ldr-rag-status span {
font-weight: 500;
- color: #2d3748;
+ color: var(--text-primary);
}
/* Empty Value Styling */
.ldr-empty-value {
- color: #a0aec0;
+ color: var(--text-muted);
font-style: italic;
font-size: 0.9rem;
}
/* Content Preview */
.ldr-content-preview {
- background: linear-gradient(135deg, #2d3748, #1a202c);
- color: #f7fafc;
+ background: var(--bg-primary);
+ color: var(--text-primary);
padding: 20px;
border-radius: 12px;
- border-left: 4px solid #667eea;
+ border-left: 4px solid var(--accent-primary);
white-space: pre-wrap;
font-family: 'Courier New', monospace;
font-size: 0.9rem;
max-height: 400px;
overflow-y: auto;
margin-top: 15px;
- box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.3);
+ box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.2);
}
.ldr-content-preview::-webkit-scrollbar {
@@ -316,21 +320,21 @@
}
.ldr-content-preview::-webkit-scrollbar-track {
- background: #4a5568;
+ background: var(--bg-tertiary);
border-radius: 10px;
}
.ldr-content-preview::-webkit-scrollbar-thumb {
- background: linear-gradient(135deg, #667eea, #764ba2);
+ background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
border-radius: 10px;
}
/* Source URL Section */
.ldr-metadata-section .ldr-metadata-value {
- background: linear-gradient(135deg, #f7fafc, #edf2f7);
+ background: var(--bg-tertiary);
padding: 15px;
border-radius: 8px;
- border: 1px solid #e2e8f0;
+ border: 1px solid var(--border-color);
word-break: break-all;
}
@@ -409,74 +413,3 @@
font-size: 1.3rem;
}
}
-
-/* Dark Theme Support */
-@media (prefers-color-scheme: dark) {
- .ldr-document-details-container {
- background: linear-gradient(135deg, #2d3748 0%, #1a202c 100%);
- }
-
- .ldr-document-header,
- .ldr-metadata-section {
- background: rgba(45, 55, 72, 0.95);
- color: #f7fafc;
- }
-
- .ldr-document-title {
- background: linear-gradient(135deg, #9f7aea, #667eea);
- -webkit-background-clip: text;
- -webkit-text-fill-color: transparent;
- background-clip: text;
- }
-
- .ldr-document-subtitle {
- color: #cbd5e0;
- }
-
- .ldr-metadata-section h2 {
- color: #f7fafc;
- border-bottom-color: #4a5568;
- }
-
- .ldr-metadata-item {
- background: linear-gradient(135deg, #2d3748, #1a202c);
- border-color: #4a5568;
- }
-
- .ldr-metadata-label {
- color: #cbd5e0;
- }
-
- .ldr-metadata-value {
- color: #f7fafc;
- }
-
- .ldr-metadata-value code {
- background: #1a202c;
- color: #f7fafc;
- border: 1px solid #4a5568;
- }
-
- .ldr-rag-status {
- background: linear-gradient(135deg, #2d3748, #1a202c);
- border-color: #4a5568;
- }
-
- .ldr-rag-status span {
- color: #f7fafc;
- }
-
- .ldr-empty-value {
- color: #718096;
- }
-
- .ldr-authors-list li {
- background: linear-gradient(135deg, #4a5568, #2d3748);
- color: #cbd5e0;
- }
-
- .ldr-metadata-section .ldr-metadata-value {
- background: linear-gradient(135deg, #2d3748, #1a202c);
- border-color: #4a5568;
- }
-}
diff --git a/src/local_deep_research/web/static/css/mobile-navigation.css b/src/local_deep_research/web/static/css/mobile-navigation.css
index 71a8348bb1..488ef34049 100644
--- a/src/local_deep_research/web/static/css/mobile-navigation.css
+++ b/src/local_deep_research/web/static/css/mobile-navigation.css
@@ -71,7 +71,7 @@
/* Tab hover/focus states */
.ldr-mobile-nav-tab:hover,
.ldr-mobile-nav-tab:focus {
- background: rgba(110, 79, 246, 0.1);
+ background: rgba(var(--accent-primary-rgb), 0.1);
outline: none;
}
@@ -232,7 +232,7 @@
.ldr-mobile-sheet-item:hover,
.ldr-mobile-sheet-item:focus {
- background: rgba(110, 79, 246, 0.1);
+ background: rgba(var(--accent-primary-rgb), 0.1);
outline: none;
}
@@ -242,7 +242,7 @@
}
.ldr-mobile-sheet-item:active {
- background: rgba(110, 79, 246, 0.2);
+ background: rgba(var(--accent-primary-rgb), 0.2);
}
/* Sheet item icon */
@@ -280,7 +280,7 @@
left: 0;
right: 0;
bottom: 0;
- background: rgba(0, 0, 0, 0.5);
+ background: var(--overlay-color);
opacity: 0;
pointer-events: none;
transition: opacity var(--mobile-transition);
@@ -510,7 +510,7 @@
}
/* ========================================
- Dark mode adjustments
+ Theme-specific mobile navigation styles
======================================== */
[data-theme="light"] {
--mobile-nav-bg: #f5f5f5;
@@ -519,3 +519,33 @@
--mobile-sheet-bg: #fff;
--mobile-sheet-handle: #ccc;
}
+
+[data-theme="sepia"] {
+ --mobile-nav-bg: #f4ecd8;
+ --mobile-nav-border: #d4c4a8;
+ --mobile-nav-text: #7a6f5a;
+ --mobile-nav-active: #8b6914;
+ --mobile-nav-text-active: #8b6914;
+ --mobile-sheet-bg: #faf6ed;
+ --mobile-sheet-handle: #c4b89a;
+}
+
+[data-theme="high-contrast"] {
+ --mobile-nav-bg: #000000;
+ --mobile-nav-border: #ffff00;
+ --mobile-nav-text: #ffffff;
+ --mobile-nav-active: #00ffff;
+ --mobile-nav-text-active: #00ffff;
+ --mobile-sheet-bg: #000000;
+ --mobile-sheet-handle: #ffff00;
+}
+
+[data-theme="midnight"] {
+ --mobile-nav-bg: #0d1526;
+ --mobile-nav-border: #1e3a5f;
+ --mobile-nav-text: #6b8ab3;
+ --mobile-nav-active: #4a9eff;
+ --mobile-nav-text-active: #4a9eff;
+ --mobile-sheet-bg: #0a1628;
+ --mobile-sheet-handle: #2a4a70;
+}
diff --git a/src/local_deep_research/web/static/css/styles.css b/src/local_deep_research/web/static/css/styles.css
index d75e63d626..182a18fa62 100644
--- a/src/local_deep_research/web/static/css/styles.css
+++ b/src/local_deep_research/web/static/css/styles.css
@@ -13,10 +13,31 @@
--success-color: #0acf97;
--warning-color: #f9bc0b;
--error-color: #fa5c7c;
+
+ /* RGB variants for use with rgba() */
+ --bg-primary-rgb: 18, 18, 18;
+ --bg-secondary-rgb: 30, 30, 45;
+ --bg-tertiary-rgb: 42, 42, 58;
+ --accent-primary-rgb: 110, 79, 246;
+ --accent-secondary-rgb: 145, 121, 240;
+ --accent-tertiary-rgb: 64, 191, 255;
+ --text-primary-rgb: 245, 245, 245;
+ --text-secondary-rgb: 192, 192, 204;
+ --text-muted-rgb: 138, 138, 160;
+ --border-color-rgb: 52, 52, 82;
+ --success-color-rgb: 10, 207, 151;
+ --warning-color-rgb: 249, 188, 11;
+ --error-color-rgb: 250, 92, 124;
+
+ /* Shadows and effects */
--card-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
- --glow-effect: 0 0 15px rgba(110, 79, 246, 0.3);
+ --glow-effect: 0 0 15px rgba(var(--accent-primary-rgb), 0.3);
--gradient-bg: linear-gradient(135deg, #2a2a3a 0%, #1e1e2d 100%);
+ /* Overlay colors for modals/sheets */
+ --overlay-color: rgba(0, 0, 0, 0.5);
+ --backdrop-blur: blur(10px);
+
/* Aliases for commonly used variables */
--primary-color: var(--accent-primary);
--card-bg: var(--bg-secondary);
@@ -266,17 +287,54 @@ a:hover {
background-color: var(--bg-secondary);
border-bottom: 1px solid var(--border-color);
display: flex;
- justify-content: flex-end;
+ justify-content: space-between;
align-items: center;
padding: 0 2rem;
z-index: 100;
}
+.ldr-top-bar-left {
+ display: flex;
+ align-items: center;
+ gap: 0.5rem;
+}
+
.ldr-top-bar-right {
display: flex;
align-items: center;
}
+/* Theme Toggle Button */
+.ldr-theme-toggle {
+ background: transparent;
+ border: 1px solid var(--border-color);
+ color: var(--text-secondary);
+ padding: 0.5rem;
+ border-radius: 8px;
+ cursor: pointer;
+ transition: all 0.2s ease;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ width: 36px;
+ height: 36px;
+}
+
+.ldr-theme-toggle:hover {
+ background: var(--bg-tertiary);
+ color: var(--accent-primary);
+ border-color: var(--accent-primary);
+}
+
+.ldr-theme-toggle:focus {
+ outline: 2px solid var(--accent-primary);
+ outline-offset: 2px;
+}
+
+.ldr-theme-toggle i {
+ font-size: 1rem;
+}
+
.ldr-user-menu {
display: flex;
align-items: center;
diff --git a/src/local_deep_research/web/static/css/themes.css b/src/local_deep_research/web/static/css/themes.css
new file mode 100644
index 0000000000..8a18b0ff2c
--- /dev/null
+++ b/src/local_deep_research/web/static/css/themes.css
@@ -0,0 +1,292 @@
+/* ====================================
+ THEME DEFINITIONS
+ Local Deep Research Multi-Theme System
+ ==================================== */
+
+/* Dark Theme (Default) - Purple accent on dark background */
+:root,
+[data-theme="dark"] {
+ --bg-primary: #121212;
+ --bg-secondary: #1e1e2d;
+ --bg-tertiary: #2a2a3a;
+ --accent-primary: #6e4ff6;
+ --accent-secondary: #9179f0;
+ --accent-tertiary: #40bfff;
+ --text-primary: #f5f5f5;
+ --text-secondary: #c0c0cc;
+ --text-muted: #8a8aa0;
+ --border-color: #343452;
+ --success-color: #0acf97;
+ --warning-color: #f9bc0b;
+ --error-color: #fa5c7c;
+
+ /* RGB variants for rgba() usage */
+ --bg-primary-rgb: 18, 18, 18;
+ --bg-secondary-rgb: 30, 30, 45;
+ --bg-tertiary-rgb: 42, 42, 58;
+ --accent-primary-rgb: 110, 79, 246;
+ --accent-secondary-rgb: 145, 121, 240;
+ --accent-tertiary-rgb: 64, 191, 255;
+ --text-primary-rgb: 245, 245, 245;
+ --text-secondary-rgb: 192, 192, 204;
+ --text-muted-rgb: 138, 138, 160;
+ --border-color-rgb: 52, 52, 82;
+ --success-color-rgb: 10, 207, 151;
+ --warning-color-rgb: 249, 188, 11;
+ --error-color-rgb: 250, 92, 124;
+
+ /* Shadows and effects */
+ --card-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
+ --glow-effect: 0 0 15px rgba(110, 79, 246, 0.3);
+ --gradient-bg: linear-gradient(135deg, #2a2a3a 0%, #1e1e2d 100%);
+ --overlay-color: rgba(0, 0, 0, 0.5);
+ --backdrop-blur: blur(10px);
+
+ /* Aliases */
+ --primary-color: var(--accent-primary);
+ --card-bg: var(--bg-secondary);
+}
+
+/* Light Theme - Clean and bright */
+[data-theme="light"] {
+ --bg-primary: #f8f9fa;
+ --bg-secondary: #ffffff;
+ --bg-tertiary: #e9ecef;
+ --accent-primary: #5c3dcc;
+ --accent-secondary: #7c5ce7;
+ --accent-tertiary: #0984e3;
+ --text-primary: #212529;
+ --text-secondary: #495057;
+ --text-muted: #6c757d;
+ --border-color: #dee2e6;
+ --success-color: #28a745;
+ --warning-color: #ffc107;
+ --error-color: #dc3545;
+
+ /* RGB variants */
+ --bg-primary-rgb: 248, 249, 250;
+ --bg-secondary-rgb: 255, 255, 255;
+ --bg-tertiary-rgb: 233, 236, 239;
+ --accent-primary-rgb: 92, 61, 204;
+ --accent-secondary-rgb: 124, 92, 231;
+ --accent-tertiary-rgb: 9, 132, 227;
+ --text-primary-rgb: 33, 37, 41;
+ --text-secondary-rgb: 73, 80, 87;
+ --text-muted-rgb: 108, 117, 125;
+ --border-color-rgb: 222, 226, 230;
+ --success-color-rgb: 40, 167, 69;
+ --warning-color-rgb: 255, 193, 7;
+ --error-color-rgb: 220, 53, 69;
+
+ /* Shadows and effects */
+ --card-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
+ --glow-effect: 0 0 10px rgba(92, 61, 204, 0.15);
+ --gradient-bg: linear-gradient(135deg, #e9ecef 0%, #f8f9fa 100%);
+ --overlay-color: rgba(0, 0, 0, 0.4);
+ --backdrop-blur: blur(10px);
+
+ /* Aliases */
+ --primary-color: var(--accent-primary);
+ --card-bg: var(--bg-secondary);
+}
+
+/* Sepia Theme - Eye-friendly reading (Solarized-inspired) */
+[data-theme="sepia"] {
+ --bg-primary: #f4ecd8;
+ --bg-secondary: #fdf6e3;
+ --bg-tertiary: #eee8d5;
+ --accent-primary: #b58900;
+ --accent-secondary: #cb4b16;
+ --accent-tertiary: #268bd2;
+ --text-primary: #5c5144;
+ --text-secondary: #657b83;
+ --text-muted: #93a1a1;
+ --border-color: #d3c6a6;
+ --success-color: #859900;
+ --warning-color: #b58900;
+ --error-color: #dc322f;
+
+ /* RGB variants */
+ --bg-primary-rgb: 244, 236, 216;
+ --bg-secondary-rgb: 253, 246, 227;
+ --bg-tertiary-rgb: 238, 232, 213;
+ --accent-primary-rgb: 181, 137, 0;
+ --accent-secondary-rgb: 203, 75, 22;
+ --accent-tertiary-rgb: 38, 139, 210;
+ --text-primary-rgb: 92, 81, 68;
+ --text-secondary-rgb: 101, 123, 131;
+ --text-muted-rgb: 147, 161, 161;
+ --border-color-rgb: 211, 198, 166;
+ --success-color-rgb: 133, 153, 0;
+ --warning-color-rgb: 181, 137, 0;
+ --error-color-rgb: 220, 50, 47;
+
+ /* Shadows and effects */
+ --card-shadow: 0 2px 10px rgba(101, 82, 51, 0.1);
+ --glow-effect: 0 0 10px rgba(181, 137, 0, 0.15);
+ --gradient-bg: linear-gradient(135deg, #eee8d5 0%, #f4ecd8 100%);
+ --overlay-color: rgba(92, 81, 68, 0.4);
+ --backdrop-blur: blur(10px);
+
+ /* Aliases */
+ --primary-color: var(--accent-primary);
+ --card-bg: var(--bg-secondary);
+}
+
+/* High Contrast Theme - Maximum accessibility (WCAG AAA) */
+[data-theme="high-contrast"] {
+ --bg-primary: #000000;
+ --bg-secondary: #0a0a0a;
+ --bg-tertiary: #1a1a1a;
+ --accent-primary: #ffff00;
+ --accent-secondary: #00ffff;
+ --accent-tertiary: #00ff00;
+ --text-primary: #ffffff;
+ --text-secondary: #e0e0e0;
+ --text-muted: #c0c0c0;
+ --border-color: #ffffff;
+ --success-color: #00ff00;
+ --warning-color: #ffff00;
+ --error-color: #ff0000;
+
+ /* RGB variants */
+ --bg-primary-rgb: 0, 0, 0;
+ --bg-secondary-rgb: 10, 10, 10;
+ --bg-tertiary-rgb: 26, 26, 26;
+ --accent-primary-rgb: 255, 255, 0;
+ --accent-secondary-rgb: 0, 255, 255;
+ --accent-tertiary-rgb: 0, 255, 0;
+ --text-primary-rgb: 255, 255, 255;
+ --text-secondary-rgb: 224, 224, 224;
+ --text-muted-rgb: 192, 192, 192;
+ --border-color-rgb: 255, 255, 255;
+ --success-color-rgb: 0, 255, 0;
+ --warning-color-rgb: 255, 255, 0;
+ --error-color-rgb: 255, 0, 0;
+
+ /* Shadows and effects - minimal for clarity */
+ --card-shadow: 0 0 0 2px #ffffff;
+ --glow-effect: none;
+ --gradient-bg: none;
+ --overlay-color: rgba(0, 0, 0, 0.8);
+ --backdrop-blur: none;
+
+ /* Aliases */
+ --primary-color: var(--accent-primary);
+ --card-bg: var(--bg-secondary);
+}
+
+/* Midnight Blue Theme - Deep blue aesthetic */
+[data-theme="midnight"] {
+ --bg-primary: #0d1b2a;
+ --bg-secondary: #1b263b;
+ --bg-tertiary: #2b3a50;
+ --accent-primary: #e0e1dd;
+ --accent-secondary: #778da9;
+ --accent-tertiary: #415a77;
+ --text-primary: #e0e1dd;
+ --text-secondary: #c5c6c7;
+ --text-muted: #778da9;
+ --border-color: #415a77;
+ --success-color: #57cc99;
+ --warning-color: #fca311;
+ --error-color: #e71d36;
+
+ /* RGB variants */
+ --bg-primary-rgb: 13, 27, 42;
+ --bg-secondary-rgb: 27, 38, 59;
+ --bg-tertiary-rgb: 43, 58, 80;
+ --accent-primary-rgb: 224, 225, 221;
+ --accent-secondary-rgb: 119, 141, 169;
+ --accent-tertiary-rgb: 65, 90, 119;
+ --text-primary-rgb: 224, 225, 221;
+ --text-secondary-rgb: 197, 198, 199;
+ --text-muted-rgb: 119, 141, 169;
+ --border-color-rgb: 65, 90, 119;
+ --success-color-rgb: 87, 204, 153;
+ --warning-color-rgb: 252, 163, 17;
+ --error-color-rgb: 231, 29, 54;
+
+ /* Shadows and effects */
+ --card-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
+ --glow-effect: 0 0 15px rgba(119, 141, 169, 0.2);
+ --gradient-bg: linear-gradient(135deg, #1b263b 0%, #0d1b2a 100%);
+ --overlay-color: rgba(13, 27, 42, 0.7);
+ --backdrop-blur: blur(10px);
+
+ /* Aliases */
+ --primary-color: var(--accent-primary);
+ --card-bg: var(--bg-secondary);
+}
+
+/* ====================================
+ THEME-SPECIFIC ADJUSTMENTS
+ ==================================== */
+
+/* High Contrast: Ensure links are visible */
+[data-theme="high-contrast"] a {
+ color: var(--accent-secondary);
+ text-decoration: underline;
+}
+
+[data-theme="high-contrast"] a:hover {
+ color: var(--accent-tertiary);
+}
+
+/* High Contrast: Stronger focus indicators */
+[data-theme="high-contrast"] *:focus {
+ outline: 3px solid var(--accent-primary) !important;
+ outline-offset: 2px;
+}
+
+/* High Contrast: Clearer button states */
+[data-theme="high-contrast"] button:hover,
+[data-theme="high-contrast"] .btn:hover {
+ background: var(--accent-primary) !important;
+ color: var(--bg-primary) !important;
+}
+
+/* Sepia: Softer link colors */
+[data-theme="sepia"] a {
+ color: var(--accent-tertiary);
+}
+
+[data-theme="sepia"] a:hover {
+ color: var(--accent-secondary);
+}
+
+/* Light theme: Adjust scrollbar colors */
+[data-theme="light"] ::-webkit-scrollbar-track {
+ background: var(--bg-tertiary);
+}
+
+[data-theme="light"] ::-webkit-scrollbar-thumb {
+ background: var(--accent-primary);
+}
+
+/* ====================================
+ TRANSITION FOR THEME SWITCHING
+ ==================================== */
+
+/* Smooth color transitions when switching themes */
+@media (prefers-reduced-motion: no-preference) {
+ html {
+ transition: background-color 0.3s ease, color 0.3s ease;
+ }
+
+ body,
+ .ldr-sidebar,
+ .ldr-main-content,
+ .ldr-card,
+ .ldr-rag-section,
+ .ldr-rag-header {
+ transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
+ }
+}
+
+/* Disable transitions for users who prefer reduced motion */
+@media (prefers-reduced-motion: reduce) {
+ * {
+ transition: none !important;
+ }
+}
diff --git a/src/local_deep_research/web/static/js/components/settings_sync.js b/src/local_deep_research/web/static/js/components/settings_sync.js
index 80c5f9c8aa..71cf2913cb 100644
--- a/src/local_deep_research/web/static/js/components/settings_sync.js
+++ b/src/local_deep_research/web/static/js/components/settings_sync.js
@@ -150,6 +150,22 @@ function connectMenuSettings() {
});
}
+ // Handle theme dropdown changes
+ // Try multiple selectors to find the theme select element
+ const themeSelect = document.querySelector('select[data-key="app.theme"], select[name="app.theme"], #theme-select');
+ if (themeSelect) {
+ themeSelect.addEventListener('change', function(e) {
+ console.log('Theme changed to:', this.value);
+ // Use themeService if available (handles both UI update and server sync)
+ if (window.themeService && typeof window.themeService.setTheme === 'function') {
+ window.themeService.setTheme(this.value, true);
+ } else {
+ // Fallback: just save to server
+ saveMenuSettings('app.theme', this.value);
+ }
+ });
+ }
+
console.log('Menu settings handlers initialized');
}
diff --git a/src/local_deep_research/web/static/js/main.js b/src/local_deep_research/web/static/js/main.js
index 25fb3f2b0a..c72737ce98 100644
--- a/src/local_deep_research/web/static/js/main.js
+++ b/src/local_deep_research/web/static/js/main.js
@@ -165,33 +165,8 @@
document.addEventListener('click', requestNotificationPermission, { once: true });
}
- // Initialize theme toggle
- const themeToggle = document.getElementById('theme-toggle');
- if (themeToggle) {
- // Check for saved theme preference or use system preference
- const savedTheme = localStorage.getItem('theme');
- const systemDarkMode = window.matchMedia('(prefers-color-scheme: dark)').matches;
- const isDarkMode = savedTheme === 'dark' || (savedTheme === null && systemDarkMode);
-
- // Set initial theme
- document.documentElement.setAttribute('data-theme', isDarkMode ? 'dark' : 'light');
- themeToggle.innerHTML = isDarkMode ?
- '<i class="fas fa-sun"></i>' :
- '<i class="fas fa-moon"></i>';
-
- // Listen for theme toggle click
- themeToggle.addEventListener('click', function() {
- const currentTheme = document.documentElement.getAttribute('data-theme');
- const newTheme = currentTheme === 'dark' ? 'light' : 'dark';
-
- document.documentElement.setAttribute('data-theme', newTheme);
- localStorage.setItem('theme', newTheme);
-
- themeToggle.innerHTML = newTheme === 'dark' ?
- '<i class="fas fa-sun"></i>' :
- '<i class="fas fa-moon"></i>';
- });
- }
+ // Theme toggle is now handled by themeService (services/theme.js)
+ // which provides multi-theme support, server sync, and user-scoped localStorage
// Initialize mobile menu toggle
const mobileMenuToggle = document.getElementById('mobile-menu-toggle');
diff --git a/src/local_deep_research/web/static/js/services/theme.js b/src/local_deep_research/web/static/js/services/theme.js
new file mode 100644
index 0000000000..b2fb145327
--- /dev/null
+++ b/src/local_deep_research/web/static/js/services/theme.js
@@ -0,0 +1,315 @@
+/**
+ * Theme Service
+ * Handles theme switching, persistence, and sync with user account
+ *
+ * Features:
+ * - User-prefixed localStorage key to prevent cross-user theme bleeding
+ * - Server sync via settings API
+ * - System preference detection and listener
+ * - Quick toggle cycling through themes
+ *
+ * Security note: This file only uses internal API endpoints (/settings/api/...)
+ * and does not handle external URLs. URLValidator is not required.
+ * @url-security-exempt internal-api-only
+ */
+(function() {
+ 'use strict';
+
+ const STORAGE_KEY_PREFIX = 'ldr-theme';
+ const SETTING_KEY = 'app.theme';
+
+ // Available themes (must match CSS definitions in themes.css)
+ const THEMES = {
+ 'dark': { label: 'Dark', icon: 'fa-moon' },
+ 'light': { label: 'Light', icon: 'fa-sun' },
+ 'sepia': { label: 'Sepia', icon: 'fa-book-open' },
+ 'high-contrast': { label: 'High Contrast', icon: 'fa-eye' },
+ 'midnight': { label: 'Midnight', icon: 'fa-cloud-moon' },
+ 'system': { label: 'System', icon: 'fa-desktop' }
+ };
+
+ // Theme cycle order for quick toggle button
+ const THEME_CYCLE = ['dark', 'light', 'sepia'];
+
+ /**
+ * Get user ID from page context (if available)
+ * Falls back to 'anonymous' for logged-out users
+ */
+ function getUserId() {
+ // Try to get user ID from meta tag or data attribute
+ const userMeta = document.querySelector('meta[name="user-id"]');
+ if (userMeta) {
+ return userMeta.getAttribute('content');
+ }
+
+ // Try to get from body data attribute
+ const body = document.body;
+ if (body && body.dataset.userId) {
+ return body.dataset.userId;
+ }
+
+ // Fallback for anonymous users
+ return 'anonymous';
+ }
+
+ /**
+ * Get the localStorage key for current user
+ */
+ function getStorageKey() {
+ const userId = getUserId();
+ return `${STORAGE_KEY_PREFIX}-${userId}`;
+ }
+
+ /**
+ * Get the effective theme (resolving 'system' to actual value)
+ */
+ function getEffectiveTheme(theme) {
+ if (theme === 'system') {
+ return window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';
+ }
+ return theme;
+ }
+
+ /**
+ * Get current theme from localStorage or default
+ */
+ function getCurrentTheme() {
+ const storageKey = getStorageKey();
+ return localStorage.getItem(storageKey) || 'dark';
+ }
+
+ /**
+ * Apply theme to document
+ */
+ function applyTheme(theme) {
+ const effectiveTheme = getEffectiveTheme(theme);
+ document.documentElement.setAttribute('data-theme', effectiveTheme);
+
+ // Store raw theme preference (including 'system')
+ const storageKey = getStorageKey();
+ localStorage.setItem(storageKey, theme);
+
+ // Update any theme toggle buttons
+ updateThemeToggles(theme, effectiveTheme);
+
+ // Dispatch event for other components
+ window.dispatchEvent(new CustomEvent('themechange', {
+ detail: { theme, effectiveTheme }
+ }));
+
+ console.log(`Theme applied: ${theme} (effective: ${effectiveTheme})`);
+ }
+
+ /**
+ * Save theme to user account via settings API
+ */
+ function saveThemeToServer(theme) {
+ const csrfToken = document.querySelector('meta[name="csrf-token"]')?.getAttribute('content');
+ if (!csrfToken) {
+ console.warn('CSRF token not found, cannot save theme to server');
+ return Promise.resolve();
+ }
+
+ return fetch(`/settings/api/${SETTING_KEY}`, {
+ method: 'PUT',
+ headers: {
+ 'Content-Type': 'application/json',
+ 'X-CSRFToken': csrfToken
+ },
+ body: JSON.stringify({ value: theme })
+ })
+ .then(response => {
+ if (!response.ok) throw new Error(`HTTP ${response.status}`);
+ return response.json();
+ })
+ .then(data => {
+ console.log('Theme saved to server:', theme);
+ })
+ .catch(error => {
+ console.warn('Could not save theme to server (user may not be logged in):', error.message);
+ });
+ }
+
+ /**
+ * Load theme from server (on page load)
+ */
+ function loadThemeFromServer() {
+ return fetch(`/settings/api/${SETTING_KEY}`)
+ .then(response => {
+ if (!response.ok) throw new Error(`HTTP ${response.status}`);
+ return response.json();
+ })
+ .then(data => {
+ if (data && data.value) {
+ return data.value;
+ }
+ return null;
+ })
+ .catch(error => {
+ console.warn('Could not load theme from server:', error.message);
+ return null;
+ });
+ }
+
+ /**
+ * Set theme with both local and server sync
+ */
+ function setTheme(theme, syncToServer = true) {
+ // Validate theme
+ if (!THEMES[theme]) {
+ console.warn('Invalid theme:', theme);
+ theme = 'dark';
+ }
+
+ applyTheme(theme);
+
+ if (syncToServer) {
+ saveThemeToServer(theme);
+ }
+ }
+
+ /**
+ * Cycle to next theme (for quick toggle button)
+ */
+ function cycleTheme() {
+ const current = getCurrentTheme();
+ let currentIndex = THEME_CYCLE.indexOf(current);
+
+ // If current theme is not in cycle (e.g., high-contrast), start from beginning
+ if (currentIndex === -1) {
+ currentIndex = -1;
+ }
+
+ const nextIndex = (currentIndex + 1) % THEME_CYCLE.length;
+ const nextTheme = THEME_CYCLE[nextIndex];
+ setTheme(nextTheme);
+ return nextTheme;
+ }
+
+ /**
+ * Update theme toggle button UI
+ */
+ function updateThemeToggles(rawTheme, effectiveTheme) {
+ // Update quick toggle button in nav
+ const quickToggle = document.getElementById('theme-toggle');
+ if (quickToggle) {
+ // Show icon for CURRENT theme (what's active now)
+ const currentIcon = THEMES[effectiveTheme]?.icon || 'fa-palette';
+ quickToggle.innerHTML = `<i class="fas ${currentIcon}"></i>`;
+
+ // Set tooltip for next theme in cycle
+ const nextIndex = (THEME_CYCLE.indexOf(rawTheme) + 1) % THEME_CYCLE.length;
+ const nextTheme = THEME_CYCLE[nextIndex] || 'dark';
+ quickToggle.setAttribute('title', `Switch to ${THEMES[nextTheme]?.label || nextTheme} theme`);
+ quickToggle.setAttribute('aria-label', `Current theme: ${THEMES[rawTheme]?.label || rawTheme}. Click to switch.`);
+ }
+
+ // Update theme selector dropdown if on settings page
+ const themeSelector = document.querySelector('select[data-key="app.theme"], #theme-select, select[name="app.theme"]');
+ if (themeSelector && themeSelector.value !== rawTheme) {
+ themeSelector.value = rawTheme;
+ }
+ }
+
+ /**
+ * Listen for system theme changes
+ */
+ function setupSystemThemeListener() {
+ const mediaQuery = window.matchMedia('(prefers-color-scheme: dark)');
+
+ mediaQuery.addEventListener('change', (e) => {
+ const currentTheme = getCurrentTheme();
+ if (currentTheme === 'system') {
+ console.log('System theme changed, updating...');
+ applyTheme('system');
+ }
+ });
+ }
+
+ /**
+ * Clear theme from localStorage (for logout)
+ */
+ function clearTheme() {
+ const storageKey = getStorageKey();
+ localStorage.removeItem(storageKey);
+
+ // Also clear anonymous key if exists
+ localStorage.removeItem(`${STORAGE_KEY_PREFIX}-anonymous`);
+
+ console.log('Theme cleared from localStorage');
+ }
+
+ /**
+ * Clear ALL theme keys from localStorage (for full cleanup)
+ */
+ function clearAllThemes() {
+ const keysToRemove = [];
+ for (let i = 0; i < localStorage.length; i++) {
+ const key = localStorage.key(i);
+ if (key && key.startsWith(STORAGE_KEY_PREFIX)) {
+ keysToRemove.push(key);
+ }
+ }
+ keysToRemove.forEach(key => localStorage.removeItem(key));
+ console.log('All theme keys cleared:', keysToRemove);
+ }
+
+ /**
+ * Initialize theme on page load
+ */
+ function initializeTheme() {
+ // Apply stored theme immediately (FOUC should already be handled in head)
+ const storedTheme = getCurrentTheme();
+ applyTheme(storedTheme);
+
+ // Try to load from server and sync (for logged-in users)
+ loadThemeFromServer().then(serverTheme => {
+ if (serverTheme && serverTheme !== storedTheme) {
+ console.log('Server has different theme, syncing:', serverTheme);
+ applyTheme(serverTheme);
+ // Update localStorage with server value
+ const storageKey = getStorageKey();
+ localStorage.setItem(storageKey, serverTheme);
+ }
+ });
+
+ // Set up system preference listener
+ setupSystemThemeListener();
+
+ // Set up quick toggle button
+ const quickToggle = document.getElementById('theme-toggle');
+ if (quickToggle) {
+ quickToggle.addEventListener('click', (e) => {
+ e.preventDefault();
+ cycleTheme();
+ });
+ updateThemeToggles(storedTheme, getEffectiveTheme(storedTheme));
+ }
+
+ console.log('Theme service initialized');
+ }
+
+ // Expose API globally
+ window.themeService = {
+ THEMES,
+ THEME_CYCLE,
+ getCurrentTheme,
+ getEffectiveTheme,
+ setTheme,
+ cycleTheme,
+ loadThemeFromServer,
+ saveThemeToServer,
+ clearTheme,
+ clearAllThemes,
+ initializeTheme,
+ applyTheme
+ };
+
+ // Initialize when DOM is ready
+ if (document.readyState === 'loading') {
+ document.addEventListener('DOMContentLoaded', initializeTheme);
+ } else {
+ // DOM already loaded, initialize immediately
+ initializeTheme();
+ }
+})();
diff --git a/src/local_deep_research/web/templates/auth/login.html b/src/local_deep_research/web/templates/auth/login.html
index 2840f4f83e..f0b5eb7ce5 100644
--- a/src/local_deep_research/web/templates/auth/login.html
+++ b/src/local_deep_research/web/templates/auth/login.html
@@ -404,5 +404,30 @@
</div>
</div>
+
+ <!-- Clear theme localStorage on logout to prevent cross-user theme bleeding -->
+ <script>
+ (function() {
+ // Check if user was just logged out (via flash message or URL parameter)
+ var wasLoggedOut = {{ 'true' if session.get('just_logged_out') else 'false' }};
+ var urlParams = new URLSearchParams(window.location.search);
+ if (wasLoggedOut || urlParams.has('logged_out')) {
+ // Clear all theme keys from localStorage
+ var keysToRemove = [];
+ for (var i = 0; i < localStorage.length; i++) {
+ var key = localStorage.key(i);
+ if (key && key.startsWith('ldr-theme')) {
+ keysToRemove.push(key);
+ }
+ }
+ keysToRemove.forEach(function(key) {
+ localStorage.removeItem(key);
+ });
+ if (keysToRemove.length > 0) {
+ console.log('Theme localStorage cleared on logout');
+ }
+ }
+ })();
+ </script>
</body>
</html>
diff --git a/src/local_deep_research/web/templates/base.html b/src/local_deep_research/web/templates/base.html
index f2f993c6d7..77a8e27e89 100644
--- a/src/local_deep_research/web/templates/base.html
+++ b/src/local_deep_research/web/templates/base.html
@@ -1,17 +1,35 @@
<!DOCTYPE html>
-<html lang="en">
+<html lang="en" data-theme="dark">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="csrf-token" content="{{ csrf_token() }}">
<title>{% block title %}Deep Research System{% endblock %}</title>
<link rel="icon" type="image/png" href="/static/favicon.png">
+
+ <!-- FOUC Prevention: Apply theme before any rendering -->
+ <script>
+ (function() {
+ var userId = '{{ session.username|default("anonymous", true) }}';
+ var storageKey = 'ldr-theme-' + userId;
+ var theme = localStorage.getItem(storageKey) || 'dark';
+ var effectiveTheme = theme;
+ if (theme === 'system') {
+ effectiveTheme = window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';
+ }
+ document.documentElement.setAttribute('data-theme', effectiveTheme);
+ })();
+ </script>
+
<!-- Vite HMR for development -->
{{ vite_hmr() }}
<!-- Load all vendor dependencies and styles through Vite -->
{{ vite_asset('js/app.js') }}
+ <!-- Theme definitions must load before main styles -->
+ <link rel="stylesheet" href="/static/css/themes.css">
+
<!-- Keep local styles that aren't in npm packages -->
<link rel="stylesheet" href="/static/css/styles.css">
<link rel="stylesheet" href="/static/css/help-system.css">
@@ -57,6 +75,13 @@
<main class="ldr-main-content">
{% if session.username %}
<div class="ldr-top-bar">
+ <div class="ldr-top-bar-left">
+ <!-- Theme quick toggle -->
+ <button type="button" id="theme-toggle" class="ldr-theme-toggle"
+ title="Toggle theme" aria-label="Toggle color theme">
+ <i class="fas fa-moon"></i>
+ </button>
+ </div>
<div class="ldr-top-bar-right">
<div class="ldr-user-menu">
<span class="ldr-user-info">
@@ -106,6 +131,7 @@
<!-- All vendor libraries are now loaded through Vite in the <head> section -->
<!-- Core JS -->
+ <script src="/static/js/services/theme.js"></script>
<script src="/static/js/services/formatting.js"></script>
<script src="/static/js/services/ui.js"></script>
<script src="/static/js/services/api.js"></script>