From fc8e62cdeae4f32df5edd8ab7331607274476cd0 Mon Sep 17 00:00:00 2001
From: Zamitto <167933696+zamitto@users.noreply.github.com>
Date: Wed, 19 Jun 2024 20:41:35 -0300
Subject: [PATCH] background
---
package.json | 1 +
.../components/sidebar/sidebar-profile.tsx | 1 +
src/renderer/src/helpers.ts | 11 ++++++++--
src/renderer/src/hooks/use-user-details.ts | 6 ++---
src/renderer/src/pages/user/user-content.tsx | 22 +++++++++----------
src/types/index.ts | 1 -
yarn.lock | 19 ++++++++++++++++
7 files changed, 44 insertions(+), 17 deletions(-)
diff --git a/package.json b/package.json
index 89fb8c42..39a177e9 100644
--- a/package.json
+++ b/package.json
@@ -82,6 +82,7 @@
"@electron-toolkit/tsconfig": "^1.0.1",
"@swc/core": "^1.4.16",
"@types/auto-launch": "^5.0.5",
+ "@types/color": "^3.0.6",
"@types/jsdom": "^21.1.6",
"@types/lodash-es": "^4.17.12",
"@types/node": "^20.12.7",
diff --git a/src/renderer/src/components/sidebar/sidebar-profile.tsx b/src/renderer/src/components/sidebar/sidebar-profile.tsx
index 2f4dc600..f8d2225e 100644
--- a/src/renderer/src/components/sidebar/sidebar-profile.tsx
+++ b/src/renderer/src/components/sidebar/sidebar-profile.tsx
@@ -63,6 +63,7 @@ export function SidebarProfile() {
{userDetails && runningGame && (
- new Color(color).darken(amount).toString();
+export const darkenColor = (
+ color: string,
+ amount: number,
+ alpha: number = 1
+) => {
+ const newColor = new Color(color).darken(amount).alpha(alpha).toString();
+ console.log(color, newColor);
+ return newColor;
+};
diff --git a/src/renderer/src/hooks/use-user-details.ts b/src/renderer/src/hooks/use-user-details.ts
index 75de473f..e17ad95f 100644
--- a/src/renderer/src/hooks/use-user-details.ts
+++ b/src/renderer/src/hooks/use-user-details.ts
@@ -36,8 +36,7 @@ export function useUserDetails() {
format: "hex",
});
- const profileBackground = `linear-gradient(135deg, ${darkenColor(output as string, 0.6)}, ${darkenColor(output as string, 0.8)})`;
-
+ const profileBackground = `linear-gradient(135deg, ${darkenColor(output as string, 0.6)}, ${darkenColor(output as string, 0.8, 0.9)})`;
dispatch(setProfileBackground(profileBackground));
window.localStorage.setItem(
@@ -45,7 +44,8 @@ export function useUserDetails() {
JSON.stringify({ ...userDetails, profileBackground })
);
} else {
- dispatch(setProfileBackground(null));
+ const profileBackground = `#151515e6`;
+ dispatch(setProfileBackground(profileBackground));
window.localStorage.setItem("userDetails", JSON.stringify(userDetails));
}
diff --git a/src/renderer/src/pages/user/user-content.tsx b/src/renderer/src/pages/user/user-content.tsx
index 7d74f50a..2148f7e2 100644
--- a/src/renderer/src/pages/user/user-content.tsx
+++ b/src/renderer/src/pages/user/user-content.tsx
@@ -104,6 +104,17 @@ export function UserContent({
position: "relative",
}}
>
+ {runningGame && (
+