From 9036e5f189c91f71302d3a1b03d56024ba72b664 Mon Sep 17 00:00:00 2001 From: Vomitblood Date: Fri, 23 Aug 2024 17:16:48 +0800 Subject: [PATCH] moved color settings to dedicated tab --- src/components/FooterBar/FooterBar.tsx | 9 +- src/components/Generic/Layout.tsx | 13 +- .../HeaderBar/Settings/Settings.tsx | 14 +++ .../Settings/SettingsTabs/Background.tsx | 39 ------ .../Settings/SettingsTabs/Colors.tsx | 112 ++++++++++++++++++ .../HeaderBar/Settings/SettingsTabs/Style.tsx | 19 --- src/contexts/ThemeContext.tsx | 8 +- src/lib/settings.ts | 9 +- 8 files changed, 142 insertions(+), 81 deletions(-) create mode 100644 src/components/HeaderBar/Settings/SettingsTabs/Colors.tsx diff --git a/src/components/FooterBar/FooterBar.tsx b/src/components/FooterBar/FooterBar.tsx index 8965bb7..ffddbd7 100644 --- a/src/components/FooterBar/FooterBar.tsx +++ b/src/components/FooterBar/FooterBar.tsx @@ -1,15 +1,14 @@ -import { Box, Stack, useTheme } from "@mui/material"; +import { Box, Stack } from "@mui/material"; import { useSettings } from "../../contexts/SettingsContext"; +import { hexToRgba } from "../../lib/utils/color"; import { Settings } from "../HeaderBar/Settings/Settings"; import { WindowButtons } from "../HeaderBar/WindowButtons"; -import { hexToRgba } from "../../lib/utils/color"; export const FooterBar = () => { // contexts const { settings } = useSettings(); - const theme = useTheme(); - const { r, g, b, a } = hexToRgba(theme.palette.background.paper); + const { r, g, b, a } = hexToRgba(settings.colors.footer_color); return ( { sx={{ alignItems: "center", backdropFilter: `blur(${settings.style.blur_radius}px)`, - backgroundColor: "rgba(0, 0, 0, 0.5)", + backgroundColor: `rgba(${r}, ${g}, ${b}, 0.5)`, borderRadius: settings.style.radius + "px", display: "flex", flexDirection: "row", diff --git a/src/components/Generic/Layout.tsx b/src/components/Generic/Layout.tsx index a4ae6bc..5bf2ad8 100644 --- a/src/components/Generic/Layout.tsx +++ b/src/components/Generic/Layout.tsx @@ -40,18 +40,9 @@ export const Layout = () => { display: "flex", flexGrow: 1, overflow: "auto", + p: 1, }} - > - - - - + > ); diff --git a/src/components/HeaderBar/Settings/Settings.tsx b/src/components/HeaderBar/Settings/Settings.tsx index 19f402d..8de705c 100644 --- a/src/components/HeaderBar/Settings/Settings.tsx +++ b/src/components/HeaderBar/Settings/Settings.tsx @@ -1,6 +1,7 @@ import { BugReportOutlined, FormatPaintOutlined, + PaletteOutlined, SettingsOutlined, WallpaperOutlined, WebAssetOutlined, @@ -16,6 +17,7 @@ import { Background } from "./SettingsTabs/Background"; import { Debug } from "./SettingsTabs/Debug"; import { Style } from "./SettingsTabs/Style"; import { Window } from "./SettingsTabs/Window"; +import { Colors } from "./SettingsTabs/Colors"; export const Settings = () => { // contexts @@ -89,6 +91,7 @@ export const Settings = () => { scrollButtons={true} sx={{ borderBottom: "1px solid " + theme.palette.divider, + height: "84px", }} variant="scrollable" > @@ -97,6 +100,11 @@ export const Settings = () => { label="Style" value="style" /> + } + label="Colors" + value="colors" + /> } label="Background" @@ -127,6 +135,12 @@ export const Settings = () => { >