add auto theme

switches between white and dark, based on browser's theme
This commit is contained in:
bopol 2021-01-27 17:39:12 +01:00
parent 1f296ec3aa
commit 9ee2deb460
10 changed files with 19 additions and 9 deletions

View File

@ -3,7 +3,7 @@ html
head
title about - teddit
include includes/head.pug
body(class=""+ user_preferences.theme +"")
body(class=""+ (user_preferences.theme === 'auto' ? 'dark' : user_preferences.theme) + "")
include includes/topbar.pug
.container
.content

View File

@ -1,3 +1,5 @@
if(user_preferences.theme === 'auto')
link(rel="stylesheet", type="text/css", href="/css/dark.css", media="(prefers-color-scheme: dark)")
if(user_preferences.theme === 'dark')
link(rel="stylesheet", type="text/css", href="/css/dark.css")
if(user_preferences.theme === 'sepia')

View File

@ -3,7 +3,7 @@ html
head
title teddit
include includes/head.pug
body(class=""+ user_preferences.theme +"")
body(class=""+ (user_preferences.theme === 'auto' ? 'dark' : user_preferences.theme) + "")
include includes/topbar.pug
if json === null
h2 error

View File

@ -3,7 +3,7 @@ html
head
title #{cleanTitle(post.title)} : #{subreddit}
include includes/head.pug
body(class=""+ user_preferences.theme +"")
body(class=""+ (user_preferences.theme === 'auto' ? 'dark' : user_preferences.theme) + "")
include includes/topbar.pug
if post === null
h1 Error occured

View File

@ -3,7 +3,7 @@ html
head
title preferences - teddit
include includes/head.pug
body(class=""+ user_preferences.theme +"")
body(class=""+ (user_preferences.theme === 'auto' ? 'dark' : user_preferences.theme) + "")
include includes/topbar.pug
.container
.content
@ -14,17 +14,25 @@ html
label(for="theme") Theme:
select(id="theme", name="theme")
if(!user_preferences.theme || user_preferences.theme == '')
option(value="auto") Auto
option(value="", selected="selected") White
option(value="dark") Dark
option(value="sepia") Sepia
if(user_preferences.theme === 'dark')
option(value="auto") Auto
option(value="") White
option(value="dark", selected="selected") Dark
option(value="sepia") Sepia
if(user_preferences.theme === 'sepia')
option(value="auto") Auto
option(value="") White
option(value="dark") Dark
option(value="sepia", selected="selected") Sepia
if(user_preferences.theme === 'auto')
option(value="auto", selected="selected") Auto
option(value="") White
option(value="dark") Dark
option(value="sepia") Sepia
.setting
label(for="flairs") Show flairs:
if(!user_preferences.flairs || user_preferences.flairs == 'true')

View File

@ -3,7 +3,7 @@ html
head
title privacy policy - teddit
include includes/head.pug
body(class=""+ user_preferences.theme +"")
body(class=""+ (user_preferences.theme === 'auto' ? 'dark' : user_preferences.theme) + "")
include includes/topbar.pug
.container
.content

View File

@ -6,7 +6,7 @@ html
else
title search results for #{q}
include includes/head.pug
body(class=""+ user_preferences.theme +"")
body(class=""+ (user_preferences.theme === 'auto' ? 'dark' : user_preferences.theme) + "")
include includes/topbar.pug
#search.sr.search-page
form(action="/r/" + subreddit + "/search", method="GET")

View File

@ -3,7 +3,7 @@ html
head
title /r/#{subreddit}
include includes/head.pug
body(class=""+ user_preferences.theme +"")
body(class=""+ (user_preferences.theme === 'auto' ? 'dark' : user_preferences.theme) + "")
include includes/topbar.pug
-
let show_nsfw_warning = false;

View File

@ -3,7 +3,7 @@ html
head
title subreddits - explore
include includes/head.pug
body(class=""+ user_preferences.theme +"")
body(class=""+ (user_preferences.theme === 'auto' ? 'dark' : user_preferences.theme) + "")
include includes/topbar.pug
if json === null
h1 Error occured

View File

@ -3,7 +3,7 @@ html
head
title overview for #{data.username}
include includes/head.pug
body(class=""+ user_preferences.theme +"")
body(class=""+ (user_preferences.theme === 'auto' ? 'dark' : user_preferences.theme) + "")
include includes/topbar.pug
if user === null
h1 Error occured