fraudTech commited on
Commit
01c7609
·
1 Parent(s): c68b678

light theme created

Browse files
Files changed (4) hide show
  1. web/index.html +3 -0
  2. web/src/App.css +84 -0
  3. web/src/App.tsx +92 -3
  4. web/src/index.css +2 -2
web/index.html CHANGED
@@ -10,6 +10,9 @@
10
  <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
11
  <link href="https://fonts.googleapis.com/css2?family=Michroma&display=swap" rel="stylesheet">
12
  <title>EVO - Logical AI</title>
 
 
 
13
  </head>
14
  <body>
15
  <div id="root"></div>
 
10
  <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
11
  <link href="https://fonts.googleapis.com/css2?family=Michroma&display=swap" rel="stylesheet">
12
  <title>EVO - Logical AI</title>
13
+ <script>
14
+ (function(){try{var t=localStorage.getItem('evo_theme');if(t==='light')document.documentElement.dataset.theme='light';}catch(e){}})();
15
+ </script>
16
  </head>
17
  <body>
18
  <div id="root"></div>
web/src/App.css CHANGED
@@ -43,6 +43,65 @@
43
  --radius-xl: 20px;
44
  }
45
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
46
  html, body, #root {
47
  height: 100%;
48
  overflow: hidden;
@@ -349,6 +408,31 @@ body {
349
 
350
  .user-logout-btn:hover { color: var(--error); }
351
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
352
  /* ====== MAIN AREA ====== */
353
 
354
  .main {
 
43
  --radius-xl: 20px;
44
  }
45
 
46
+ /* ====== LIGHT THEME ====== */
47
+
48
+ html[data-theme="light"] {
49
+ --bg-primary: #f5f5f5;
50
+ --bg-secondary: #ffffff;
51
+ --bg-tertiary: #efefef;
52
+ --bg-hover: #e5e5e5;
53
+ --border: #dcdcdc;
54
+ --border-light: #c8c8c8;
55
+
56
+ --text-primary: #1a1a1a;
57
+ --text-secondary:#555555;
58
+ --text-muted: #909090;
59
+
60
+ --accent: #0d9488;
61
+ --accent-hover: #0f766e;
62
+ --accent-light: rgba(13,148,136,0.10);
63
+ --accent-glow: rgba(13,148,136,0.20);
64
+
65
+ --success: #059669;
66
+ --success-bg: rgba(5,150,105,0.10);
67
+ --error: #dc2626;
68
+ --error-bg: rgba(220,38,38,0.10);
69
+ --warn: #d97706;
70
+ --warn-bg: rgba(217,119,6,0.10);
71
+
72
+ color-scheme: light;
73
+ }
74
+
75
+ html[data-theme="light"] body {
76
+ background: var(--bg-primary);
77
+ color: var(--text-primary);
78
+ }
79
+
80
+ html[data-theme="light"] #root {
81
+ background: var(--bg-primary);
82
+ }
83
+
84
+ html[data-theme="light"] .message-content code {
85
+ color: #b45309;
86
+ }
87
+
88
+ html[data-theme="light"] .message-content a {
89
+ color: #0d9488;
90
+ }
91
+
92
+ html[data-theme="light"] .message-content a:hover {
93
+ color: #0f766e;
94
+ }
95
+
96
+ html[data-theme="light"] .reasoning-content {
97
+ background: rgba(0,0,0,0.04);
98
+ }
99
+
100
+ html[data-theme="light"] .tool-output,
101
+ html[data-theme="light"] .tool-code {
102
+ color: var(--text-secondary);
103
+ }
104
+
105
  html, body, #root {
106
  height: 100%;
107
  overflow: hidden;
 
408
 
409
  .user-logout-btn:hover { color: var(--error); }
410
 
411
+ .theme-toggle-btn {
412
+ display: flex;
413
+ align-items: center;
414
+ gap: 8px;
415
+ width: 100%;
416
+ padding: 7px 10px;
417
+ border-radius: var(--radius-sm);
418
+ background: transparent;
419
+ border: 1px solid transparent;
420
+ color: var(--text-secondary);
421
+ font-size: 0.82rem;
422
+ font-family: var(--font-sans);
423
+ cursor: pointer;
424
+ transition: background 0.12s, color 0.12s, border-color 0.12s;
425
+ text-align: left;
426
+ }
427
+
428
+ .theme-toggle-btn:hover {
429
+ background: var(--bg-hover);
430
+ color: var(--text-primary);
431
+ border-color: var(--border);
432
+ }
433
+
434
+ .theme-toggle-btn svg { flex-shrink: 0; opacity: 0.8; }
435
+
436
  /* ====== MAIN AREA ====== */
437
 
