From def738063863d543ccb4f8bbe54ac8bd15e1d124 Mon Sep 17 00:00:00 2001 From: Sviatoslav Makhynko Date: Tue, 11 Jun 2024 15:50:12 +0200 Subject: [PATCH] add: light/dark mode --- website/src/app.css | 14 +++++++ .../src/lib/components/DatabaseCard.svelte | 2 +- website/src/lib/components/Navbar.svelte | 16 +++++-- .../src/lib/components/ThemeSwitcher.svelte | 42 +++++++++++++++++++ .../src/lib/components/icons/Database.svelte | 7 ++-- website/src/lib/components/icons/Moon.svelte | 5 +++ website/src/lib/components/icons/Sun.svelte | 5 +++ .../src/lib/components/sections/Hero.svelte | 6 +-- website/src/routes/+layout.svelte | 9 ++++ website/tailwind.config.js | 11 +++-- 10 files changed, 100 insertions(+), 17 deletions(-) create mode 100644 website/src/lib/components/ThemeSwitcher.svelte create mode 100644 website/src/lib/components/icons/Moon.svelte create mode 100644 website/src/lib/components/icons/Sun.svelte diff --git a/website/src/app.css b/website/src/app.css index c81bcf7..e52c7a2 100644 --- a/website/src/app.css +++ b/website/src/app.css @@ -3,6 +3,20 @@ @tailwind utilities; @layer base { + :root { + --color-background: rgb(244 244 245); + --color-foreground: rgb(24 24 27); + --color-primary: rgb(180 83 9); + --color-secondary: rgb(228 228 231); + } + + :root[class~="dark"] { + --color-background: rgb(24 24 27); + --color-foreground: rgb(244 244 245); + --color-primary: rgb(180 83 9); + --color-secondary: rgb(39 39 42); + } + h1 { font-weight: 700; font-size: 1.875em; diff --git a/website/src/lib/components/DatabaseCard.svelte b/website/src/lib/components/DatabaseCard.svelte index 5afec28..b99fdd7 100644 --- a/website/src/lib/components/DatabaseCard.svelte +++ b/website/src/lib/components/DatabaseCard.svelte @@ -8,6 +8,6 @@
- +

{label}

diff --git a/website/src/lib/components/Navbar.svelte b/website/src/lib/components/Navbar.svelte index 4136d36..fd9f301 100644 --- a/website/src/lib/components/Navbar.svelte +++ b/website/src/lib/components/Navbar.svelte @@ -4,9 +4,10 @@ import Github from '$lib/components/icons/Github.svelte'; import XTwitter from '$lib/components/icons/XTwitter.svelte'; import Discord from '$lib/components/icons/Discord.svelte'; + import ThemeSwitcher from '$lib/components/ThemeSwitcher.svelte'; -
+
@@ -14,14 +15,21 @@ Njord -