add two more themes
This commit is contained in:
parent
144b197c31
commit
d8d9a04b4f
8 changed files with 93 additions and 49 deletions
|
@ -4,6 +4,7 @@
|
||||||
@import "./md.scss";
|
@import "./md.scss";
|
||||||
@import "./syntax.scss";
|
@import "./syntax.scss";
|
||||||
|
|
||||||
|
|
||||||
:root {
|
:root {
|
||||||
--max-w: 640px;
|
--max-w: 640px;
|
||||||
--font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu,
|
--font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu,
|
||||||
|
@ -23,6 +24,8 @@ body {
|
||||||
margin: 0 16px;
|
margin: 0 16px;
|
||||||
font-family: var(--font);
|
font-family: var(--font);
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
|
line-height: 1.6;
|
||||||
|
background-image: var(--back-image);
|
||||||
background-color: var(--back);
|
background-color: var(--back);
|
||||||
color: var(--text);
|
color: var(--text);
|
||||||
transition-property: background-color, border-color, color;
|
transition-property: background-color, border-color, color;
|
||||||
|
@ -53,3 +56,8 @@ main p a:hover {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@media (min-width: 640px) {
|
||||||
|
body {
|
||||||
|
margin-top: calc(1rem + 2vh);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
.chroma {
|
.chroma {
|
||||||
margin: .5em 0;
|
margin: .5em 0;
|
||||||
|
background-image: var(--back-image);
|
||||||
background-color: var(--code-back);
|
background-color: var(--code-back);
|
||||||
border-radius: 2px;
|
border-radius: 2px;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,4 @@
|
||||||
.light {
|
:root {
|
||||||
--prime: #3170a7;
|
|
||||||
--grid: #e1e1e1;
|
|
||||||
--back: #fff;
|
|
||||||
--text: #222;
|
|
||||||
|
|
||||||
// code highlighting
|
// code highlighting
|
||||||
--code-back: #f6f8fa;
|
--code-back: #f6f8fa;
|
||||||
--code-text: #24292f;
|
--code-text: #24292f;
|
||||||
|
@ -19,6 +14,13 @@
|
||||||
--code-highlighted-line: #e9e9e9;
|
--code-highlighted-line: #e9e9e9;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.light {
|
||||||
|
--prime: #3170a7;
|
||||||
|
--grid: #e1e1e1;
|
||||||
|
--back: #fff;
|
||||||
|
--text: #333;
|
||||||
|
}
|
||||||
|
|
||||||
.dark {
|
.dark {
|
||||||
--prime: #3170a7;
|
--prime: #3170a7;
|
||||||
--back: #181818;
|
--back: #181818;
|
||||||
|
@ -39,3 +41,27 @@
|
||||||
--code-meta: #c586c0cb;
|
--code-meta: #c586c0cb;
|
||||||
--code-highlighted-line: #9494951b;
|
--code-highlighted-line: #9494951b;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.sand {
|
||||||
|
--prime: #3170a7;
|
||||||
|
--back: #e6dece;
|
||||||
|
--text: #434343;
|
||||||
|
|
||||||
|
--code-back: #dbd3c1be;
|
||||||
|
--code-text: #24292f;
|
||||||
|
--code-highlighted-line: #cec3ac;
|
||||||
|
|
||||||
|
--back-image: url('texture.png');
|
||||||
|
}
|
||||||
|
|
||||||
|
.rock {
|
||||||
|
--prime: #3170a7;
|
||||||
|
--back: #ccc;
|
||||||
|
--text: #434343;
|
||||||
|
|
||||||
|
--code-back: #c1c1c1be;
|
||||||
|
--code-text: #24292f;
|
||||||
|
--code-highlighted-line: #afaeae;
|
||||||
|
|
||||||
|
--back-image: url('texture.png');
|
||||||
|
}
|
|
@ -1,7 +1,8 @@
|
||||||
const comment = '{{ .Site.Params.comment.provider }}'
|
const comment = '{{ .Site.Params.comment.provider }}'
|
||||||
|
const default_theme_config = '{{ .Site.Params.defaultTheme }}'
|
||||||
const icon_light = '{{ index .Site.Params.switch 1 }}'
|
const icon_light = '{{ index .Site.Params.switch 1 }}'
|
||||||
const icon_dark = '{{ index .Site.Params.switch 0 }}'
|
const icon_dark = '{{ index .Site.Params.switch 0 }}'
|
||||||
const THEME_LIGHT = 'light'
|
const THEME_LIGHT = default_theme_config === 'system' ? 'light' : default_theme_config
|
||||||
const THEME_DARK = 'dark'
|
const THEME_DARK = 'dark'
|
||||||
|
|
||||||
/** @type {HTMLElement} */
|
/** @type {HTMLElement} */
|
||||||
|
@ -53,14 +54,20 @@ function switch_minima_theme(current, next) {
|
||||||
|
|
||||||
/** @param {string} theme */
|
/** @param {string} theme */
|
||||||
function switch_utterances_theme(theme) {
|
function switch_utterances_theme(theme) {
|
||||||
utterances =utterances || document.querySelector('iframe.utterances-frame')
|
if (theme !== 'dark') {
|
||||||
|
theme = 'light'
|
||||||
|
}
|
||||||
|
utterances = utterances || document.querySelector('iframe.utterances-frame')
|
||||||
if (!utterances) return
|
if (!utterances) return
|
||||||
utterances.contentWindow.postMessage({ type: 'set-theme', theme }, 'https://utteranc.es')
|
utterances.contentWindow.postMessage({ type: 'set-theme', theme }, 'https://utteranc.es')
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @param {string} theme */
|
/** @param {string} theme */
|
||||||
function switch_giscus_theme(theme) {
|
function switch_giscus_theme(theme) {
|
||||||
|
if (theme !== 'dark') {
|
||||||
|
theme = 'light_protanopia'
|
||||||
|
}
|
||||||
giscus = giscus || document.querySelector('iframe.giscus-frame')
|
giscus = giscus || document.querySelector('iframe.giscus-frame')
|
||||||
if (!giscus) return
|
if (!giscus) return
|
||||||
giscus.contentWindow.postMessage({giscus: {setConfig: {theme}}}, 'https://giscus.app')
|
giscus.contentWindow.postMessage({ giscus: { setConfig: { theme } } }, 'https://giscus.app')
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
baseURL: https://mivinci.github.io/hugo-theme-minima
|
baseURL: https://mivinci.github.io/hugo-theme-minima
|
||||||
languageCode: en-us
|
languageCode: en-us
|
||||||
title: Hugo on Minima
|
title: Hugo on Minima
|
||||||
copyright: © 2022 X
|
copyright: © 2023 X
|
||||||
googleAnalytics:
|
googleAnalytics:
|
||||||
# paginate specifies the maximum number of posts displayed on the home page.
|
# paginate specifies the maximum number of posts displayed on the home page.
|
||||||
paginate: 12
|
paginate: 12
|
||||||
|
@ -12,10 +12,10 @@ defaultContentLanguage: en
|
||||||
# language.x setup
|
# language.x setup
|
||||||
languages:
|
languages:
|
||||||
en:
|
en:
|
||||||
languageName: EN
|
languageName: EN # will be displayed in the navbar.
|
||||||
weight: 1
|
weight: 1
|
||||||
zh-cn:
|
zh-cn:
|
||||||
languageName: ZH
|
languageName: 简中 # will be displayed in the navbar.
|
||||||
weight: 2
|
weight: 2
|
||||||
author:
|
author:
|
||||||
status: 目前住在地球 🌍
|
status: 目前住在地球 🌍
|
||||||
|
@ -40,17 +40,17 @@ params:
|
||||||
greet: Hello :)
|
greet: Hello :)
|
||||||
# subtitle speficies a subtitle displayed right after the site title.
|
# subtitle speficies a subtitle displayed right after the site title.
|
||||||
subtitle:
|
subtitle:
|
||||||
# switch specifies two emojis to be used as the button toggling color themes.
|
# switch specifies two emojis used as the button toggling color themes.
|
||||||
switch: ["🌚", "🌝"]
|
switch: ["🌚", "🌝"]
|
||||||
# defaultTheme specifies a default theme to be used.
|
# minima has one dark theme and multiple light themes. defaultTheme specifies
|
||||||
# currently available options: light, dark, system.
|
# a default light theme to use. currently available options: light, sand, rock, system.
|
||||||
defaultTheme: system
|
defaultTheme: sand
|
||||||
# displayDate speficies whether or not to display post date on the home page.
|
# displayDate speficies whether or not to display post date on the home page.
|
||||||
displayDate: true
|
displayDate: true
|
||||||
# displayDescription specifies whether or not to display post description on
|
# displayDescription specifies whether or not to display post description on
|
||||||
# the hoem page.
|
# the hoem page.
|
||||||
displayDescription: true
|
displayDescription: true
|
||||||
# selectable specifies if your post content can be selected.
|
# selectable specifies if or not your post content can be selected.
|
||||||
selectable: true
|
selectable: true
|
||||||
# social is an array containing as many as social accounts to be displayed
|
# social is an array containing as many as social accounts to be displayed
|
||||||
# in the buttom of every page.
|
# in the buttom of every page.
|
||||||
|
@ -116,7 +116,7 @@ taxonomies:
|
||||||
series: series
|
series: series
|
||||||
|
|
||||||
# markup.highlight has two keys set to make sure that the syntax highlighting
|
# markup.highlight has two keys set to make sure that the syntax highlighting
|
||||||
# in your posts are rendered correctly, so do not edit them.
|
# in your posts are rendered correctly, so DO NOT edit them.
|
||||||
markup:
|
markup:
|
||||||
highlight:
|
highlight:
|
||||||
lineNos: true
|
lineNos: true
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
{{ $favicon := "favicon.ico" }}
|
{{ $favicon := "favicon.ico" }}
|
||||||
<link rel="shortcut icon" href="{{ $favicon | relURL }}" type="image/x-icon" />
|
<link rel="shortcut icon" href="{{ $favicon | relURL }}" type="image/x-icon" />
|
||||||
{{ $options := (dict "targetPath" "minima.css" "outputStyle" "compressed" "enableSourceMap" true) }}
|
{{ $options := (dict "targetPath" "minima.css" "outputStyle" "compressed" "enableSourceMap" true) }}
|
||||||
{{ $style := resources.Get "css/main.scss" | resources.ToCSS $options }}
|
{{ $style := resources.Get "css/main.scss" | resources.ExecuteAsTemplate "main.scss" . | resources.ToCSS $options }}
|
||||||
<link rel="stylesheet" href="{{ $style.RelPermalink }}">
|
<link rel="stylesheet" href="{{ $style.RelPermalink }}">
|
||||||
{{ $options = (dict "targetPath" "minima.js" "minify" true) }}
|
{{ $options = (dict "targetPath" "minima.js" "minify" true) }}
|
||||||
{{ $js := resources.Get "js/main.js" | js.Build $options | resources.ExecuteAsTemplate "minima.js" . }}
|
{{ $js := resources.Get "js/main.js" | js.Build $options | resources.ExecuteAsTemplate "minima.js" . }}
|
||||||
|
@ -29,12 +29,14 @@
|
||||||
</head>
|
</head>
|
||||||
<script>
|
<script>
|
||||||
// default to system color scheme.
|
// default to system color scheme.
|
||||||
let default_theme = window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';
|
const default_theme_config = '{{ .Site.Params.defaultTheme }}'
|
||||||
|
const default_light_theme = default_theme_config === 'system' ? 'light' : default_theme_config;
|
||||||
|
let default_theme = window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : default_light_theme;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const local = localStorage.getItem('theme')
|
const saved_theme = localStorage.getItem('theme')
|
||||||
if (local) {
|
if (saved_theme) {
|
||||||
default_theme = local
|
default_theme = saved_theme === default_light_theme ? saved_theme : default_light_theme;
|
||||||
}
|
}
|
||||||
localStorage.setItem('theme', default_theme);
|
localStorage.setItem('theme', default_theme);
|
||||||
window.minima_theme = default_theme;
|
window.minima_theme = default_theme;
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
{{ end }}
|
{{ end }}
|
||||||
<div id="theme-switch" class="text-3xl cursor-pointer">{{ index .Site.Params.switch 1 }}</div>
|
<div id="theme-switch" class="text-3xl cursor-pointer">{{ index .Site.Params.switch 1 }}</div>
|
||||||
</div>
|
</div>
|
||||||
<ul class="flex items-center font-medium
|
<ul class="flex items-center text-base font-bold
|
||||||
whitespace-nowrap overflow-x-auto overflow-y-hidden">
|
whitespace-nowrap overflow-x-auto overflow-y-hidden">
|
||||||
{{ range .Site.Menus.main }}
|
{{ range .Site.Menus.main }}
|
||||||
<li class="ml-2 mr-2"><a href="{{ .Identifier | relLangURL }}">{{ T .Identifier | default .Name }}</a></li>
|
<li class="ml-2 mr-2"><a href="{{ .Identifier | relLangURL }}">{{ T .Identifier | default .Name }}</a></li>
|
||||||
|
|
BIN
static/texture.png
Normal file
BIN
static/texture.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 6.1 KiB |
Loading…
Reference in a new issue