aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoreugenesvk2023-05-03 22:16:15 +0700
committerJieiku2023-05-22 23:04:07 -0700
commit428dd1fd0a5bd640a8617a9486ecd2f7c5bf29bf (patch)
tree7f78c91f79afd0b1fa67ab5420c1e4ca55c68ea8
parent2ee8b03aaed15435dc261a5caa398d0dfc96bb41 (diff)
downloadabridge-428dd1fd0a5bd640a8617a9486ecd2f7c5bf29bf.tar.gz
abridge-428dd1fd0a5bd640a8617a9486ecd2f7c5bf29bf.tar.bz2
abridge-428dd1fd0a5bd640a8617a9486ecd2f7c5bf29bf.zip
Add font-extend style partials
-rw-r--r--sass/_font-extend-COPY-ME.sass16
-rw-r--r--sass/_font-extend.sass21
2 files changed, 37 insertions, 0 deletions
diff --git a/sass/_font-extend-COPY-ME.sass b/sass/_font-extend-COPY-ME.sass
new file mode 100644
index 0000000..f1f6262
--- /dev/null
+++ b/sass/_font-extend-COPY-ME.sass
@@ -0,0 +1,16 @@
+// This abridge theme extension allows you to append custom fonts to font-family of the:
+ // main font 'html' ('--ff' theme css variable in '_document.scss')
+ // code font 'pre','code','kbd','samp','tt','var' ('--fm' theme css variable in '_code.scss' )
+// copy this file to your 'sass' folder:
+ // either: remove the leading '_' and add 'font-extend-COPY-ME.css' to your 'stylesheets' in 'config.toml'
+ // or : import it with '@use "_font-extend-COPY-ME"' in whatever existing sass file you already load
+$findFont-Main : "Segoe UI" // ← append custom MAIN font(s) AFTER this (full list @ '_variables.scss')
+$findFont-Code : "Segoe UI Mono" // ← append custom CODE font(s) AFTER this
+$fontExt-Main : ("MAIN FONT 1", "MAIN FONT 2") // list of custom MAIN font(s) to append
+$fontExt-Code : ("CODE FONT 1", "CODE FONT 2") // list of custom CODE font(s) to append
+
+@use "../themes/abridge/sass/font-extend" with($findFont-Main:$findFont-Main, $findFont-Code:$findFont-Code,$fontExt-Main:$fontExt-Main,$fontExt-Code:$fontExt-Code)
+// check ↑ relative path if you copy this file to some other location
+
+:root
+ @include font-extend.font-root
diff --git a/sass/_font-extend.sass b/sass/_font-extend.sass
new file mode 100644
index 0000000..d0a9361
--- /dev/null
+++ b/sass/_font-extend.sass
@@ -0,0 +1,21 @@
+@use "variables" as var
+@use "function/font" as f
+
+$findFont-Main : "Segoe UI" !default
+$findFont-Code : "Segoe UI Mono" !default
+$fontExt-Main : ("MAIN FONT 1", "MAIN FONT 2") !default
+$fontExt-Code : ("CODE FONT 1", "CODE FONT 2") !default
+$iFoundFont-Main : index(var.$font , $findFont-Main)
+$iFoundFont-Code : index(var.$font-mono, $findFont-Code)
+@if $iFoundFont-Main
+ var.$font : f.font-append(var.$font , $fontExt-Main, $findFont-Main)
+@else
+ @debug "⚠ Failed to find font '#{$findFont-Main}' in the list of '#{var.$font}'"
+@if $iFoundFont-Code
+ var.$font-mono : f.font-append(var.$font-mono, $fontExt-Code, $findFont-Code)
+@else
+ @debug "⚠ Failed to find font '#{$findFont-Code}' in the list of '#{var.$font-mono}'"
+
+@mixin font-root
+ #{--ff}: var.$font
+ #{--fm}: var.$font-mono //code