Merge style sheets for light and dark themes into a single resource
This will avoid having inline style, which is annoying for stricter CSP. It should improve performances, as there is only a single file to load. As a bonus, I also included resource fingerprinting, which will avoid breaking the cache when it's not needed, and adds subresource integrity checksum.
This commit is contained in:
parent
9e524ff754
commit
db7e6254fa
5 changed files with 29 additions and 24 deletions
24
assets/css/dark.css
Normal file
24
assets/css/dark.css
Normal file
|
@ -0,0 +1,24 @@
|
|||
/* dark.css */
|
||||
--font-color: #eee;
|
||||
--bg-color: #212121;
|
||||
|
||||
--link-color:#599ada;
|
||||
--link-state-color:#ff5858;
|
||||
--link-state-border-color: rgba(238, 54, 54, 0.5);
|
||||
|
||||
--thead-bg-color: #343a40;
|
||||
--table-border-color: lightgrey;
|
||||
|
||||
--pre-color: #333;
|
||||
--pre-bg-color: #f1f1f1;
|
||||
|
||||
--bq-color: #ccc;
|
||||
--hr-color: #333;
|
||||
|
||||
--pagination-bg-color: #373737;
|
||||
--pagination-link-color: #b6b6b6;
|
||||
|
||||
--post-info-color: grey;
|
||||
|
||||
--switcher-color: #333;
|
||||
--switcher-bg-color: #fff;
|
26
assets/css/light.css
Normal file
26
assets/css/light.css
Normal file
|
@ -0,0 +1,26 @@
|
|||
:root {
|
||||
/* light.css */
|
||||
--font-color: #333;
|
||||
--bg-color: #fff;
|
||||
|
||||
--link-color:#1d60a3;
|
||||
--link-state-color:#a31d1d;
|
||||
--link-state-border-color: rgba(163, 29, 29, .5);
|
||||
|
||||
--thead-bg-color: lightgrey;
|
||||
--table-border-color: lightgrey;
|
||||
|
||||
--pre-color: #333;
|
||||
--pre-bg-color: #f1f1f1;
|
||||
|
||||
--bq-color: #ccc;
|
||||
--hr-color: #ccc;
|
||||
|
||||
--pagination-bg-color: #fafafa;
|
||||
--pagination-link-color: #696969;
|
||||
|
||||
--post-info-color: grey;
|
||||
|
||||
--switcher-color: #fff;
|
||||
--switcher-bg-color: #333;
|
||||
}
|
527
assets/css/main.css
Normal file
527
assets/css/main.css
Normal file
|
@ -0,0 +1,527 @@
|
|||
{{ $light := resources.Get "css/light.css" }}
|
||||
{{ $dark := resources.Get "css/dark.css" }}
|
||||
|
||||
{{ $light.Content }}
|
||||
|
||||
{{ if eq site.Params.style "dark-without-switcher" }}
|
||||
:root {
|
||||
{{ $dark.Content }}
|
||||
}
|
||||
{{ else if eq site.Params.style "auto-without-switcher" }}
|
||||
@media (prefers-color-scheme: dark) {
|
||||
:root {
|
||||
{{ $dark.Content }}
|
||||
}
|
||||
}
|
||||
{{else }}
|
||||
[data-theme="dark"] {
|
||||
{{ $dark.Content }}
|
||||
}
|
||||
{{ end }}
|
||||
|
||||
/* Basic */
|
||||
html {
|
||||
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
|
||||
/* 1 */
|
||||
-ms-text-size-adjust: 100%;
|
||||
/* 2 */
|
||||
-webkit-text-size-adjust: 100%;
|
||||
/* 2 */
|
||||
}
|
||||
|
||||
body {
|
||||
margin: 0;
|
||||
font-size: 18px;
|
||||
line-height: 1.5;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
color: var(--font-color);
|
||||
background: var(--bg-color);
|
||||
}
|
||||
|
||||
article,
|
||||
aside,
|
||||
details,
|
||||
figcaption,
|
||||
figure,
|
||||
footer,
|
||||
header,
|
||||
hgroup,
|
||||
main,
|
||||
menu,
|
||||
nav,
|
||||
section,
|
||||
summary {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.container {
|
||||
max-width: 42em;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
main {
|
||||
outline:none;
|
||||
}
|
||||
|
||||
/* Headers */
|
||||
h1 {
|
||||
font-size: 1.35em;
|
||||
}
|
||||
|
||||
h2 {
|
||||
font-size: 1.2em;
|
||||
}
|
||||
|
||||
h3 {
|
||||
font-size: 1.1em;
|
||||
}
|
||||
|
||||
/* Links */
|
||||
|
||||
a {
|
||||
color: var(--link-color);
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
a:hover,
|
||||
a:focus,
|
||||
a:active {
|
||||
color: var(--link-state-color);
|
||||
border-bottom: 1px solid var(--link-state-border-color);
|
||||
}
|
||||
|
||||
a:active,
|
||||
a:hover {
|
||||
outline: 0;
|
||||
}
|
||||
|
||||
a:active {
|
||||
opacity: 0.9;
|
||||
}
|
||||
|
||||
a.skip-main {
|
||||
left:-999px;
|
||||
position:absolute;
|
||||
top:auto;
|
||||
width:1px;
|
||||
height:1px;
|
||||
overflow:hidden;
|
||||
z-index:-999;
|
||||
}
|
||||
|
||||
a.skip-main:focus,
|
||||
a.skip-main:active {
|
||||
left: auto;
|
||||
top: 0px;
|
||||
width: auto;
|
||||
height: auto;
|
||||
overflow:auto;
|
||||
z-index:999;
|
||||
padding: 4px 6px 4px 6px;
|
||||
text-decoration: underline;
|
||||
border: none;
|
||||
}
|
||||
|
||||
/* Table */
|
||||
thead {
|
||||
background: var(--thead-bg-color);
|
||||
}
|
||||
|
||||
.table-wrapper {
|
||||
overflow-x: auto;
|
||||
}
|
||||
|
||||
table {
|
||||
max-width: 100%;
|
||||
border-spacing: 0;
|
||||
}
|
||||
|
||||
|
||||
th, td {
|
||||
padding: 0.5em 1em;
|
||||
border: 1px double var(--table-border-color);
|
||||
}
|
||||
|
||||
/* Code */
|
||||
pre {
|
||||
color: var(--pre-color);
|
||||
background-color: var(--pre-bg-color);
|
||||
padding: 1em;
|
||||
max-width: 100%;
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
code,
|
||||
pre,
|
||||
kbd {
|
||||
font-family: monospace;
|
||||
font-size: 0.90em;
|
||||
line-height: 154%;
|
||||
}
|
||||
|
||||
/* Styles */
|
||||
|
||||
blockquote {
|
||||
border-left: 2px solid var(--bq-color);
|
||||
padding: 0.1em 1em;
|
||||
margin-left: 0.75em;
|
||||
}
|
||||
|
||||
p {
|
||||
margin-top: 0.5em;
|
||||
margin-bottom: 0.5em;
|
||||
}
|
||||
|
||||
hr {
|
||||
border-top: 1px solid var(--hr-color);
|
||||
height: 1px;
|
||||
border: 0;
|
||||
}
|
||||
|
||||
ul ol, ol ol, ul ul {
|
||||
margin: 0em 2em;
|
||||
}
|
||||
|
||||
/* Header */
|
||||
|
||||
header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
header a {
|
||||
color: var(--font-color);
|
||||
}
|
||||
|
||||
header h1 {
|
||||
font-size: 1em;
|
||||
margin-top: 1em;
|
||||
margin-bottom: 0;
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
header h2 {
|
||||
font-size: 1em;
|
||||
margin: 0;
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
header nav {
|
||||
margin-top: 1em;
|
||||
max-width: 100%;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
header nav a {
|
||||
margin-left: 2em;
|
||||
}
|
||||
|
||||
.site-title {
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.common-header {
|
||||
padding-bottom: 1.5em;
|
||||
border-bottom: thin solid var(--hr-color);
|
||||
}
|
||||
|
||||
/* Pages */
|
||||
main h1 {
|
||||
margin-top: 1em;
|
||||
font-weight: normal;
|
||||
line-height: 1.1em;
|
||||
margin-bottom: 0.5em;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.post-short-list:first-of-type {
|
||||
margin-top: 1em;
|
||||
}
|
||||
|
||||
/* Articles */
|
||||
|
||||
.post-navigation {
|
||||
background: var(--pagination-bg-color);
|
||||
text-align: center;
|
||||
margin-top: 1em;
|
||||
max-width: 100%;
|
||||
padding: 0.5em 0;
|
||||
}
|
||||
|
||||
.post-navigation a:first-of-type {
|
||||
margin-left: 0;
|
||||
}
|
||||
|
||||
.post-navigation a {
|
||||
color: var(--pagination-link-color);
|
||||
margin-left: 2em;
|
||||
}
|
||||
|
||||
.post-navigation a:hover,
|
||||
.post-navigation a:focus,
|
||||
.post-navigation a:active {
|
||||
color: var(--link-state-color);
|
||||
}
|
||||
|
||||
.post-title.favorite::after {
|
||||
content: "☆";
|
||||
display: inline-block;
|
||||
margin-left: 0.2em;
|
||||
}
|
||||
|
||||
.post-title.draft::after {
|
||||
content: "✎";
|
||||
display: inline-block;
|
||||
margin-left: 0.2em;
|
||||
}
|
||||
|
||||
.post-title.favorite.draft::after {
|
||||
content: "☆ ✎";
|
||||
display: inline-block;
|
||||
margin-left: 0.2em;
|
||||
}
|
||||
|
||||
article:not(:last-of-type) {
|
||||
border-bottom: thin solid var(--hr-color);
|
||||
padding-bottom: 2em;
|
||||
}
|
||||
|
||||
article header h1 {
|
||||
font-size: 1.35em;
|
||||
line-height: 1.1em;
|
||||
margin-bottom: 0.5em;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
article header h1 a {
|
||||
color: var(--font-color);
|
||||
border: none;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.post-info {
|
||||
color: var(--post-info-color);
|
||||
font-size: 0.75em;
|
||||
margin-top: 1em;
|
||||
}
|
||||
|
||||
.post-info a {
|
||||
color: var(--post-info-color);
|
||||
}
|
||||
|
||||
.post-info a:hover {
|
||||
color: var(--link-state-color);
|
||||
}
|
||||
|
||||
.post-short-list .post-info {
|
||||
margin-top: 0;
|
||||
margin-bottom: 1.5em;
|
||||
}
|
||||
|
||||
.post-taxonomies {
|
||||
display: inline;
|
||||
}
|
||||
|
||||
.post-date {
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.post-categories {
|
||||
display: inline;
|
||||
list-style-type: none;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.post-categories li {
|
||||
display: inline;
|
||||
margin-right: 1em;
|
||||
}
|
||||
|
||||
.post-tags {
|
||||
display: inline;
|
||||
list-style-type: none;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.post-tags li {
|
||||
display: inline;
|
||||
margin-right: 1em;
|
||||
}
|
||||
|
||||
article img {
|
||||
max-width: 100%;
|
||||
display: block;
|
||||
height: auto;
|
||||
margin: 0 auto .5em;
|
||||
}
|
||||
|
||||
article figcaption {
|
||||
color: grey;
|
||||
text-align: center;
|
||||
font-size: 0.85em;
|
||||
margin-bottom: 2em;
|
||||
}
|
||||
|
||||
.read-more {
|
||||
margin: 1em 0;
|
||||
}
|
||||
|
||||
.divider {
|
||||
border-top: thin solid var(--hr-color);
|
||||
display: block;
|
||||
height: 1px;
|
||||
border: 0;
|
||||
width: 25%;
|
||||
margin: 1em auto;
|
||||
}
|
||||
|
||||
.post-summary {
|
||||
margin-top: 0.5em;
|
||||
display: block;
|
||||
}
|
||||
|
||||
.post-summary > p {
|
||||
display: block;
|
||||
}
|
||||
|
||||
/* Other pages */
|
||||
.terms {
|
||||
list-style-type: none;
|
||||
padding: 0;
|
||||
line-height: 2em;
|
||||
}
|
||||
|
||||
/* Pagination */
|
||||
|
||||
.pagination {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
margin-top: 3em;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.pagination-item {
|
||||
background: var(--pagination-bg-color);
|
||||
padding: 0.75em 0.75em;
|
||||
}
|
||||
|
||||
.pagination-item a {
|
||||
color: var(--pagination-link-color);
|
||||
}
|
||||
|
||||
.pagination-item a:hover,
|
||||
.pagination-item a:focus {
|
||||
color: var(--link-state-color);
|
||||
}
|
||||
|
||||
.disabled {
|
||||
visibility: hidden;
|
||||
}
|
||||
|
||||
.pagination-item a:hover, .pagination-item a:focus {
|
||||
border-bottom: 0;
|
||||
}
|
||||
|
||||
.post-pagination .pagination-item {
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
max-width: 16em;
|
||||
}
|
||||
|
||||
/* Footer */
|
||||
|
||||
.common-footer {
|
||||
border-top: thin solid var(--hr-color);
|
||||
padding-top: 1.5em;
|
||||
margin-top: 3em;
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
.common-footer-bottom {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
ul.language-select, ul.footer-menu {
|
||||
padding-left: 0;
|
||||
list-style: none;
|
||||
display: flex;
|
||||
}
|
||||
|
||||
ul.language-select > li, ul.footer-menu > li {
|
||||
margin-right: 1em;
|
||||
}
|
||||
|
||||
.theme-switcher {
|
||||
color: var(--switcher-color);
|
||||
background: var(--switcher-bg-color);
|
||||
padding: 0.5em 1em;
|
||||
font-size: 16px;
|
||||
border: none;
|
||||
margin-right: 1em;
|
||||
margin-bottom: 1em;
|
||||
}
|
||||
|
||||
/* Media Queries */
|
||||
|
||||
@media (max-width: 840px) {
|
||||
.main-wrapper {
|
||||
margin: 0;
|
||||
max-width: none;
|
||||
overflow-x: hidden;
|
||||
padding-left: 25px;
|
||||
padding-right: 25px;
|
||||
}
|
||||
|
||||
.container {
|
||||
max-width: 90%;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
.pagination-item {
|
||||
padding: 0.5em 0.5em;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
header {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.site-header {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
header nav:not(:empty){
|
||||
background: var(--pagination-bg-color);
|
||||
margin-top: 1em;
|
||||
max-width: 100%;
|
||||
text-align: center;
|
||||
padding: 0.5em 0;
|
||||
}
|
||||
|
||||
header nav a:first-of-type {
|
||||
margin-left: 0;
|
||||
}
|
||||
|
||||
header nav a {
|
||||
margin-left: 5%;
|
||||
}
|
||||
|
||||
.post-navigation {
|
||||
background: var(--pagination-bg-color);
|
||||
text-align: center;
|
||||
padding: 0.5em 0;
|
||||
}
|
||||
|
||||
.post-navigation a {
|
||||
margin-left: 0.5em;
|
||||
}
|
||||
|
||||
.post-pagination .pagination-item {
|
||||
max-width: 10em;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue