1
0
mirror of https://github.com/avinal/box-box.git synced 2026-01-11 22:18:33 +05:30

feat: add automatic dark mode tailwind classes

Signed-off-by: Avinal Kumar <avinal.xlvii@gmail.com>
This commit is contained in:
2025-01-01 22:14:16 +05:30
parent 4d907f161e
commit a7443aa0c8
8 changed files with 53 additions and 44 deletions

View File

@@ -1,6 +1,6 @@
{{- $color := (index (shuffle (slice "cyan" "teal" "pink" "rose" "fuchsia" "purple" "violet" "indigo" "emerald" "yellow" "amber" "red")) 0) }}
<div
class="relative overflow-auto px-4 ring-1 ring-gray-800 mt-5 text-center text-light text-gray-500 hover:text-black hover:bg-{{ $color }}-400"
class="relative overflow-auto px-4 ring-1 ring-gray-800 mt-5 text-center text-light text-gray-500 hover:text-black hover:bg-{{ $color }}-400 dark:text-gray-200 dark:ring-white dark:hover:ring-black"
>
<span
><a href="https://github.com/avinal/box-box">Box Box</a> | A

View File

@@ -1,7 +1,7 @@
{{- $color := (index (shuffle (slice "cyan" "teal" "pink" "rose" "fuchsia" "purple" "violet" "indigo" "emerald" "yellow" "amber" "red")) 0) }}
<div class="py-4">
<div class="py-4" onclick="toggleTheme()">
<h1
class="text-xl font-bold font-mono bg-gradient-to-r to-black hover:to-{{ $color }}-400 from-white"
class="text-2xl font-bold font-mono bg-gradient-to-r to-black hover:to-{{ $color }}-400 from-white dark:text-white dark:to-white dark:from-neutral-900 cursor-default"
>
{{ site.Title }}
</h1>

View File

@@ -23,13 +23,13 @@
{{- range .menuEntries }}
{{- $attrs := dict "href" .URL }}
{{- $color := (index (shuffle (slice "cyan" "teal" "pink" "rose" "fuchsia" "purple" "violet" "indigo" "emerald" "yellow" "amber" "red")) 0) }}
{{- $classes := "min-width flex items-center justify-center border border-black text-center shadow-md shadow-gray-600" }}
{{- $classes := "min-width flex items-center justify-center border border-black text-center dark:border-white" }}
{{- if $page.IsMenuCurrent .Menu . }}
{{- $classes = (printf "%s %s" $classes "bg-black text-white active") }}
{{- $classes = (printf "%s %s" $classes "bg-black text-white active dark:text-black dark:bg-white") }}
{{- $attrs = merge $attrs (dict "aria-current" "page") }}
{{- else }}
{{- $classes = (printf "%s %s hover:bg-%s-400" $classes "bg-white text-black ancestor" $color) }}
{{- $classes = (printf "%s %s hover:bg-%s-400" $classes "bg-white text-black dark:text-white dark:hover:text-black dark:hover:border-black dark:bg-neutral-900 ancestor" $color) }}
{{- $attrs = merge $attrs (dict "aria-current" "true") }}
{{- end }}