Skip to content

Commit ea0c60b

Browse files
author
SupKittyMeow
committed
sliightly better splash text (still bad). hopefully now shows the name instead of the website url
1 parent e9eed49 commit ea0c60b

4 files changed

Lines changed: 28 additions & 31 deletions

File tree

package-lock.json

Lines changed: 2 additions & 15 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/app/globals.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
--background: #ffffff;
55
--foreground: #171717;
66
--primary: #768fe4;
7-
--secondary: #f76565;
7+
--secondary: transparent;
88
}
99

1010
@theme inline {

src/app/layout.tsx

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

66
export const metadata: Metadata = {
@@ -13,22 +13,10 @@ 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-
2616
return (
27-
<html
28-
lang="en"
29-
style={{ "--secondary": getRandomColor() } as CSSProperties}
30-
>
17+
<html lang="en">
3118
<body className="antialiased flex flex-col min-h-screen">
19+
<SetColor />
3220
<header className="backdrop-blur-3xl border-b sticky top-0 min-w-full z-100">
3321
<nav className="flex gap-10 h-10 justify-center">
3422
<SwitcherLink to="" name="Home"></SwitcherLink>

src/components/SetColor.tsx

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
"use client";
2+
3+
import { useEffect } from "react";
4+
5+
export default function SetColor() {
6+
// Stackoverflow, you may be pretty much dead, but you aren't dead in my heart!
7+
// Modified from https://stackoverflow.com/questions/1484506/random-color-generator
8+
function getRandomColor() {
9+
const letters = "89ABCDEF89ABCDEF";
10+
let color = "#";
11+
for (let i = 0; i < 6; i++) {
12+
color += letters[Math.floor(Math.random() * 16)];
13+
}
14+
return color;
15+
}
16+
17+
useEffect(() => {
18+
document.documentElement.style.setProperty("--secondary", getRandomColor());
19+
}, []);
20+
21+
return <></>;
22+
}

0 commit comments

Comments
 (0)