Skip to content

Commit 8d190db

Browse files
committed
fix color change setter thing for secondary color so now its not flashing red
1 parent f1aca09 commit 8d190db

1 file changed

Lines changed: 15 additions & 3 deletions

File tree

src/app/layout.tsx

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import SetColor from "@/components/SetColor";
21
import SwitcherLink from "@/components/SwitcherLink";
32
import { Metadata } from "next";
3+
import { CSSProperties } from "react";
44
import "./globals.css";
55

66
export const metadata: Metadata = {
@@ -13,9 +13,21 @@ export default function RootLayout({
1313
}: Readonly<{
1414
children: React.ReactNode;
1515
}>) {
16+
function getRandomColor() {
17+
const letters = "89ABCDEF89ABCDEF";
18+
let color = "#";
19+
for (let i = 0; i < 6; i++) {
20+
// eslint-disable-next-line react-hooks/purity
21+
color += letters[Math.floor(Math.random() * 16)];
22+
}
23+
return color;
24+
}
25+
1626
return (
17-
<html lang="en">
18-
<SetColor />
27+
<html
28+
lang="en"
29+
style={{ "--secondary": getRandomColor() } as CSSProperties}
30+
>
1931
<body className="antialiased flex flex-col min-h-screen">
2032
<header className="backdrop-blur-3xl border-b sticky top-0 min-w-full z-100">
2133
<nav className="flex gap-10 h-10 justify-center">

0 commit comments

Comments
 (0)