Scheduled
{{end}}{{if .Title.String}}diff --git a/less/pad-theme.less b/less/pad-theme.less index 94276cd..ee8c041 100644 --- a/less/pad-theme.less +++ b/less/pad-theme.less @@ -1,217 +1,368 @@ @lightBG: #ffffff; @lightTextColor: #000; @lightLinkColor: #444; @lightNavBG: #fff; @lightNavHoverBG: #f6f6f6; @lightNavBorder: #ccc; @darkBG: #222222; @darkTextColor: #ffffff; @darkLinkColor: #ccc; @darkNavBG: #393939; @darkNavHoverBG: #555; @darkNavBorder: #333; .pad-theme-transition { -moz-transition-property: background-color, color; -webkit-transition-property: background-color, color; -o-transition-property: background-color, color; transition-property: background-color, color; .transition-duration(0.25s); } body#pad-sub #posts, .atoms { h3 { a { color: @lightTextColor; &:hover { color: darken(@lightTextColor, 10%); } } } h3, h4 { a { color: @lightTextColor; &:hover { color: darken(@lightTextColor, 10%); } } } date, .electron { color: #999; } a.action, a { color: @lightLinkColor; &:hover { color: darken(@lightLinkColor, 10%); } } } body#pad, body#pad-sub { .pad-theme-transition; &.light { background-color: @lightBG; color: @lightTextColor; #tools { .pad-theme-transition; background-color: transparent; h1 { a { color: @headerTextColor; } } #belt { a, button { color: #000; } } .tool { status { color: #999; } } .hidden { wc { color: #777; } } a:hover, a:active { background-color: transparent; color: @lightLinkColor; } } .modal { border-color: @lightNavBorder; background: @lightNavBG; } } &.dark { background-color: @darkBG; color: @darkTextColor; #tools { .pad-theme-transition; background-color: #262626; h1 { a { color: @darkTextColor; } } #belt { a, button { color: white; } } .tool { status { color: #666; } } .hidden { wc { color: #ececec; } } a:hover, a:active { background-color: transparent; color: @darkLinkColor; } nav { &> ul > li a { color: @darkTextColor; } ul { ul { background: @darkNavBG; border-color: @darkNavBorder; } li { &.current-user { color: #fff; } &.selected { a { color: #777; } } } li:hover { background: @darkNavHoverBG; } } } } #posts { h3 { a { color: @darkTextColor; &:hover { color: darken(@darkTextColor, 10%); } } } h3, h4 { a { color: @darkTextColor; &:hover { color: darken(@darkTextColor, 10%); } } } a.action, a { color: @darkLinkColor; &:hover { color: darken(@darkLinkColor, 10%); } } } .modal { border-color: @darkNavBorder; background: @darkNavBG; input { color: #fff; } .form-hint { color: #ccc; } a:link, a:visited { color: lighten(@primary, 8%); } } } } body#pad { .pad-theme-transition; textarea, #title { .pad-theme-transition; } &.dark { textarea, #title, #editor { background-color: @darkBG; color: @darkTextColor; } } &.light { textarea, #title, #editor { background-color: @lightBG; color: @lightTextColor; } } } body { &.dark { nav#top-nav { a { color: @darkLinkColor; } } } } + +html { + &.light { + body:not(#pad):not(#pad-sub) { + background-color: @lightBG; + color: @lightTextColor; + } + } + + &.dark { + body:not(#pad):not(#pad-sub) { + background-color: @darkBG; + color: @darkTextColor; + } + + body:not(#pad):not(#pad-sub) { + a { + color: @darkLinkColor; + &:hover { + color: darken(@darkLinkColor, 10%); + } + } + + h1, h2, h3, h4, h5, h6 { + color: @darkTextColor; + a { + color: @darkTextColor; + } + } + + hr { + background: @darkNavBorder; + } + + footer nav, + .description, + .meta-note, + .subtitle, + .post-title time, + .post-title time a:link, + .post-title time a:visited, + .post-title + .time { + color: #999; + } + + input, textarea, select { + background: @darkNavBG; + color: @darkTextColor; + border-color: @darkNavBorder; + } + + pre, code, blockquote { + background-color: #262626; + color: @darkTextColor; + border-color: @darkNavBorder; + } + + .dropdown-nav ul ul, + nav#manage ul ul { + background: @darkNavBG; + border-color: @darkNavBorder; + } + + .dropdown-nav ul li, + nav#manage ul li { + &:hover { + background: @darkNavHoverBG; + } + &.current-user { + color: #fff; + } + &.menu-heading { + color: #ccc; + } + &.selected { + a { + color: #777; + } + } + } + + .dropdown-nav ul a, + nav#manage ul a, + header nav a, + #user-nav a, + #full-nav a { + color: @darkTextColor; + } + + nav#full-nav a.simple-btn { + background: @darkNavBG; + color: @darkTextColor; + border-color: @darkNavBorder !important; + } + + img.ic-18dp, + img.ic-24dp { + filter: brightness(1.15); + } + + .alert { + &.info { + color: #b9def0; + background-color: #24404d; + border-color: #35596a; + } + &.success { + color: #cde9c7; + background-color: #294232; + border-color: #3a6047; + } + &.danger { + color: #f4d999; + background-color: #473c1d; + border-color: #856404; + h3 { + color: @darkTextColor !important; + } + } + } + } + } +} + +.global-theme-toggle { + display: inline-block; + position: relative; + top: -0.15rem; + margin-right: 0.85rem; + padding: 0; + background: transparent; + border: 0; + box-shadow: none; + line-height: 1; + vertical-align: middle; + &:hover { + text-decoration: none; + } + img { + display: block; + filter: none !important; + } +} + +.global-theme-toggle--floating { + position: fixed; + top: 1.15rem; + right: 1.25rem; + z-index: 1000; + margin-left: 0; +} diff --git a/static/js/theme.js b/static/js/theme.js new file mode 100644 index 0000000..27a4566 --- /dev/null +++ b/static/js/theme.js @@ -0,0 +1,93 @@ +(function () { + var STORAGE_KEY = "padTheme"; + var LIGHT = "light"; + var DARK = "dark"; + + function preferredTheme() { + return window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches ? DARK : LIGHT; + } + + function storedTheme() { + try { + return localStorage.getItem(STORAGE_KEY); + } catch (e) { + return null; + } + } + + function currentTheme() { + return storedTheme() || preferredTheme(); + } + + function setTheme(theme) { + var next = theme === DARK ? DARK : LIGHT; + document.documentElement.classList.remove(LIGHT, DARK); + document.documentElement.classList.add(next); + if (document.body) { + document.body.classList.remove(LIGHT, DARK); + document.body.classList.add(next); + } + try { + localStorage.setItem(STORAGE_KEY, next); + } catch (e) { + // ignore storage errors + } + updateThemeIcons(next); + } + + function toggleTheme() { + setTheme(document.documentElement.classList.contains(DARK) ? LIGHT : DARK); + } + + function updateThemeIcons(theme) { + var btns = document.querySelectorAll('#tools a img, [data-theme-toggle] img'); + for (var i = 0; i < btns.length; i++) { + var img = btns[i]; + if (!img.src) { + continue; + } + if (/ic_brightness(_dark)?@2x\.png$/.test(img.src)) { + img.src = theme === LIGHT + ? img.src.replace(/ic_brightness(_dark)?@2x\.png$/, 'ic_brightness_dark@2x.png') + : img.src.replace(/ic_brightness(_dark)?@2x\.png$/, 'ic_brightness@2x.png'); + continue; + } + if (theme === LIGHT) { + if (!/_dark@2x\.png$/.test(img.src)) { + img.src = img.src.replace(/@2x\.png$/, '_dark@2x.png'); + } + } else { + img.src = img.src.replace(/_dark@2x\.png$/, '@2x.png'); + } + } + } + + function bindToggle(el) { + if (!el || el.dataset.themeBound === "true") { + return; + } + el.dataset.themeBound = "true"; + el.addEventListener("click", function (e) { + e.preventDefault(); + toggleTheme(); + }); + } + + function init() { + setTheme(currentTheme()); + bindToggle(document.getElementById("toggle-theme")); + var more = document.querySelectorAll("[data-theme-toggle]"); + for (var i = 0; i < more.length; i++) { + bindToggle(more[i]); + } + } + + window.toggleTheme = toggleTheme; + window.setTheme = setTheme; + + if (document.readyState === "loading") { + document.addEventListener("DOMContentLoaded", init); + } else { + init(); + } +})(); diff --git a/templates/base.tmpl b/templates/base.tmpl index 4440860..4944563 100644 --- a/templates/base.tmpl +++ b/templates/base.tmpl @@ -1,95 +1,106 @@ {{define "base"}} - +
{{ template "head" . }} + {{if .CustomCSS}}{{end}}Scheduled
{{end}}{{if .Title.String}}
+
{{if and .Monetization (not .IsOwner)}}
{{end}}
{{end}}
diff --git a/templates/chorus-collection.tmpl b/templates/chorus-collection.tmpl
index 742c544..8bc9a0b 100644
--- a/templates/chorus-collection.tmpl
+++ b/templates/chorus-collection.tmpl
@@ -1,236 +1,248 @@
{{define "collection"}}
-
+
+
{{.Description}}
{{end}} {{/*if not .Public/*}} {{/*end*/}} {{if .PinnedPosts}}This is your new blog.
Start writing, or customize your blog.
Check out our writing guide to see what else you can do, and get in touch anytime with questions or feedback.
+
{{end}}
diff --git a/templates/collection-archive.tmpl b/templates/collection-archive.tmpl
index 5256c58..370a31c 100644
--- a/templates/collection-archive.tmpl
+++ b/templates/collection-archive.tmpl
@@ -1,118 +1,130 @@
{{define "collection"}}
-
+
+
{{.Flash}}
{{if .CanShowScript}}
{{range .ExternalScripts}}{{end}}
{{if .Collection.Script}}{{end}}
{{end}}
+
{{end}}
diff --git a/templates/collection-post.tmpl b/templates/collection-post.tmpl
index 3d3132d..ec3d187 100644
--- a/templates/collection-post.tmpl
+++ b/templates/collection-post.tmpl
@@ -1,146 +1,158 @@
{{define "post"}}
-
+
+
Scheduled
{{end}}{{if .Title.String}}
+
{{if and .Monetization (not .IsOwner)}}
{{end}}
{{end}}
diff --git a/templates/collection-tags.tmpl b/templates/collection-tags.tmpl
index c8e8a12..0200d60 100644
--- a/templates/collection-tags.tmpl
+++ b/templates/collection-tags.tmpl
@@ -1,211 +1,223 @@
{{define "collection-tags"}}
-
+
+
+
{{end}}
diff --git a/templates/collection.tmpl b/templates/collection.tmpl
index 269004e..88d7dba 100644
--- a/templates/collection.tmpl
+++ b/templates/collection.tmpl
@@ -1,261 +1,273 @@
{{define "collection"}}
-
+
+
{{.DisplayDescription}}
{{end}} {{/*if not .Public/*}} {{/*end*/}} {{if .PinnedPosts}}This is your new blog.
Start writing, or customize your blog.
Check out our writing guide to see what else you can do, and get in touch anytime with questions or feedback.
{{.Flash}}
+
{{end}}
diff --git a/templates/edit-meta.tmpl b/templates/edit-meta.tmpl
index d3f93a8..732ee4c 100644
--- a/templates/edit-meta.tmpl
+++ b/templates/edit-meta.tmpl
@@ -1,375 +1,385 @@
{{define "edit-meta"}}

