WIP Dark mode

This commit is contained in:
Eduardo 2019-09-29 00:02:59 +02:00
parent 92711fa35d
commit 371691a642
28 changed files with 105 additions and 84 deletions

View file

@ -1,6 +1,6 @@
# Liebling # Liebling
Liebling is a beautiful and clean Ghost theme that is easy and comfortable to use. **It's free** and you can use it for any kind of content you might have. Liebling is a beautiful and clean Ghost theme that is easy and comfortable to use. **It's free** and you can use it for any kind of content you might have. Now with dark mode 🌓!
If you use it and you like it, please consider to make a donation to support its development! 🙏🏼 If you use it and you like it, please consider to make a donation to support its development! 🙏🏼
@ -48,6 +48,7 @@ To get the latest version please head over the [releases page](https://github.co
### Liebling unique features ### Liebling unique features
* Dark mode
* Search * Search
* Custom Subscribe page * Custom Subscribe page
* Custom authors page * Custom authors page

View file

@ -54,5 +54,5 @@
"desktop": "assets/screenshot-desktop.jpg", "desktop": "assets/screenshot-desktop.jpg",
"mobile": "assets/screenshot-mobile.jpg" "mobile": "assets/screenshot-mobile.jpg"
}, },
"version": "0.4.1" "version": "0.5.0"
} }

View file

