fix(devtools): use theme-aware text colors for console warnings and errors (#22181)

This commit is contained in:
Sandy Tao
2026-03-17 14:00:40 -07:00
committed by GitHub
parent 2504105a1c
commit 77ca3c0e13
+5 -1
View File
@@ -20,7 +20,9 @@ interface ThemeColors {
consoleBg: string; consoleBg: string;
rowBorder: string; rowBorder: string;
errorBg: string; errorBg: string;
errorText: string;
warnBg: string; warnBg: string;
warnText: string;
} }
export default function App() { export default function App() {
@@ -69,7 +71,9 @@ export default function App() {
consoleBg: isDark ? '#1e1e1e' : '#fff', consoleBg: isDark ? '#1e1e1e' : '#fff',
rowBorder: isDark ? '#303134' : '#f0f0f0', rowBorder: isDark ? '#303134' : '#f0f0f0',
errorBg: isDark ? '#3c1e1e' : '#fff0f0', errorBg: isDark ? '#3c1e1e' : '#fff0f0',
errorText: isDark ? '#f28b82' : '#a80000',
warnBg: isDark ? '#302a10' : '#fff3cd', warnBg: isDark ? '#302a10' : '#fff3cd',
warnText: isDark ? '#fdd663' : '#7a5d00',
}), }),
[isDark], [isDark],
); );
@@ -539,7 +543,7 @@ function ConsoleLogEntry({ log, t }: { log: ConsoleLog; t: ThemeColors }) {
const isError = log.type === 'error'; const isError = log.type === 'error';
const isWarn = log.type === 'warn'; const isWarn = log.type === 'warn';
const bg = isError ? t.errorBg : isWarn ? t.warnBg : 'transparent'; const bg = isError ? t.errorBg : isWarn ? t.warnBg : 'transparent';
const color = isError ? '#f28b82' : isWarn ? '#fdd663' : t.text; const color = isError ? t.errorText : isWarn ? t.warnText : t.text;
const icon = isError ? '❌' : isWarn ? '⚠️' : ' '; const icon = isError ? '❌' : isWarn ? '⚠️' : ' ';
let displayContent = content; let displayContent = content;