mirror of
https://github.com/phil-opp/blog_os.git
synced 2025-12-16 22:37:49 +00:00
Change colors depending on preferred color scheme
This commit is contained in:
@@ -10,6 +10,7 @@
|
|||||||
*
|
*
|
||||||
* Fonts
|
* Fonts
|
||||||
* Body resets
|
* Body resets
|
||||||
|
* Dark/Light Mode
|
||||||
* Custom type
|
* Custom type
|
||||||
* Messages
|
* Messages
|
||||||
* Container
|
* Container
|
||||||
@@ -53,19 +54,77 @@ html {
|
|||||||
line-height: 1.5;
|
line-height: 1.5;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Dark/Light Mode */
|
||||||
|
|
||||||
|
@mixin set-colors-light {
|
||||||
|
--background-color: #fff;
|
||||||
|
--text-color: #515151;
|
||||||
|
--heading-color: #313131;
|
||||||
|
--heading-code-color: #a0565c;
|
||||||
|
--link-color: #268bd2;
|
||||||
|
--hr-color-top: #eee;
|
||||||
|
--hr-color-bottom: #fff;
|
||||||
|
--code-text-color: #bf616a;
|
||||||
|
--code-background-color: #f9f9f9;
|
||||||
|
--masthead-title-color: #505050;
|
||||||
|
--strong-color: #303030;
|
||||||
|
--masthead-subtitle: #c0c0c0;
|
||||||
|
--post-title-color: #228;
|
||||||
|
}
|
||||||
|
|
||||||
|
@mixin set-colors-dark {
|
||||||
|
--background-color: #121212;
|
||||||
|
--text-color: #f5f5f5;
|
||||||
|
--heading-color: #eee;
|
||||||
|
--heading-code-color: #eee;
|
||||||
|
--link-color: #c59ff3;
|
||||||
|
--hr-color-top: #333;
|
||||||
|
--hr-color-bottom: #000;
|
||||||
|
--code-text-color: #eeeeee;
|
||||||
|
--code-background-color: #222222;
|
||||||
|
--masthead-title-color: #a0a0a0;
|
||||||
|
--strong-color: #c0c0c0;
|
||||||
|
--masthead-subtitle: #6f6f6f;
|
||||||
|
--post-title-color: #c8c8ff;
|
||||||
|
}
|
||||||
|
|
||||||
body {
|
body {
|
||||||
color: #515151;
|
@include set-colors-light();
|
||||||
background-color: #fff;
|
}
|
||||||
|
|
||||||
|
body.dark {
|
||||||
|
@include set-colors-dark();
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Styles for users who prefer dark mode at the OS level */
|
||||||
|
|
||||||
|
@media (prefers-color-scheme: dark) {
|
||||||
|
/* defaults to dark theme */
|
||||||
|
body {
|
||||||
|
@include set-colors-dark();
|
||||||
|
}
|
||||||
|
/* Override dark mode with light mode styles if the user decides to swap */
|
||||||
|
body.light {
|
||||||
|
@include set-colors-light();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
body {
|
||||||
|
color: var(--text-color);
|
||||||
|
background-color: var(--background-color);
|
||||||
-webkit-text-size-adjust: 100%;
|
-webkit-text-size-adjust: 100%;
|
||||||
-ms-text-size-adjust: 100%;
|
-ms-text-size-adjust: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* No `:visited` state is required by default (browsers will use `a`) */
|
/* No `:visited` state is required by default (browsers will use `a`) */
|
||||||
|
|
||||||
a {
|
a {
|
||||||
color: #268bd2;
|
color: var(--link-color);
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* `:focus` is linked to `:hover` for basic accessibility */
|
/* `:focus` is linked to `:hover` for basic accessibility */
|
||||||
|
|
||||||
a:hover,
|
a:hover,
|
||||||
a:focus {
|
a:focus {
|
||||||
text-decoration: underline;
|
text-decoration: underline;
|
||||||
@@ -81,7 +140,7 @@ h6 {
|
|||||||
margin-bottom: 0.5rem;
|
margin-bottom: 0.5rem;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
line-height: 1.25;
|
line-height: 1.25;
|
||||||
color: #313131;
|
color: var(--heading-color);
|
||||||
text-rendering: optimizeLegibility;
|
text-rendering: optimizeLegibility;
|
||||||
}
|
}
|
||||||
h1 {
|
h1 {
|
||||||
@@ -109,7 +168,7 @@ p {
|
|||||||
}
|
}
|
||||||
|
|
||||||
strong {
|
strong {
|
||||||
color: #303030;
|
color: var(--strong-color);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Lists */
|
/* Lists */
|
||||||
@@ -145,8 +204,8 @@ hr {
|
|||||||
position: relative;
|
position: relative;
|
||||||
margin: 1.5rem 0;
|
margin: 1.5rem 0;
|
||||||
border: 0;
|
border: 0;
|
||||||
border-top: 1px solid #eee;
|
border-top: 1px solid var(--hr-color-top);
|
||||||
border-bottom: 1px solid #fff;
|
border-bottom: 1px solid var(--hr-color-bottom);
|
||||||
}
|
}
|
||||||
|
|
||||||
abbr {
|
abbr {
|
||||||
@@ -168,8 +227,8 @@ pre {
|
|||||||
code {
|
code {
|
||||||
padding: 0.25em 0.5em;
|
padding: 0.25em 0.5em;
|
||||||
font-size: 85%;
|
font-size: 85%;
|
||||||
color: #bf616a;
|
color: var(--code-text-color);
|
||||||
background-color: #f9f9f9;
|
background-color: var(--code-background-color);
|
||||||
border-radius: 3px;
|
border-radius: 3px;
|
||||||
}
|
}
|
||||||
pre {
|
pre {
|
||||||
@@ -182,7 +241,7 @@ pre {
|
|||||||
white-space: pre;
|
white-space: pre;
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
word-wrap: normal;
|
word-wrap: normal;
|
||||||
background-color: #f9f9f9;
|
background-color: var(--code-background-color);
|
||||||
}
|
}
|
||||||
pre code {
|
pre code {
|
||||||
padding: 0;
|
padding: 0;
|
||||||
@@ -238,7 +297,7 @@ th {
|
|||||||
}
|
}
|
||||||
tbody tr:nth-child(odd) td,
|
tbody tr:nth-child(odd) td,
|
||||||
tbody tr:nth-child(odd) th {
|
tbody tr:nth-child(odd) th {
|
||||||
background-color: #f9f9f9;
|
background-color: var(--code-background-color);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -263,7 +322,7 @@ tbody tr:nth-child(odd) th {
|
|||||||
margin-bottom: 1rem;
|
margin-bottom: 1rem;
|
||||||
padding: 1rem;
|
padding: 1rem;
|
||||||
color: #717171;
|
color: #717171;
|
||||||
background-color: #f9f9f9;
|
background-color: var(--code-background-color);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -294,15 +353,15 @@ tbody tr:nth-child(odd) th {
|
|||||||
.masthead-title {
|
.masthead-title {
|
||||||
margin-top: 0;
|
margin-top: 0;
|
||||||
margin-bottom: 0;
|
margin-bottom: 0;
|
||||||
color: #505050;
|
color: var(--masthead-title-color);
|
||||||
}
|
}
|
||||||
.masthead-title a {
|
.masthead-title a {
|
||||||
color: #505050;
|
color: var(--masthead-title-color);
|
||||||
}
|
}
|
||||||
.masthead small {
|
.masthead small {
|
||||||
font-size: 75%;
|
font-size: 75%;
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
color: #c0c0c0;
|
color: var(--masthead-subtitle);
|
||||||
letter-spacing: 0;
|
letter-spacing: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -321,7 +380,7 @@ tbody tr:nth-child(odd) th {
|
|||||||
.page-title,
|
.page-title,
|
||||||
.post-title,
|
.post-title,
|
||||||
.post-title a {
|
.post-title a {
|
||||||
color: #303030;
|
color: var(--post-title-color);
|
||||||
}
|
}
|
||||||
.page-title,
|
.page-title,
|
||||||
.post-title {
|
.post-title {
|
||||||
@@ -419,7 +478,7 @@ h4 code,
|
|||||||
h5 code,
|
h5 code,
|
||||||
h6 code {
|
h6 code {
|
||||||
padding: 0;
|
padding: 0;
|
||||||
color: #a0565c;
|
color: var(--heading-code-color);
|
||||||
font-size: 90%;
|
font-size: 90%;
|
||||||
background-color: inherit;
|
background-color: inherit;
|
||||||
}
|
}
|
||||||
@@ -716,7 +775,7 @@ aside.page-aside-right time {
|
|||||||
}
|
}
|
||||||
|
|
||||||
a code {
|
a code {
|
||||||
color: #268bd2;
|
color: var(--link-color);
|
||||||
}
|
}
|
||||||
|
|
||||||
a.zola-anchor {
|
a.zola-anchor {
|
||||||
|
|||||||
Reference in New Issue
Block a user