{{end}}
diff --git a/templates/password-collection.tmpl b/templates/password-collection.tmpl
index fde4edc..0aade95 100644
--- a/templates/password-collection.tmpl
+++ b/templates/password-collection.tmpl
@@ -1,88 +1,100 @@
{{define "password-collection"}}
-
+
+
+
{{end}}
diff --git a/templates/post.tmpl b/templates/post.tmpl
index ca1c1f9..334333b 100644
--- a/templates/post.tmpl
+++ b/templates/post.tmpl
@@ -1,102 +1,114 @@
{{define "post"}}
-
+
+
{{.Content}}
{{ else }}
+
{{end}}
diff --git a/templates/user/include/footer.tmpl b/templates/user/include/footer.tmpl
index 94bb182..5073ffd 100644
--- a/templates/user/include/footer.tmpl
+++ b/templates/user/include/footer.tmpl
@@ -1,42 +1,42 @@
{{define "footer"}}
{{template "foot" .}}
{{template "body-end" .}}
{{end}}
{{define "foot"}}
-
+
{{end}}
{{define "body-end"}}
{{end}}
diff --git a/templates/user/include/header.tmpl b/templates/user/include/header.tmpl
index ff57568..568c653 100644
--- a/templates/user/include/header.tmpl
+++ b/templates/user/include/header.tmpl
@@ -1,117 +1,129 @@
{{define "user-navigation"}}
New Post
New Post