Merge pull request #23 from welpo/style/default-light-mode
💄 style: default light mode
This commit is contained in:
commit
c26c826471
12
README.md
12
README.md
@ -6,15 +6,15 @@ A simple blog theme powered by [Zola](getzola.org). See a live preview [here](ht
|
|||||||
|
|
||||||
|
|
||||||
<details open>
|
<details open>
|
||||||
<summary>Dark theme</summary>
|
<summary>Light theme</summary>
|
||||||
|
|
||||||

|

|
||||||
</details>
|
</details>
|
||||||
|
|
||||||
<details close>
|
<details close>
|
||||||
<summary>Light theme</summary>
|
<summary>Dark theme</summary>
|
||||||
|
|
||||||

|

|
||||||
</details>
|
</details>
|
||||||
|
|
||||||
## Features
|
## Features
|
||||||
|
@ -23,26 +23,6 @@
|
|||||||
font-family: 'Inter', Arial, Helvetica, sans-serif;
|
font-family: 'Inter', Arial, Helvetica, sans-serif;
|
||||||
line-height: 190%;
|
line-height: 190%;
|
||||||
|
|
||||||
--bg-0: #818181;
|
|
||||||
--bg-1: rgba(133, 133, 133, 0.5);
|
|
||||||
--bg-2: rgba(23, 23, 23, 100%);
|
|
||||||
--primary-color: #ef5350;
|
|
||||||
--hover-color: white;
|
|
||||||
--background-color: #1f1f1f;
|
|
||||||
--secondary-color: #696969;
|
|
||||||
--highlights: #b35a5a;
|
|
||||||
--links: #d35d6e;
|
|
||||||
--text-color: #e1e1e1;
|
|
||||||
--code: #ef476f;
|
|
||||||
--border-color: rgb(0, 0, 0);
|
|
||||||
--light-border-color: rgba(255, 255, 255, 0.1);
|
|
||||||
--input-back: #4b4a4a;
|
|
||||||
--input-color: #294797;
|
|
||||||
--meta-color: rgb(198, 197, 197);
|
|
||||||
--accent-color: #ff9a8c;
|
|
||||||
}
|
|
||||||
|
|
||||||
[data-theme='light'] {
|
|
||||||
--bg-0: #fff;
|
--bg-0: #fff;
|
||||||
--bg-1: #e7e7e7;
|
--bg-1: #e7e7e7;
|
||||||
--bg-2: #fefefe;
|
--bg-2: #fefefe;
|
||||||
@ -62,6 +42,25 @@
|
|||||||
--accent-color: #aacb73;
|
--accent-color: #aacb73;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[data-theme='dark'] {
|
||||||
|
--bg-0: #818181;
|
||||||
|
--bg-1: rgba(133, 133, 133, 0.5);
|
||||||
|
--bg-2: rgba(23, 23, 23, 100%);
|
||||||
|
--primary-color: #ef5350;
|
||||||
|
--hover-color: white;
|
||||||
|
--background-color: #1f1f1f;
|
||||||
|
--secondary-color: #696969;
|
||||||
|
--highlights: #b35a5a;
|
||||||
|
--links: #d35d6e;
|
||||||
|
--text-color: #e1e1e1;
|
||||||
|
--code: #ef476f;
|
||||||
|
--border-color: rgb(0, 0, 0);
|
||||||
|
--light-border-color: rgba(255, 255, 255, 0.1);
|
||||||
|
--input-back: #4b4a4a;
|
||||||
|
--input-color: #294797;
|
||||||
|
--meta-color: rgb(198, 197, 197);
|
||||||
|
--accent-color: #ff9a8c;
|
||||||
|
}
|
||||||
html {
|
html {
|
||||||
background-color: var(--background-color);
|
background-color: var(--background-color);
|
||||||
color: var(--text-color);
|
color: var(--text-color);
|
||||||
|
@ -40,10 +40,18 @@ footer {
|
|||||||
width: 32px;
|
width: 32px;
|
||||||
height: 32px;
|
height: 32px;
|
||||||
padding: 18px;
|
padding: 18px;
|
||||||
|
filter: invert(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
.social {
|
||||||
|
&:hover {
|
||||||
|
&>img {
|
||||||
filter: invert(1);
|
filter: invert(1);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
[data-theme="light"] {
|
}
|
||||||
|
|
||||||
|
[data-theme="dark"] {
|
||||||
.social {
|
.social {
|
||||||
&:hover {
|
&:hover {
|
||||||
&>img {
|
&>img {
|
||||||
@ -52,7 +60,7 @@ footer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
&>img {
|
&>img {
|
||||||
filter: none;
|
filter: invert(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -23,20 +23,20 @@
|
|||||||
border: none;
|
border: none;
|
||||||
}
|
}
|
||||||
.sun {
|
.sun {
|
||||||
opacity: 1;
|
opacity: 0;
|
||||||
}
|
}
|
||||||
.moon {
|
.moon {
|
||||||
opacity: 0;
|
opacity: 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
input {
|
input {
|
||||||
display: none;
|
display: none;
|
||||||
&:checked + .switch {
|
&:checked + .switch {
|
||||||
.sun {
|
.sun {
|
||||||
opacity: 0;
|
opacity: 1;
|
||||||
}
|
}
|
||||||
.moon {
|
.moon {
|
||||||
opacity: 1;
|
opacity: 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
.z-code {
|
.z-code {
|
||||||
color: #bfbab0;
|
color: #bfbab0;
|
||||||
background-color: #151515;
|
background-color: #272430;
|
||||||
}
|
}
|
||||||
[data-theme="light"] .z-code {
|
[data-theme="dark"] .z-code {
|
||||||
background-color: #272430
|
background-color: #151515;
|
||||||
}
|
}
|
||||||
.z-comment,
|
.z-comment,
|
||||||
.z-punctuation.z-definition.z-comment {
|
.z-punctuation.z-definition.z-comment {
|
||||||
|
@ -6,7 +6,7 @@ var currentTheme = localStorage.getItem('theme');
|
|||||||
// check what is current theme right now and activate it
|
// check what is current theme right now and activate it
|
||||||
if (currentTheme) {
|
if (currentTheme) {
|
||||||
document.documentElement.setAttribute('data-theme', currentTheme);
|
document.documentElement.setAttribute('data-theme', currentTheme);
|
||||||
if (currentTheme === 'light') {
|
if (currentTheme === 'dark') {
|
||||||
themeSwitcher.checked = true;
|
themeSwitcher.checked = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -14,14 +14,14 @@ if (currentTheme) {
|
|||||||
// switch between themes
|
// switch between themes
|
||||||
function switchTheme(e) {
|
function switchTheme(e) {
|
||||||
if (e.target.checked) {
|
if (e.target.checked) {
|
||||||
|
document.documentElement.setAttribute('data-theme', 'dark');
|
||||||
|
localStorage.setItem('theme', 'dark');
|
||||||
|
}
|
||||||
|
else {
|
||||||
document.documentElement.setAttribute('data-theme', 'light');
|
document.documentElement.setAttribute('data-theme', 'light');
|
||||||
localStorage.setItem('theme', 'light');
|
localStorage.setItem('theme', 'light');
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
document.documentElement.setAttribute('data-theme', 'dark');
|
|
||||||
localStorage.setItem('theme', 'dark');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// event listener on checkbox change
|
// event listener on checkbox change
|
||||||
themeSwitcher.addEventListener('change', switchTheme, false);
|
themeSwitcher.addEventListener('change', switchTheme, false);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user