darkmode scripts

This commit is contained in:
Jacky Zhao
2023-06-06 19:48:37 -07:00
parent 89e0311a98
commit 4d3579ca98
13 changed files with 145 additions and 15 deletions

View File

@ -24,7 +24,7 @@ body {
border-radius: 5px;
}
p, ul, text, a, tr, td, li, ol, ul {
p, ul, text, a, tr, td, li, ol, ul, .katex {
color: var(--darkgray);
fill: var(--darkgray);
}
@ -67,7 +67,7 @@ a {
}
blockquote {
margin-left: 0;
margin: 1rem 0;
border-left: 3px solid var(--secondary);
padding-left: 1rem;
transition: border-color 0.2s ease;
@ -134,7 +134,7 @@ pre {
& > code {
background: none;
padding: 0;
font-size: 0.9rem;
font-size: 0.85rem;
counter-reset: line;
counter-increment: line 0;
display: grid;

View File

@ -4,7 +4,7 @@
border: 1px solid var(--border);
background-color: var(--bg);
border-radius: 5px;
padding: 0 0.7rem;
padding: 0 1rem;
&[data-callout="note"] {
--color: #448aff;

View File

@ -0,0 +1,45 @@
.darkmode {
float: right;
padding: 1rem;
min-width: 30px;
position: relative;
@media all and (max-width: 450px) {
padding: 1rem;
}
& > .toggle {
display: none;
box-sizing: border-box;
}
& svg {
cursor: pointer;
opacity: 0;
position: absolute;
width: 20px;
height: 20px;
top: calc(50% - 10px);
margin: 0 7px;
fill: var(--darkgray);
transition: opacity 0.1s ease;
}
}
:root[saved-theme="dark"] .toggle ~ label {
& > #dayIcon {
opacity: 0;
}
& > #nightIcon {
opacity: 1;
}
}
:root .toggle ~ label {
& > #dayIcon {
opacity: 1;
}
& > #nightIcon {
opacity: 0;
}
}

10
quartz/styles/header.scss Normal file
View File

@ -0,0 +1,10 @@
header {
display: flex;
flex-direction: row;
align-items: center;
margin: 1em 0 2em 0;
& > h1 {
margin: 0;
flex: auto;
}
}