From 23081d86858e2047c336eafa0c5f09d34b5ca9bc Mon Sep 17 00:00:00 2001 From: padreug Date: Sun, 2 Feb 2025 18:44:05 +0100 Subject: [PATCH] add color theme with dark and light mode! --- src/assets/index.css | 172 ++++++++++++++++++------------- src/components/ThemeToggle.vue | 38 +++++++ src/components/layout/Footer.vue | 6 +- src/components/layout/Navbar.vue | 14 ++- tailwind.config.js | 81 +++++++-------- 5 files changed, 184 insertions(+), 127 deletions(-) create mode 100644 src/components/ThemeToggle.vue diff --git a/src/assets/index.css b/src/assets/index.css index 4e4399b..118bb00 100644 --- a/src/assets/index.css +++ b/src/assets/index.css @@ -1,76 +1,100 @@ @import "tailwindcss"; -/* @layer base { */ -/* :root { */ -/* --background: 0 0% 100%; */ -/* --foreground: 222.2 84% 4.9%; */ -/**/ -/* --muted: 210 40% 96.1%; */ -/* --muted-foreground: 215.4 16.3% 46.9%; */ -/**/ -/* --popover: 0 0% 100%; */ -/* --popover-foreground: 222.2 84% 4.9%; */ -/**/ -/* --card: 0 0% 100%; */ -/* --card-foreground: 222.2 84% 4.9%; */ -/**/ -/* --border: 214.3 31.8% 91.4%; */ -/* --input: 214.3 31.8% 91.4%; */ -/**/ -/* --primary: 222.2 47.4% 11.2%; */ -/* --primary-foreground: 210 40% 98%; */ -/**/ -/* --secondary: 210 40% 96.1%; */ -/* --secondary-foreground: 222.2 47.4% 11.2%; */ -/**/ -/* --accent: 210 40% 96.1%; */ -/* --accent-foreground: 222.2 47.4% 11.2%; */ -/**/ -/* --destructive: 0 84.2% 60.2%; */ -/* --destructive-foreground: 210 40% 98%; */ -/**/ -/* --ring: 222.2 84% 4.9%; */ -/**/ -/* --radius: 0.5rem; */ -/* } */ -/**/ -/* .dark { */ -/* --background: 222.2 84% 4.9%; */ -/* --foreground: 210 40% 98%; */ -/**/ -/* --muted: 217.2 32.6% 17.5%; */ -/* --muted-foreground: 215 20.2% 65.1%; */ -/**/ -/* --popover: 222.2 84% 4.9%; */ -/* --popover-foreground: 210 40% 98%; */ -/**/ -/* --card: 222.2 84% 4.9%; */ -/* --card-foreground: 210 40% 98%; */ -/**/ -/* --border: 217.2 32.6% 17.5%; */ -/* --input: 217.2 32.6% 17.5%; */ -/**/ -/* --primary: 210 40% 98%; */ -/* --primary-foreground: 222.2 47.4% 11.2%; */ -/**/ -/* --secondary: 217.2 32.6% 17.5%; */ -/* --secondary-foreground: 210 40% 98%; */ -/**/ -/* --accent: 217.2 32.6% 17.5%; */ -/* --accent-foreground: 210 40% 98%; */ -/**/ -/* --destructive: 0 62.8% 30.6%; */ -/* --destructive-foreground: 210 40% 98%; */ -/**/ -/* --ring: 212.7 26.8% 83.9%; */ -/* } */ -/* } */ -/**/ -/* @layer base { */ -/* * { */ -/* @apply border-border; */ -/* } */ -/* body { */ -/* @apply bg-background text-foreground; */ -/* } */ -/* } */ +@layer base { + :root { + --color-background: hsl(32 92% 87%); /* bg0 */ + --color-foreground: hsl(40 13% 23%); /* fg */ + + --color-card: hsl(39 59% 88%); /* bg1 */ + --color-card-foreground: hsl(40 13% 23%); /* fg */ + + --color-popover: hsl(39 59% 88%); /* bg1 */ + --color-popover-foreground: hsl(40 13% 23%); /* fg */ + + --color-primary: hsl(0 100% 31%); /* red */ + --color-primary-foreground: hsl(40 92% 88%); /* bg */ + + --color-secondary: hsl(39 46% 81%); /* bg2 */ + --color-secondary-foreground: hsl(40 13% 23%); /* fg */ + + --color-muted: hsl(37 29% 73%); /* bg3 */ + --color-muted-foreground: hsl(40 4% 36%); /* gray */ + + --color-accent: hsl(40 71% 49%); /* yellow */ + --color-accent-foreground: hsl(0 0% 16%); + + --color-destructive: hsl(0 76% 46%); /* bright_red */ + --color-destructive-foreground: hsl(40 92% 88%); /* bg */ + + --color-border: hsl(33 14% 59%); /* fg4 */ + --color-input: hsl(33 14% 59%); /* fg4 */ + --color-ring: hsl(0 100% 31%); /* red */ + + --radius: 0.5rem; + } + + .dark { + --color-background: hsl(0 0% 16%); /* bg0 */ + --color-foreground: hsl(40 92% 88%); /* fg */ + + --color-card: hsl(0 7% 23%); /* bg1 */ + --color-card-foreground: hsl(40 92% 88%); /* fg */ + + --color-popover: hsl(0 7% 23%); /* bg1 */ + --color-popover-foreground: hsl(40 92% 88%); /* fg */ + + --color-primary: hsl(6 93% 59%); /* red */ + --color-primary-foreground: hsl(0 0% 16%); /* bg */ + + --color-secondary: hsl(0 5% 29%); /* bg2 */ + --color-secondary-foreground: hsl(40 92% 88%); /* fg */ + + --color-muted: hsl(20 6% 36%); /* bg3 */ + --color-muted-foreground: hsl(33 14% 59%); /* gray */ + + --color-accent: hsl(42 95% 58%); /* yellow */ + --color-accent-foreground: hsl(0 0% 16%); + + --color-destructive: hsl(6 93% 59%); /* bright_red */ + --color-destructive-foreground: hsl(40 92% 88%); /* bg */ + + --color-border: hsl(24 10% 51%); /* fg4 */ + --color-input: hsl(24 10% 51%); /* fg4 */ + --color-ring: hsl(6 93% 59%); /* red */ + } + + * { + @apply box-border; + } + + body { + @apply bg-background text-foreground; + } +} + +@utility bg-background { + background-color: var(--color-background); +} + +@utility text-foreground { + color: var(--color-foreground); +} + +/* Add other utility classes for colors */ +@utility bg-card { + background-color: var(--color-card); +} + +@utility text-card-foreground { + color: var(--color-card-foreground); +} + +@utility bg-primary { + background-color: var(--color-primary); +} + +@utility text-primary-foreground { + color: var(--color-primary-foreground); +} + +/* ... add other utility classes as needed ... */ diff --git a/src/components/ThemeToggle.vue b/src/components/ThemeToggle.vue new file mode 100644 index 0000000..4b1cec2 --- /dev/null +++ b/src/components/ThemeToggle.vue @@ -0,0 +1,38 @@ + + + \ No newline at end of file diff --git a/src/components/layout/Footer.vue b/src/components/layout/Footer.vue index 8f45d95..21c2f14 100644 --- a/src/components/layout/Footer.vue +++ b/src/components/layout/Footer.vue @@ -3,9 +3,9 @@ const currentYear = new Date().getFullYear()