Spaces:
Running
Running
update colors
Browse files- client/index.html +0 -20
- client/src/App.jsx +0 -9
- client/src/components/LeaderboardFilters/SearchBar.jsx +4 -4
- client/src/config/theme.js +3 -3
- client/src/index.css +4 -8
client/index.html
CHANGED
|
@@ -19,34 +19,14 @@
|
|
| 19 |
window.matchMedia &&
|
| 20 |
window.matchMedia("(prefers-color-scheme: dark)").matches;
|
| 21 |
var theme = prefersDarkMode ? "dark" : "light";
|
| 22 |
-
var bgColor = prefersDarkMode ? "#0a0a0a" : "#f8f9fa";
|
| 23 |
|
| 24 |
// Apply theme to document elements
|
| 25 |
document.documentElement.setAttribute("data-theme", theme);
|
| 26 |
document.documentElement.classList.add(theme + "-mode");
|
| 27 |
|
| 28 |
-
// Set background color directly on HTML and BODY
|
| 29 |
-
document.documentElement.style.backgroundColor = bgColor;
|
| 30 |
-
|
| 31 |
-
// Create and apply a style tag for immediate styling
|
| 32 |
-
var style = document.createElement("style");
|
| 33 |
-
style.textContent = `
|
| 34 |
-
html, body {
|
| 35 |
-
background-color: ${bgColor} !important;
|
| 36 |
-
transition: background-color 0s;
|
| 37 |
-
}
|
| 38 |
-
html.${theme}-mode,
|
| 39 |
-
body.${theme}-mode,
|
| 40 |
-
#root {
|
| 41 |
-
background-color: ${bgColor} !important;
|
| 42 |
-
}
|
| 43 |
-
`;
|
| 44 |
-
document.head.appendChild(style);
|
| 45 |
-
|
| 46 |
// Apply theme class to body as well
|
| 47 |
document.addEventListener("DOMContentLoaded", function () {
|
| 48 |
document.body.classList.add(theme + "-mode");
|
| 49 |
-
document.body.style.backgroundColor = bgColor;
|
| 50 |
});
|
| 51 |
})();
|
| 52 |
</script>
|
|
|
|
| 19 |
window.matchMedia &&
|
| 20 |
window.matchMedia("(prefers-color-scheme: dark)").matches;
|
| 21 |
var theme = prefersDarkMode ? "dark" : "light";
|
|
|
|
| 22 |
|
| 23 |
// Apply theme to document elements
|
| 24 |
document.documentElement.setAttribute("data-theme", theme);
|
| 25 |
document.documentElement.classList.add(theme + "-mode");
|
| 26 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 27 |
// Apply theme class to body as well
|
| 28 |
document.addEventListener("DOMContentLoaded", function () {
|
| 29 |
document.body.classList.add(theme + "-mode");
|
|
|
|
| 30 |
});
|
| 31 |
})();
|
| 32 |
</script>
|
client/src/App.jsx
CHANGED
|
@@ -20,24 +20,17 @@ function App() {
|
|
| 20 |
|
| 21 |
// Apply theme to document as early as possible
|
| 22 |
useEffect(() => {
|
| 23 |
-
const bgColor = mode === "dark" ? "#0a0a0a" : "#f8f9fa";
|
| 24 |
-
|
| 25 |
// Apply theme class to document elements
|
| 26 |
document.documentElement.setAttribute("data-theme", mode);
|
| 27 |
document.documentElement.classList.remove("light-mode", "dark-mode");
|
| 28 |
document.documentElement.classList.add(`${mode}-mode`);
|
| 29 |
-
document.documentElement.style.backgroundColor = bgColor;
|
| 30 |
|
| 31 |
// Apply theme class to body
|
| 32 |
document.body.classList.remove("light-mode", "dark-mode");
|
| 33 |
document.body.classList.add(`${mode}-mode`);
|
| 34 |
-
document.body.style.backgroundColor = bgColor;
|
| 35 |
|
| 36 |
// Apply to root element as well
|
| 37 |
const rootElement = document.getElementById("root");
|
| 38 |
-
if (rootElement) {
|
| 39 |
-
rootElement.style.backgroundColor = bgColor;
|
| 40 |
-
}
|
| 41 |
|
| 42 |
// Update meta theme-color for mobile browsers
|
| 43 |
let metaThemeColor = document.querySelector("meta[name=theme-color]");
|
|
@@ -46,7 +39,6 @@ function App() {
|
|
| 46 |
metaThemeColor.name = "theme-color";
|
| 47 |
document.head.appendChild(metaThemeColor);
|
| 48 |
}
|
| 49 |
-
metaThemeColor.content = bgColor;
|
| 50 |
}, [mode]);
|
| 51 |
|
| 52 |
return (
|
|
@@ -57,7 +49,6 @@ function App() {
|
|
| 57 |
width: "100%",
|
| 58 |
WebkitOverflowScrolling: "touch",
|
| 59 |
overflow: "auto",
|
| 60 |
-
backgroundColor: mode === "dark" ? "#0a0a0a" : "#f8f9fa",
|
| 61 |
}}
|
| 62 |
>
|
| 63 |
<ThemeProvider theme={theme}>
|
|
|
|
| 20 |
|
| 21 |
// Apply theme to document as early as possible
|
| 22 |
useEffect(() => {
|
|
|
|
|
|
|
| 23 |
// Apply theme class to document elements
|
| 24 |
document.documentElement.setAttribute("data-theme", mode);
|
| 25 |
document.documentElement.classList.remove("light-mode", "dark-mode");
|
| 26 |
document.documentElement.classList.add(`${mode}-mode`);
|
|
|
|
| 27 |
|
| 28 |
// Apply theme class to body
|
| 29 |
document.body.classList.remove("light-mode", "dark-mode");
|
| 30 |
document.body.classList.add(`${mode}-mode`);
|
|
|
|
| 31 |
|
| 32 |
// Apply to root element as well
|
| 33 |
const rootElement = document.getElementById("root");
|
|
|
|
|
|
|
|
|
|
| 34 |
|
| 35 |
// Update meta theme-color for mobile browsers
|
| 36 |
let metaThemeColor = document.querySelector("meta[name=theme-color]");
|
|
|
|
| 39 |
metaThemeColor.name = "theme-color";
|
| 40 |
document.head.appendChild(metaThemeColor);
|
| 41 |
}
|
|
|
|
| 42 |
}, [mode]);
|
| 43 |
|
| 44 |
return (
|
|
|
|
| 49 |
width: "100%",
|
| 50 |
WebkitOverflowScrolling: "touch",
|
| 51 |
overflow: "auto",
|
|
|
|
| 52 |
}}
|
| 53 |
>
|
| 54 |
<ThemeProvider theme={theme}>
|
client/src/components/LeaderboardFilters/SearchBar.jsx
CHANGED
|
@@ -204,12 +204,12 @@ const SearchBar = ({
|
|
| 204 |
checked={arenaOnly}
|
| 205 |
onChange={(e) => setArenaOnly(e.target.checked)}
|
| 206 |
size="small"
|
| 207 |
-
color="
|
| 208 |
sx={{
|
| 209 |
"&.Mui-checked": {
|
| 210 |
-
color: "
|
| 211 |
"& .MuiSwitch-track": {
|
| 212 |
-
backgroundColor: "
|
| 213 |
},
|
| 214 |
},
|
| 215 |
}}
|
|
@@ -220,7 +220,7 @@ const SearchBar = ({
|
|
| 220 |
userSelect: "none!important",
|
| 221 |
mr: 0,
|
| 222 |
"& .MuiFormControlLabel-label": {
|
| 223 |
-
color: arenaOnly ? "
|
| 224 |
userSelect: arenaOnly ? "none" : "auto",
|
| 225 |
},
|
| 226 |
}}
|
|
|
|
| 204 |
checked={arenaOnly}
|
| 205 |
onChange={(e) => setArenaOnly(e.target.checked)}
|
| 206 |
size="small"
|
| 207 |
+
color="primary"
|
| 208 |
sx={{
|
| 209 |
"&.Mui-checked": {
|
| 210 |
+
color: "primary.light",
|
| 211 |
"& .MuiSwitch-track": {
|
| 212 |
+
backgroundColor: "primary.light",
|
| 213 |
},
|
| 214 |
},
|
| 215 |
}}
|
|
|
|
| 220 |
userSelect: "none!important",
|
| 221 |
mr: 0,
|
| 222 |
"& .MuiFormControlLabel-label": {
|
| 223 |
+
color: arenaOnly ? "primary.light" : "inherit",
|
| 224 |
userSelect: arenaOnly ? "none" : "auto",
|
| 225 |
},
|
| 226 |
}}
|
client/src/config/theme.js
CHANGED
|
@@ -48,7 +48,7 @@ const getDesignTokens = (mode) => ({
|
|
| 48 |
contrastText: "#fff",
|
| 49 |
},
|
| 50 |
background: {
|
| 51 |
-
default: mode === "light" ? "#
|
| 52 |
paper: mode === "light" ? "#fff" : "#1a1a1a",
|
| 53 |
subtle: mode === "light" ? "grey.100" : "grey.900",
|
| 54 |
hover: mode === "light" ? "action.hover" : alpha("#fff", 0.08),
|
|
@@ -85,10 +85,10 @@ const getDesignTokens = (mode) => ({
|
|
| 85 |
MuiCssBaseline: {
|
| 86 |
styleOverrides: {
|
| 87 |
html: {
|
| 88 |
-
backgroundColor: mode === "light" ? "#
|
| 89 |
},
|
| 90 |
body: {
|
| 91 |
-
backgroundColor: mode === "light" ? "#
|
| 92 |
},
|
| 93 |
},
|
| 94 |
},
|
|
|
|
| 48 |
contrastText: "#fff",
|
| 49 |
},
|
| 50 |
background: {
|
| 51 |
+
default: mode === "light" ? "#f5f5f5" : "#0b0f19",
|
| 52 |
paper: mode === "light" ? "#fff" : "#1a1a1a",
|
| 53 |
subtle: mode === "light" ? "grey.100" : "grey.900",
|
| 54 |
hover: mode === "light" ? "action.hover" : alpha("#fff", 0.08),
|
|
|
|
| 85 |
MuiCssBaseline: {
|
| 86 |
styleOverrides: {
|
| 87 |
html: {
|
| 88 |
+
backgroundColor: mode === "light" ? "#f5f5f5" : "#0b0f19",
|
| 89 |
},
|
| 90 |
body: {
|
| 91 |
+
backgroundColor: mode === "light" ? "#f5f5f5" : "#0b0f19",
|
| 92 |
},
|
| 93 |
},
|
| 94 |
},
|
client/src/index.css
CHANGED
|
@@ -10,13 +10,11 @@
|
|
| 10 |
}
|
| 11 |
|
| 12 |
:root[data-theme="light"] {
|
| 13 |
-
color: #
|
| 14 |
-
background-color: #f8f9fa;
|
| 15 |
}
|
| 16 |
|
| 17 |
:root[data-theme="dark"] {
|
| 18 |
-
color: #
|
| 19 |
-
background-color: #0a0a0a;
|
| 20 |
}
|
| 21 |
|
| 22 |
* {
|
|
@@ -52,14 +50,12 @@ body {
|
|
| 52 |
|
| 53 |
/* Styles spécifiques pour le mode sombre */
|
| 54 |
.dark-mode {
|
| 55 |
-
background-color: #
|
| 56 |
-
color: #ffffff;
|
| 57 |
}
|
| 58 |
|
| 59 |
/* Styles spécifiques pour le mode clair */
|
| 60 |
.light-mode {
|
| 61 |
-
background-color: #
|
| 62 |
-
color: #213547;
|
| 63 |
}
|
| 64 |
|
| 65 |
/* Assurer que le défilement est fluide */
|
|
|
|
| 10 |
}
|
| 11 |
|
| 12 |
:root[data-theme="light"] {
|
| 13 |
+
background-color: #f5f5f5;
|
|
|
|
| 14 |
}
|
| 15 |
|
| 16 |
:root[data-theme="dark"] {
|
| 17 |
+
background-color: #020011;
|
|
|
|
| 18 |
}
|
| 19 |
|
| 20 |
* {
|
|
|
|
| 50 |
|
| 51 |
/* Styles spécifiques pour le mode sombre */
|
| 52 |
.dark-mode {
|
| 53 |
+
background-color: #020011 !important;
|
|
|
|
| 54 |
}
|
| 55 |
|
| 56 |
/* Styles spécifiques pour le mode clair */
|
| 57 |
.light-mode {
|
| 58 |
+
background-color: #f5f5f5 !important;
|
|
|
|
| 59 |
}
|
| 60 |
|
| 61 |
/* Assurer que le défilement est fluide */
|