mirror of
https://github.com/jakejarvis/jarv.is.git
synced 2025-04-27 05:18:28 -04:00
* prepare dark mode stuffs * themed all global colors * store preference in local storage * toggle styling * lightbulb position * minify bundled script with uglify-js instead of hugo * detect whether user has an OS-wide dark mode preference and use that by default * two different colors for each homepage link * inline bulb SVGs into stylesheet * fingerprint and cache styles for a year * fix lightbulb positioning with weird magic numbers, will come back to that * themed syntax highlighting * use terser instead of uglify-js (b/c of ES6)
185 lines
3.6 KiB
SCSS
185 lines
3.6 KiB
SCSS
@charset "UTF-8";
|
|
|
|
// Global Styles
|
|
body {
|
|
width: 100%;
|
|
height: 100%;
|
|
margin: 0 auto;
|
|
font-family: $webfont-sans;
|
|
font-kerning: normal;
|
|
font-feature-settings: "kern", "liga", "calt", "clig", "ss01";
|
|
line-height: 1.5;
|
|
box-sizing: border-box;
|
|
}
|
|
|
|
main {
|
|
@include themed() {
|
|
color: t(color-text);
|
|
}
|
|
}
|
|
|
|
a {
|
|
text-decoration: none;
|
|
background-position: 0% 100%;
|
|
background-repeat: no-repeat;
|
|
background-size: 0% $link-underline-size;
|
|
padding-bottom: $link-underline-size;
|
|
transition: background-size 0.25s ease-in-out;
|
|
|
|
@include themed() {
|
|
color: t(color-links);
|
|
background-image: underline-hack(t(color-links));
|
|
}
|
|
|
|
&:hover {
|
|
background-size: 100% $link-underline-size;
|
|
}
|
|
|
|
&.no-underline {
|
|
background: none !important;
|
|
padding-bottom: 0;
|
|
}
|
|
}
|
|
|
|
strong {
|
|
letter-spacing: 0.001em;
|
|
}
|
|
|
|
blockquote {
|
|
margin-left: 0.5em;
|
|
padding-left: 1em;
|
|
|
|
@include themed() {
|
|
border-left: 5px solid t(color-links);
|
|
}
|
|
}
|
|
|
|
hr {
|
|
margin: 1.5em auto;
|
|
height: 2px;
|
|
border: 0;
|
|
|
|
@include themed() {
|
|
background-color: t(color-light);
|
|
}
|
|
}
|
|
|
|
// button reset
|
|
button {
|
|
border: 0;
|
|
margin: 0;
|
|
padding: 0;
|
|
overflow: visible;
|
|
background: transparent;
|
|
|
|
// inherit font & color from ancestor
|
|
color: inherit;
|
|
font: inherit;
|
|
line-height: normal;
|
|
|
|
// corrects inability to style clickable `input` types in iOS
|
|
appearance: none;
|
|
|
|
&::-moz-focus-inner {
|
|
border: 0;
|
|
padding: 0;
|
|
}
|
|
}
|
|
|
|
// all code
|
|
code {
|
|
font-family: $webfont-mono;
|
|
font-size: 0.95em;
|
|
letter-spacing: 0;
|
|
page-break-inside: avoid;
|
|
|
|
// inline code in paragraphs (single tildes)
|
|
padding: 0.2em;
|
|
|
|
@include themed() {
|
|
background-color: t(color-super-duper-light);
|
|
border: 1px solid t(color-light);
|
|
}
|
|
}
|
|
|
|
// code fences
|
|
div.highlight {
|
|
line-height: 1.6;
|
|
max-width: 100%;
|
|
overflow-x: scroll;
|
|
object-fit: scale-down;
|
|
margin: 1em 0;
|
|
|
|
@include themed() {
|
|
border: 1px solid t(color-light);
|
|
border-left: 3px solid t(color-links);
|
|
background-color: t(color-super-duper-light);
|
|
}
|
|
|
|
pre {
|
|
display: block;
|
|
margin-left: 1.5em;
|
|
}
|
|
|
|
// overrides inline code styles
|
|
code {
|
|
border: 0;
|
|
padding: 0;
|
|
}
|
|
}
|
|
|
|
// make SVG twemojis relative to surrounding text
|
|
// https://github.com/twitter/twemoji#inline-styles
|
|
img.emoji {
|
|
height: 1.1em !important;
|
|
width: 1.1em !important;
|
|
margin: 0 0.09em !important;
|
|
vertical-align: -0.18em !important;
|
|
display: inline !important;
|
|
}
|
|
|
|
// white background for entire width content area
|
|
div#wrap {
|
|
width: 100%;
|
|
|
|
@include themed() {
|
|
background-color: t(color-background);
|
|
}
|
|
}
|
|
|
|
// manually setting light/dark mode backgrounds and bulb icon
|
|
// really just the color of header & footer
|
|
body {
|
|
&.light {
|
|
background-color: $color-light-background;
|
|
|
|
button#dark-mode-toggle {
|
|
background-image: url($icon-bulb-on);
|
|
}
|
|
}
|
|
|
|
&.dark {
|
|
background-color: $color-dark-background;
|
|
|
|
button#dark-mode-toggle {
|
|
background-image: url($icon-bulb-off);
|
|
}
|
|
}
|
|
}
|
|
|
|
// Responsive
|
|
@mixin responsive--global() {
|
|
body {
|
|
// Safari iOS menu bar reappers below 44px:
|
|
// https://www.eventbrite.com/engineering/mobile-safari-why/
|
|
padding-bottom: 45px !important;
|
|
// Allows you to scroll below the viewport; default value is visible
|
|
overflow-y: scroll;
|
|
|
|
// Fix weird font size behavior on iOS Safari: https://github.com/jakejarvis/jarv.is/issues/18
|
|
// https://stackoverflow.com/questions/3226001/some-font-sizes-rendered-larger-on-safari-iphone
|
|
// https://www.456bereastreet.com/archive/201011/beware_of_-webkit-text-size-adjustnone/
|
|
text-size-adjust: 100%;
|
|
}
|
|
}
|