change config format

This commit is contained in:
Yuri Zamyatin 2025-04-15 21:44:14 +00:00
parent dca9541eee
commit 6fac717306
5 changed files with 33 additions and 20 deletions

View File

@ -1,4 +1,12 @@
@import "variables.scss";
$color-fg: #{{ .Site.Data.theme.color.fg }};
$color-fg-dark: #{{ .Site.Data.theme.color.fg_dark }};
$color-fg-accent: #{{ .Site.Data.theme.color.fg_accent }};
$color-bg: #{{ .Site.Data.theme.color.bg }};
$color-bg-accent-light: #{{ .Site.Data.theme.color.bg_accent_light }};
$color-bg-accent-dark: #{{ .Site.Data.theme.color.bg_accent_dark }};
$opacity-low: {{ .Site.Data.theme.opacity.low }};
$opacity-mid: {{ .Site.Data.theme.opacity.med }};
@import "basic.scss";
@import "classic-layout.scss";
@import "home-layout.scss";

View File

@ -1,9 +0,0 @@
$color-fg: #ffffff;
$color-fg-dark: #b8bcc1;
$color-fg-accent: #9988ff;
$color-bg: #0d1117;
$color-bg-accent-light: #510079;
$color-bg-accent-dark: #020030;
$opacity-low: 0.2;
$opacity-mid: 0.55;

21
data/theme.json Normal file
View File

@ -0,0 +1,21 @@
{
"color": {
"fg": "ffffff",
"fg_dark": "b8bcc1",
"fg_accent": "9988ff",
"bg": "0d1117",
"bg_accent_light":"510079",
"bg_accent_dark":"020030"
},
"opacity": {
"low": 0.2,
"med": 0.55,
"high": 0.85
},
"font": {
"name_regular": "Roboto",
"name_mono": "Roboto Mono",
"size_base_pt": 12,
"size_step_pt": 1.5
}
}

View File

@ -1,12 +1,5 @@
#!/bin/sh
set -e
cd "$(dirname "$0")"
cd "$(dirname "$0")/.."
[ -d ./themes/yrzam ] && cd ./themes/yrzam
VARS=$(printenv | \
grep -E 'THEME_.*' | \
sed -e 's/[= ].*//g' | sed -e 's/^/\$/' | tr '\n' ' '
)
envsubst "$VARS" < "./assets/css/variables.scss.tmpl" > "./assets/css/variables.scss"
cp ~/.config/theme.json ../data/theme.json

View File

@ -6,7 +6,7 @@
<!-- prettier-ignore -->
<title>{{ if not .IsHome }}{{ .LinkTitle | humanize }} - {{ end }}{{ .Site.Title }}</title>
{{ $opts := dict "transpiler" "libsass" "targetPath" "_style.css" }}
{{ with resources.Get "css/index.scss" | toCSS $opts | minify | fingerprint }}
{{ with resources.Get "css/index.scss" | resources.ExecuteAsTemplate "" . | toCSS $opts | minify | fingerprint }}
<link rel="stylesheet" href="{{ .RelPermalink }}" integrity="{{ .Data.Integrity }}" />
{{ end }}
{{ range resources.Match "favicon/*.png" }}