@ -1,3 +1,4 @@
import cssVars from 'css-vars-ponyfill'
import $ from 'jquery' import $ from 'jquery'
import slick from 'slick-carousel' import slick from 'slick-carousel'
import tippy from 'tippy.js' import tippy from 'tippy.js'
@ -5,6 +6,8 @@ import AOS from 'aos'
import GhostContentAPI from '@tryghost/content-api' import GhostContentAPI from '@tryghost/content-api'
import Fuse from 'fuse.js' import Fuse from 'fuse.js'
cssVars({})
$(document).ready(() => { $(document).ready(() => {
const isRTL = $('html').attr('lang') === 'ar' || $('html').attr('lang') === 'he' const isRTL = $('html').attr('lang') === 'ar' || $('html').attr('lang') === 'he'

46
src/package-lock.json generated
View file

@ -3531,6 +3531,11 @@
"integrity": "sha1-2bkoGtz9jO2TW9urqDeGiX9k6ZY=", "integrity": "sha1-2bkoGtz9jO2TW9urqDeGiX9k6ZY=",
"dev": true "dev": true
}, },
"css-vars-ponyfill": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/css-vars-ponyfill/-/css-vars-ponyfill-2.1.2.tgz",
"integrity": "sha512-Jfff/j2AGwr+WJaIbxVroTa9sFXy9b0xe5zjWEVQ9aoeCpd0e6iOo4D+d3OoLDTWcHCf2UBTswis/hN6fKEKiA=="
},
"css-what": { "css-what": {
"version": "2.1.3", "version": "2.1.3",
"resolved": "https://registry.npmjs.org/css-what/-/css-what-2.1.3.tgz", "resolved": "https://registry.npmjs.org/css-what/-/css-what-2.1.3.tgz",
@ -5447,8 +5452,7 @@
"ansi-regex": { "ansi-regex": {
"version": "2.1.1", "version": "2.1.1",
"bundled": true, "bundled": true,
"dev": true, "dev": true
"optional": true
}, },
"aproba": { "aproba": {
"version": "1.2.0", "version": "1.2.0",
@ -5469,14 +5473,12 @@
"balanced-match": { "balanced-match": {
"version": "1.0.0", "version": "1.0.0",
"bundled": true, "bundled": true,
"dev": true, "dev": true
"optional": true
}, },
"brace-expansion": { "brace-expansion": {
"version": "1.1.11", "version": "1.1.11",
"bundled": true, "bundled": true,
"dev": true, "dev": true,
"optional": true,
"requires": { "requires": {
"balanced-match": "^1.0.0", "balanced-match": "^1.0.0",
"concat-map": "0.0.1" "concat-map": "0.0.1"
@ -5491,20 +5493,17 @@
"code-point-at": { "code-point-at": {
"version": "1.1.0", "version": "1.1.0",
"bundled": true, "bundled": true,
"dev": true, "dev": true
"optional": true
}, },
"concat-map": { "concat-map": {
"version": "0.0.1", "version": "0.0.1",
"bundled": true, "bundled": true,
"dev": true, "dev": true
"optional": true
}, },
"console-control-strings": { "console-control-strings": {
"version": "1.1.0", "version": "1.1.0",
"bundled": true, "bundled": true,
"dev": true, "dev": true
"optional": true
}, },
"core-util-is": { "core-util-is": {
"version": "1.0.2", "version": "1.0.2",
@ -5621,8 +5620,7 @@
"inherits": { "inherits": {
"version": "2.0.3", "version": "2.0.3",
"bundled": true, "bundled": true,
"dev": true, "dev": true
"optional": true
}, },
"ini": { "ini": {
"version": "1.3.5", "version": "1.3.5",
@ -5634,7 +5632,6 @@
"version": "1.0.0", "version": "1.0.0",
"bundled": true, "bundled": true,
"dev": true, "dev": true,
"optional": true,
"requires": { "requires": {
"number-is-nan": "^1.0.0" "number-is-nan": "^1.0.0"
} }
@ -5649,7 +5646,6 @@
"version": "3.0.4", "version": "3.0.4",
"bundled": true, "bundled": true,
"dev": true, "dev": true,
"optional": true,
"requires": { "requires": {
"brace-expansion": "^1.1.7" "brace-expansion": "^1.1.7"
} }
@ -5657,14 +5653,12 @@
"minimist": { "minimist": {
"version": "0.0.8", "version": "0.0.8",
"bundled": true, "bundled": true,
"dev": true, "dev": true
"optional": true
}, },
"minipass": { "minipass": {
"version": "2.3.5", "version": "2.3.5",
"bundled": true, "bundled": true,
"dev": true, "dev": true,
"optional": true,
"requires": { "requires": {
"safe-buffer": "^5.1.2", "safe-buffer": "^5.1.2",
"yallist": "^3.0.0" "yallist": "^3.0.0"
@ -5683,7 +5677,6 @@
"version": "0.5.1", "version": "0.5.1",
"bundled": true, "bundled": true,
"dev": true, "dev": true,
"optional": true,
"requires": { "requires": {
"minimist": "0.0.8" "minimist": "0.0.8"
} }
@ -5764,8 +5757,7 @@
"number-is-nan": { "number-is-nan": {
"version": "1.0.1", "version": "1.0.1",
"bundled": true, "bundled": true,
"dev": true, "dev": true
"optional": true
}, },
"object-assign": { "object-assign": {
"version": "4.1.1", "version": "4.1.1",
@ -5777,7 +5769,6 @@
"version": "1.4.0", "version": "1.4.0",
"bundled": true, "bundled": true,
"dev": true, "dev": true,
"optional": true,
"requires": { "requires": {
"wrappy": "1" "wrappy": "1"
} }
@ -5863,8 +5854,7 @@
"safe-buffer": { "safe-buffer": {
"version": "5.1.2", "version": "5.1.2",
"bundled": true, "bundled": true,
"dev": true, "dev": true
"optional": true
}, },
"safer-buffer": { "safer-buffer": {
"version": "2.1.2", "version": "2.1.2",
@ -5900,7 +5890,6 @@
"version": "1.0.2", "version": "1.0.2",
"bundled": true, "bundled": true,
"dev": true, "dev": true,
"optional": true,
"requires": { "requires": {
"code-point-at": "^1.0.0", "code-point-at": "^1.0.0",
"is-fullwidth-code-point": "^1.0.0", "is-fullwidth-code-point": "^1.0.0",
@ -5920,7 +5909,6 @@
"version": "3.0.1", "version": "3.0.1",
"bundled": true, "bundled": true,
"dev": true, "dev": true,
"optional": true,
"requires": { "requires": {
"ansi-regex": "^2.0.0" "ansi-regex": "^2.0.0"
} }
@ -5964,14 +5952,12 @@
"wrappy": { "wrappy": {
"version": "1.0.2", "version": "1.0.2",
"bundled": true, "bundled": true,
"dev": true, "dev": true
"optional": true
}, },
"yallist": { "yallist": {
"version": "3.0.3", "version": "3.0.3",
"bundled": true, "bundled": true,
"dev": true, "dev": true
"optional": true
} }
} }
}, },

View file

@ -29,6 +29,7 @@
"dependencies": { "dependencies": {
"@tryghost/content-api": "^1.0.0", "@tryghost/content-api": "^1.0.0",
"aos": "^2.3.4", "aos": "^2.3.4",
"css-vars-ponyfill": "^2.1.2",
"fitvids": "^2.0.0", "fitvids": "^2.0.0",
"fuse.js": "^3.4.2", "fuse.js": "^3.4.2",
"jquery": "^3.3.1", "jquery": "^3.3.1",

View file

@ -2,6 +2,7 @@
@import "common/reset"; @import "common/reset";
@import "common/mixins"; @import "common/mixins";
@import "common/colors";
@import "common/variables"; @import "common/variables";
@import "common/helpers"; @import "common/helpers";
@import "common/global"; @import "common/global";

View file

@ -0,0 +1,29 @@
:root {
--background-color: #fff;
--primary-foreground-color: #4a4a4a;
--secondary-foreground-color: #000;
--primary-subtle-color: #04aeee;
--secondary-subtle-color: #f4f8fd;
--titles-color: #333;
--link-color: #293951;
--primary-border-color: #9b9b9b;
--secondary-border-color: aliceblue;
--article-shadow: 0 4px 60px 0 rgba(0,0,0,.2);
--foter-background-color: #293951;
}
@media (prefers-color-scheme: dark) {
:root {
--background-color: #111;
--primary-foreground-color: #ccc;
--secondary-foreground-color: #fff;
--primary-subtle-color: #04aeee;
--secondary-subtle-color: #141920;
--titles-color: #b4b4b4;
--link-color: #2c5de6;
--primary-border-color: #9b9b9b;
--secondary-border-color: #0f0f0f;
--article-shadow: 0 4px 0px 10px rgba(0,0,0,.2);
--foter-background-color: #080808;
}
}

View file

@ -5,12 +5,12 @@ body {
flex-direction: column; flex-direction: column;
width: 100%; width: 100%;
min-height: 100vh; min-height: 100vh;
color: $body; color: var(--primary-foreground-color);
font-size: 1rem; font-size: 1rem;
font-family: 'Source Sans Pro', Helvetica, Arial, sans-serif; font-family: 'Source Sans Pro', Helvetica, Arial, sans-serif;
font-display: swap; font-display: swap;
overflow-x: hidden; overflow-x: hidden;
background-color: white; background-color: var(--background-color);
-webkit-font-smoothing: antialiased; -webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale; -moz-osx-font-smoothing: grayscale;
@ -56,17 +56,17 @@ fieldset {
} }
::-webkit-input-placeholder { ::-webkit-input-placeholder {
color: $gray; color: var(--primary-border-color);
} }
::-moz-placeholder { ::-moz-placeholder {
color: $gray; color: var(--primary-border-color);
} }
:-ms-input-placeholder { :-ms-input-placeholder {
color: $gray; color: var(--primary-border-color);
} }
:-moz-placeholder { :-moz-placeholder {
color: $gray; color: var(--primary-border-color);
} }

View file

@ -1,8 +1,4 @@
@charset "UTF-8"; /** Helpers */
/**
* Helpers
*/
.hide { .hide {
display: none; display: none;

View file

@ -1,4 +1,5 @@
/** Colors */ /** Colors */
$white: #fff; $white: #fff;
$black: #000; $black: #000;
$main-color: #04aeee; $main-color: #04aeee;
@ -8,7 +9,8 @@ $light-blue: #f4f8fd;
$dark-blue: #293951; $dark-blue: #293951;
$gray: #9b9b9b; $gray: #9b9b9b;
/** Box Model */ /** Config */
$mobile-space: 20px; $mobile-space: 20px;
$mobile-bar-height: 50px; $mobile-bar-height: 50px;
$desktop-bar-height: 64px; $desktop-bar-height: 64px;

View file

@ -1,5 +1,5 @@
.m-404-subtitle { .m-404-subtitle {
color: $body; color: var(--primary-foreground-color);
letter-spacing: 0.4px; letter-spacing: 0.4px;
line-height: 1; line-height: 1;
font-size: 1.250rem; font-size: 1.250rem;

View file

@ -1,5 +1,5 @@
.m-404-title { .m-404-title {
color: $body; color: var(--primary-foreground-color);
letter-spacing: 3px; letter-spacing: 3px;
line-height: 1; line-height: 1;
font-size: 9.000rem; font-size: 9.000rem;

View file

@ -1,6 +1,6 @@
.m-footer { .m-footer {
flex-shrink: 0; flex-shrink: 0;
background-color: $dark-blue; background-color: var(--foter-background-color);
} }
.m-footer__content { .m-footer__content {

View file

@ -4,9 +4,9 @@
position: relative; position: relative;
margin-bottom: 20px; margin-bottom: 20px;
height: 400px; height: 400px;
background-color: $white; background-color: var(--background-color);
border-radius: 10px; border-radius: 10px;
border: 1px solid aliceblue; border: 1px solid var(--secondary-border-color);
z-index: 1; z-index: 1;
@include transition(all .25s cubic-bezier(.02,.01,.47,1)); @include transition(all .25s cubic-bezier(.02,.01,.47,1));
@ -14,7 +14,7 @@
@include transform(translateY(-5px)); @include transform(translateY(-5px));
&:before { &:before {
@include bs(0 4px 60px 0 rgba(0,0,0,.2)); @include bs(var(--article-shadow));
} }
.m-article-card__author { .m-article-card__author {
@ -43,7 +43,7 @@
} }
.m-article-card__info { .m-article-card__info {
background-color: $light-blue; background-color: var(--secondary-subtle-color);
} }
.m-article-card__title { .m-article-card__title {
@ -94,7 +94,7 @@
position: relative; position: relative;
height: 200px; height: 200px;
border-radius: 10px 10px 0 0; border-radius: 10px 10px 0 0;
background-color: $light-blue; background-color: var(--secondary-subtle-color);
background-repeat: no-repeat; background-repeat: no-repeat;
background-position: center; background-position: center;
background-size: cover; background-size: cover;
@ -191,7 +191,7 @@
height: 200px; height: 200px;
overflow: hidden; overflow: hidden;
border-radius: 0 0 10px 10px; border-radius: 0 0 10px 10px;
background-color: $white; background-color: var(--background-color);
@include respond-to('medium') { @include respond-to('medium') {
padding-top: 53px; padding-top: 53px;
@ -214,7 +214,7 @@
position: absolute; position: absolute;
top: $mobile-space; top: $mobile-space;
left: $mobile-space; left: $mobile-space;
color: $dark-blue; color: var(--link-color);
letter-spacing: 0.2px; letter-spacing: 0.2px;
font-size: 0.875rem; font-size: 0.875rem;
font-weight: 600; font-weight: 600;
@ -240,7 +240,7 @@
} }
.m-article-card__title { .m-article-card__title {
color: $titles; color: var(--titles-color);
letter-spacing: 0.4px; letter-spacing: 0.4px;
line-height: 1.3; line-height: 1.3;
font-size: 1.250rem; font-size: 1.250rem;
@ -257,7 +257,7 @@
position: relative; position: relative;
overflow: hidden; overflow: hidden;
height: 100%; height: 100%;
color: $titles; color: var(--titles-color);
letter-spacing: 0.3px; letter-spacing: 0.3px;
line-height: 1.5; line-height: 1.5;
font-size: 1rem; font-size: 1rem;
@ -276,7 +276,7 @@
.m-article-card__author-stats { .m-article-card__author-stats {
display: flex; display: flex;
align-items: center; align-items: center;
color: $titles; color: var(--titles-color);
letter-spacing: 0.2px; letter-spacing: 0.2px;
font-size: 0.875rem; font-size: 0.875rem;
@ -308,7 +308,7 @@
margin-left: 22px; margin-left: 22px;
a { a {
color: $body; color: var(--primary-foreground-color);
font-size: 0.938rem; font-size: 0.938rem;
span { span {

View file

@ -1,8 +1,10 @@
.m-author { .m-author {
padding: 40px $mobile-space; padding: 40px $mobile-space;
border-color: $light-blue; border-color: var(--secondary-subtle-color);
border-top-width: 2px; border-top-width: 2px;
border-bottom-width: 2px; border-bottom-width: 2px;
border-left-width: 0;
border-right-width: 0;
border-style: solid; border-style: solid;
margin: 0 auto; margin: 0 auto;
@ -17,7 +19,7 @@
} }
&.no-subscribers { &.no-subscribers {
background-color: $light-blue; background-color: var(--secondary-subtle-color);
} }
} }

View file

@ -15,7 +15,7 @@
top: 50%; top: 50%;
height: 1px; height: 1px;
z-index: 1; z-index: 1;
background-color: $light-blue; background-color: var(--secondary-subtle-color);
} }
.m-load-comments__iframe { .m-load-comments__iframe {

View file

@ -12,7 +12,7 @@
&.fixed { &.fixed {
position: fixed; position: fixed;
opacity: 0; opacity: 0;
background-color: $white; background-color: var(--background-color);
@include transform(translateY(-100%)); @include transform(translateY(-100%));
@include bs(0 4px 8px rgba(0, 0, 0, 0.05)); @include bs(0 4px 8px rgba(0, 0, 0, 0.05));
@include transition(transform 0.4s cubic-bezier(0.165, 0.84, 0.44, 1)); @include transition(transform 0.4s cubic-bezier(0.165, 0.84, 0.44, 1));
@ -28,7 +28,7 @@
} }
&.submenu-is-active { &.submenu-is-active {
background-color: $white; background-color: var(--background-color);
.m-header__shadow { .m-header__shadow {
display: none; display: none;
@ -36,6 +36,6 @@
} }
&.with-picture { &.with-picture {
background-color: $white; background-color: var(--background-color);
} }
} }

View file

@ -23,7 +23,7 @@
} }
li { li {
color: $titles; color: var(--titles-color);
letter-spacing: 0.3px; letter-spacing: 0.3px;
font-size: 1.125rem; font-size: 1.125rem;
margin-bottom: 15px; margin-bottom: 15px;

View file

@ -42,7 +42,7 @@
} }
.m-recent-article__title { .m-recent-article__title {
color: $titles; color: var(--titles-color);
letter-spacing: 0.2px; letter-spacing: 0.2px;
line-height: 1.438rem; line-height: 1.438rem;
font-size: 1rem; font-size: 1rem;
@ -56,7 +56,7 @@
} }
.m-recent-article__date { .m-recent-article__date {
color: $titles; color: var(--titles-color);
letter-spacing: 0.15px; letter-spacing: 0.15px;
font-size: 0.813rem; font-size: 0.813rem;
} }

View file

@ -8,8 +8,8 @@
left: 0; left: 0;
width: 100%; width: 100%;
padding: 30px 0 20px 0; padding: 30px 0 20px 0;
background-color: $white; background-color: var(--background-color);
border-top: 1px solid aliceblue; border-top: 1px solid var(--secondary-border-color);
z-index: 5; z-index: 5;
@include bs(0 60px 60px rgba(0,0,0,0.25)); @include bs(0 60px 60px rgba(0,0,0,0.25));
} }

View file

@ -15,7 +15,7 @@
} }
a { a {
color: $dark-blue; color: var(--link-color);
} }
} }
} }

View file

@ -4,7 +4,7 @@
min-height: 365px; min-height: 365px;
overflow: hidden; overflow: hidden;
padding: 100px 0 75px; padding: 100px 0 75px;
background-color: $light-blue; background-color: var(--secondary-subtle-color);
@extend .content-centered; @extend .content-centered;
@include respond-to('medium') { @include respond-to('medium') {
@ -14,7 +14,7 @@
&.with-picture { &.with-picture {
color: $white; color: $white;
background-color: darken($body, 25%); background-color: $black;
@include respond-to('medium') { @include respond-to('medium') {
min-height: 450px; min-height: 450px;

View file

@ -18,7 +18,7 @@
} }
.m-result__title { .m-result__title {
color: $body; color: var(--primary-foreground-color);
letter-spacing: 0.3px; letter-spacing: 0.3px;
line-height: 1.4; line-height: 1.4;
font-size: 1rem; font-size: 1rem;

View file

@ -1,6 +1,6 @@
.m-subscribe-section { .m-subscribe-section {
padding: 50px 0; padding: 50px 0;
background-color: $light-blue; background-color: var(--secondary-subtle-color);
@include respond-to('medium') { @include respond-to('medium') {
padding: 80px 0; padding: 80px 0;

View file

@ -16,7 +16,7 @@
@include transition(all .25s cubic-bezier(.02,.01,.47,1)); @include transition(all .25s cubic-bezier(.02,.01,.47,1));
&.outlined { &.outlined {
border: 1px solid $body; border: 1px solid var(--primary-foreground-color);
} }
&.filled, &.filled,

View file

@ -1,5 +1,5 @@
.m-icon-button { .m-icon-button {
color: $titles; color: var(--titles-color);
font-size: 1.125rem; font-size: 1.125rem;
border: 0; border: 0;
outline: 0; outline: 0;
@ -11,11 +11,11 @@
&.outlined { &.outlined {
border-radius: 50%; border-radius: 50%;
border: 1px solid $body; border: 1px solid var(--primary-foreground-color);
} }
&.filled { &.filled {
background-color: $white; background-color: var(--background-color);
border-radius: 50%; border-radius: 50%;
@include bs(0 2px 4px rgba(108, 108, 108, 0.2)); @include bs(0 2px 4px rgba(108, 108, 108, 0.2));
@include transition(all .25s cubic-bezier(.02,.01,.47,1)); @include transition(all .25s cubic-bezier(.02,.01,.47,1));
@ -52,7 +52,7 @@
height: 32px; height: 32px;
font-size: 0.625rem; font-size: 0.625rem;
z-index: 2; z-index: 2;
background-color: $white; background-color: var(--background-color);
@include respond-to('medium') { @include respond-to('medium') {
top: 30px; top: 30px;
@ -113,7 +113,7 @@
&.in-featured-articles { &.in-featured-articles {
position: absolute; position: absolute;
color: $white; color: var(--background-color);
font-size: 0.875rem; font-size: 0.875rem;
width: 29px; width: 29px;
height: 22px; height: 22px;
@ -175,7 +175,7 @@
} }
&.in-share { &.in-share {
color: $titles; color: var(--titles-color);
font-size: 0.750rem; font-size: 0.750rem;
text-decoration: none; text-decoration: none;
width: 31px; width: 31px;

View file

@ -1,5 +1,5 @@
.m-section-title { .m-section-title {
color: $body; color: var(--primary-foreground-color);
text-align: center; text-align: center;
letter-spacing: 0.3px; letter-spacing: 0.3px;
line-height: 1.3; line-height: 1.3;

View file

@ -411,7 +411,7 @@
} }
button:not(.m-icon-button) { button:not(.m-icon-button) {
border: 1px solid $body !important; border: 1px solid var(--primary-foreground-color) !important;
@extend .m-button; @extend .m-button;
} }
@ -432,7 +432,7 @@
.kg-bookmark-container { .kg-bookmark-container {
display: flex; display: flex;
color: $body; color: var(--primary-foreground-color);
text-decoration: none !important; text-decoration: none !important;
min-height: 148px; min-height: 148px;
box-shadow: rgba(0, 0, 0, 0.1) 0px 1px 4px, box-shadow: rgba(0, 0, 0, 0.1) 0px 1px 4px,