fixed dark theme

This commit is contained in:
Davit
2026-04-21 17:20:32 +04:00
parent 9e3fb90db8
commit 23cc90a298
2 changed files with 15 additions and 9 deletions
+14 -8
View File
@@ -56,6 +56,13 @@ function hexToRgba(hex: string, alpha: number): string {
return `rgba(${r}, ${g}, ${b}, ${alpha})`;
}
function isDarkBackground(hex: string): boolean {
const r = parseInt(hex.slice(1, 3), 16);
const g = parseInt(hex.slice(3, 5), 16);
const b = parseInt(hex.slice(5, 7), 16);
return (0.299 * r + 0.587 * g + 0.114 * b) / 255 < 0.5;
}
interface ThemeConfig {
name: string;
primary: { main: string; light: string; dark: string; contrastText: string };
@@ -95,6 +102,7 @@ function buildTheme(config: ThemeConfig): Theme {
return createTheme({
palette: {
mode: isDarkBackground(config.background.default) ? 'dark' : 'light',
primary: config.primary,
secondary: config.secondary,
error: config.error,
@@ -128,16 +136,14 @@ function buildTheme(config: ThemeConfig): Theme {
},
},
},
MuiTextField: {
MuiOutlinedInput: {
styleOverrides: {
root: {
'& .MuiOutlinedInput-root': {
borderRadius: 8,
backgroundColor: background.paper,
'& fieldset': { borderColor: divider },
'&:hover fieldset': { borderColor: text.secondary },
'&.Mui-focused fieldset': { borderColor: primary.main },
},
borderRadius: 8,
backgroundColor: background.paper,
'& fieldset': { borderColor: divider },
'&:hover fieldset': { borderColor: text.secondary },
'&.Mui-focused fieldset': { borderColor: primary.main },
},
},
},
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "openclaw-client",
"version": "2.4.1",
"version": "2.4.2",
"description": "Web-based chat interface for OpenClaw AI agents",
"private": true,
"type": "module",