From a4d75356ebf0d147e40f75044f6547bc08f0b763 Mon Sep 17 00:00:00 2001 From: Lucas Colombo Date: Fri, 12 Apr 2024 21:46:15 -0300 Subject: [PATCH] =?UTF-8?q?feat:=20=E2=9C=A8=20auto=20switch=20dark-light?= =?UTF-8?q?=20themes?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ref: #1 --- README.md | 6 +++++- dist/public/assets/css/theme-auto.css | 1 + src/themes/scss/auto.scss | 2 ++ 3 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 dist/public/assets/css/theme-auto.css create mode 100644 src/themes/scss/auto.scss diff --git a/README.md b/README.md index ce25bc6..ee87e0a 100644 --- a/README.md +++ b/README.md @@ -12,6 +12,10 @@ ![light theme](figs/light.png) +## `auto` + +Switches between `dark` and `light` automatically based on the user's system preference. + ## Usage 1. Clone this repo @@ -20,7 +24,7 @@ ```ini [ui] -THEMES=...,dark,light +THEMES=...,dark,light,auto DEFAULT_THEME=dark # optional ``` diff --git a/dist/public/assets/css/theme-auto.css b/dist/public/assets/css/theme-auto.css new file mode 100644 index 0000000..a8d0513 --- /dev/null +++ b/dist/public/assets/css/theme-auto.css @@ -0,0 +1 @@ +@import "./theme-light.css"(prefers-color-scheme:light);@import "./theme-dark.css"(prefers-color-scheme:dark); \ No newline at end of file diff --git a/src/themes/scss/auto.scss b/src/themes/scss/auto.scss new file mode 100644 index 0000000..77aaa37 --- /dev/null +++ b/src/themes/scss/auto.scss @@ -0,0 +1,2 @@ +@import "./theme-light.css" (prefers-color-scheme: light); +@import "./theme-dark.css" (prefers-color-scheme: dark); \ No newline at end of file