mirror of
https://github.com/jakejarvis/jarv.is.git
synced 2025-04-28 12:30:29 -04:00
also migrated SASS to latest syntax (via dart-sass) and vastly simplified light/dark theme logic
51 lines
1.7 KiB
SCSS
51 lines
1.7 KiB
SCSS
@use "sass:math";
|
|
@use "sass:string";
|
|
|
|
@use "settings";
|
|
|
|
// Gradient hack to get our custom underline to wrap:
|
|
// https://www.dannyguo.com/blog/animated-multiline-link-underlines-with-css/
|
|
@function underline-hack($color) {
|
|
// [deprecated] Calculate lighter underline color compared to text
|
|
// color by mix()'ing with background (#fff) to give the impression
|
|
// of opacity but with MUCH better compatibility.
|
|
// $color-opaque-hex: mix($color, $link-opacity-color, $link-underline-opacity);
|
|
|
|
// Less compatible but better for light/dark mode switching.
|
|
// We fall back to non-alpha hex colors with postcss-color-rgba-fallback to mitigate this.
|
|
$color-opaque-alpha: rgba($color, math.div(settings.$link-underline-opacity, 100%));
|
|
|
|
// Return non-gradient linear-gradient():
|
|
@return linear-gradient($color-opaque-alpha, $color-opaque-alpha);
|
|
}
|
|
|
|
// Web fonts (see components/_typography.scss)
|
|
@mixin font-face(
|
|
$family,
|
|
$src,
|
|
$weight: normal,
|
|
$style: normal,
|
|
$display: swap,
|
|
$variable: false,
|
|
$base-path: "../fonts/"
|
|
) {
|
|
@font-face {
|
|
font-family: string.quote($family);
|
|
font-style: $style;
|
|
font-weight: $weight;
|
|
font-display: $display;
|
|
|
|
@if $variable {
|
|
// all browsers that support variable fonts also support woff2, so a woff file is unncessary
|
|
// draft spec for formats: https://www.w3.org/TR/css-fonts-4/#src-desc
|
|
src: url($base-path + $src + ".woff2") format("woff2-variations"),
|
|
url($base-path + $src + ".woff2") format("woff2");
|
|
} @else {
|
|
src: url($base-path + $src + ".woff2") format("woff2"), url($base-path + $src + ".woff") format("woff");
|
|
}
|
|
|
|
// Allow additional rules to be passed in:
|
|
@content;
|
|
}
|
|
}
|