438
  .main {
web/src/App.tsx CHANGED
@@ -169,6 +169,59 @@ const terminalTheme = {
169
  important: { color: '#d4a574', fontWeight: 'bold' },
170
  };
171
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
172
  const allowDataImageUrl = (url: string): string => {
173
  if (url.startsWith('data:image/')) {
174
  return url;
@@ -419,9 +472,10 @@ function segmentMath(content: string): ContentSegment[] {
419
 
420
  const mdOnlyComponents = {
421
  code({ className, children, ...props }: any) {
 
422
  const match = /language-(\w+)/.exec(className || '');
423
  return match ? (
424
- <SyntaxHighlighter style={terminalTheme as any} language={match[1]} PreTag="div" {...props}>
425
  {String(children).replace(/\n$/, '')}
426
  </SyntaxHighlighter>
427
  ) : (
@@ -523,6 +577,18 @@ function App() {
523
  });
524
  const [currentConvId, setCurrentConvId] = useState<string | null>(null);
525
 
 
 
 
 
 
 
 
 
 
 
 
 
526
  const chatPlaceholder = useMemo(
527
  () => LOGIC_SAYINGS[Math.floor(Math.random() * LOGIC_SAYINGS.length)],
528
  []
@@ -1086,6 +1152,7 @@ function App() {
1086
  }
1087
 
1088
  return (
 
1089
  <div className="app">
1090
  {/* Sidebar overlay (mobile) */}
1091
  {sidebarOpen && (
@@ -1157,6 +1224,27 @@ function App() {
1157
  <span className="model-tag model-tag--r1">Reason</span>
1158
  </button>
1159
  </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1160
  <div className="user-section">
1161
  <div className="user-avatar">{user?.name?.[0]?.toUpperCase() ?? '?'}</div>
1162
  <span className="user-name">{user?.name}</span>
@@ -1295,7 +1383,7 @@ function App() {
1295
  code({ className, children, ...props }: any) {
1296
  const match = /language-(\w+)/.exec(className || '');
1297
  return match ? (
1298
- <SyntaxHighlighter style={terminalTheme as any} language={match[1]} PreTag="div" {...props}>
1299
  {String(children).replace(/\n$/, '')}
1300
  </SyntaxHighlighter>
1301
  ) : (
@@ -1383,7 +1471,7 @@ function App() {
1383
  code({ className, children, ...props }: any) {
1384
  const match = /language-(\w+)/.exec(className || '');
1385
  return match ? (
1386
- <SyntaxHighlighter style={terminalTheme as any} language={match[1]} PreTag="div" {...props}>
1387
  {String(children).replace(/\n$/, '')}
1388
  </SyntaxHighlighter>
1389
  ) : (
@@ -1601,6 +1689,7 @@ function App() {
1601
  </div>
1602
  </main>
1603
  </div>
 
1604
  );
1605
  }
1606
 
 
169
  important: { color: '#d4a574', fontWeight: 'bold' },
170
  };
171
 
172
+ // Light syntax highlighting theme
173
+ const lightCodeTheme = {
174
+ 'code[class*="language-"]': {
175
+ color: '#383a42',
176
+ fontFamily: '"SF Mono", "Monaco", "Cascadia Code", "Consolas", monospace',
177
+ fontSize: '0.9em',
178
+ background: '#f0f0f0',
179
+ },
180
+ 'pre[class*="language-"]': {
181
+ color: '#383a42',
182
+ fontFamily: '"SF Mono", "Monaco", "Cascadia Code", "Consolas", monospace',
183
+ fontSize: '0.9em',
184
+ background: '#f0f0f0',
185
+ padding: '1rem',
186
+ margin: '0.75rem 0',
187
+ overflow: 'auto',
188
+ border: '1px solid #dcdcdc',
189
+ borderRadius: '6px',
190
+ },
191
+ comment: { color: '#a0a1a7', fontStyle: 'italic' },
192
+ prolog: { color: '#a0a1a7' },
193
+ doctype: { color: '#a0a1a7' },
194
+ cdata: { color: '#a0a1a7' },
195
+ punctuation: { color: '#383a42' },
196
+ property: { color: '#4078f2' },
197
+ tag: { color: '#e45649' },
198
+ boolean: { color: '#986801' },
199
+ number: { color: '#986801' },
200
+ constant: { color: '#4078f2' },
201
+ symbol: { color: '#4078f2' },
202
+ deleted: { color: '#e45649' },
203
+ selector: { color: '#50a14f' },
204
+ 'attr-name': { color: '#986801' },
205
+ string: { color: '#50a14f' },
206
+ char: { color: '#50a14f' },
207
+ builtin: { color: '#0184bc' },
208
+ inserted: { color: '#50a14f' },
209
+ operator: { color: '#383a42' },
210
+ entity: { color: '#986801' },
211
+ url: { color: '#0184bc' },
212
+ variable: { color: '#e45649' },
213
+ atrule: { color: '#0184bc' },
214
+ 'attr-value': { color: '#50a14f' },
215
+ function: { color: '#4078f2' },
216
+ 'class-name': { color: '#c18401' },
217
+ keyword: { color: '#a626a4', fontWeight: 'bold' },
218
+ regex: { color: '#50a14f' },
219
+ important: { color: '#e45649', fontWeight: 'bold' },
220
+ };
221
+
222
+ // Context used by out-of-component code renderers to pick the right syntax theme
223
+ const CodeThemeContext = React.createContext<object>(terminalTheme);
224
+
225
  const allowDataImageUrl = (url: string): string => {
226
  if (url.startsWith('data:image/')) {
227
  return url;
 
472
 
473
  const mdOnlyComponents = {
474
  code({ className, children, ...props }: any) {
475
+ const codeTheme = React.useContext(CodeThemeContext);
476
  const match = /language-(\w+)/.exec(className || '');
477
  return match ? (
478
+ <SyntaxHighlighter style={codeTheme as any} language={match[1]} PreTag="div" {...props}>
479
  {String(children).replace(/\n$/, '')}
480
  </SyntaxHighlighter>
481
  ) : (
 
577
  });
578
  const [currentConvId, setCurrentConvId] = useState<string | null>(null);
579
 
580
+ const [theme, setTheme] = useState<'dark' | 'light'>(() => {
581
+ return (localStorage.getItem('evo_theme') as 'dark' | 'light') || 'dark';
582
+ });
583
+
584
+ useEffect(() => {
585
+ document.documentElement.dataset.theme = theme;
586
+ localStorage.setItem('evo_theme', theme);
587
+ }, [theme]);
588
+
589
+ const toggleTheme = () => setTheme(t => t === 'dark' ? 'light' : 'dark');
590
+ const codeTheme = theme === 'dark' ? terminalTheme : lightCodeTheme;
591
+
592
  const chatPlaceholder = useMemo(
593
  () => LOGIC_SAYINGS[Math.floor(Math.random() * LOGIC_SAYINGS.length)],
594
  []
 
1152
  }
1153
 
1154
  return (
1155
+ <CodeThemeContext.Provider value={codeTheme}>
1156
  <div className="app">
1157
  {/* Sidebar overlay (mobile) */}
1158
  {sidebarOpen && (
 
1224
  <span className="model-tag model-tag--r1">Reason</span>
1225
  </button>
1226
  </div>
1227
+ <button className="theme-toggle-btn" onClick={toggleTheme} title="Toggle theme">
1228
+ {theme === 'dark' ? (
1229
+ <>
1230
+ <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
1231
+ <circle cx="12" cy="12" r="5" />
1232
+ <line x1="12" y1="1" x2="12" y2="3" /><line x1="12" y1="21" x2="12" y2="23" />
1233
+ <line x1="4.22" y1="4.22" x2="5.64" y2="5.64" /><line x1="18.36" y1="18.36" x2="19.78" y2="19.78" />
1234
+ <line x1="1" y1="12" x2="3" y2="12" /><line x1="21" y1="12" x2="23" y2="12" />
1235
+ <line x1="4.22" y1="19.78" x2="5.64" y2="18.36" /><line x1="18.36" y1="5.64" x2="19.78" y2="4.22" />
1236
+ </svg>
1237
+ Light mode
1238
+ </>
1239
+ ) : (
1240
+ <>
1241
+ <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
1242
+ <path d="M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z" />
1243
+ </svg>
1244
+ Dark mode
1245
+ </>
1246
+ )}
1247
+ </button>
1248
  <div className="user-section">
1249
  <div className="user-avatar">{user?.name?.[0]?.toUpperCase() ?? '?'}</div>
1250
  <span className="user-name">{user?.name}</span>
 
1383
  code({ className, children, ...props }: any) {
1384
  const match = /language-(\w+)/.exec(className || '');
1385
  return match ? (
1386
+ <SyntaxHighlighter style={codeTheme as any} language={match[1]} PreTag="div" {...props}>
1387
  {String(children).replace(/\n$/, '')}
1388
  </SyntaxHighlighter>
1389
  ) : (
 
1471
  code({ className, children, ...props }: any) {
1472
  const match = /language-(\w+)/.exec(className || '');
1473
  return match ? (
1474
+ <SyntaxHighlighter style={codeTheme as any} language={match[1]} PreTag="div" {...props}>
1475
  {String(children).replace(/\n$/, '')}
1476
  </SyntaxHighlighter>
1477
  ) : (
 
1689
  </div>
1690
  </main>
1691
  </div>
1692
+ </CodeThemeContext.Provider>
1693
  );
1694
  }
1695
 
web/src/index.css CHANGED
@@ -25,11 +25,11 @@ body {
25
  place-items: center;
26
  min-width: 320px;
27
  min-height: 100vh;
28
- background: #1a1614;
29
  }
30
 
31
  #root {
32
  width: 100%;
33
  height: 100vh;
34
- background: #1a1614;
35
  }
 
25
  place-items: center;
26
  min-width: 320px;
27
  min-height: 100vh;
28
+ background: var(--bg-primary, #1a1614);
29
  }
30
 
31
  #root {
32
  width: 100%;
33
  height: 100vh;
34
+ background: var(--bg-primary, #1a1614);
35
  }