diff --git a/assets/js/components/switchTheme.js b/assets/js/components/switchTheme.js index 8a825a6..46d77f2 100644 --- a/assets/js/components/switchTheme.js +++ b/assets/js/components/switchTheme.js @@ -11,10 +11,15 @@ function switchTheme() { function initTheme() { let lsItem = localStorage.getItem('themeSwitch'); - let darkThemeSelected = (lsItem !== null && lsItem === 'dark'); + let darkThemeSelected = false; + if (lsItem !== null) { + darkThemeSelected = lsItem === 'dark'; + } else { + darkThemeSelected = window.matchMedia('(prefers-color-scheme: dark)').matches; + } themeSwitch.checked = darkThemeSelected; - darkThemeSelected ? document.body.setAttribute('data-theme', 'dark') : document.body.removeAttribute('data-theme'); + resetTheme(); } function resetTheme() { @@ -23,8 +28,13 @@ function switchTheme() { localStorage.setItem('themeSwitch', 'dark'); } else { document.body.removeAttribute('data-theme'); - localStorage.removeItem('themeSwitch'); - } + localStorage.setItem('themeSwitch', 'light'); + } + + // Reset Disqus to match new color scheme + if (typeof DISQUS !== "undefined") { + DISQUS.reset({ reload: true }); + } } } } diff --git a/assets/scss/abstracts/_mixins.scss b/assets/scss/abstracts/_mixins.scss index 0e7ab68..c463943 100644 --- a/assets/scss/abstracts/_mixins.scss +++ b/assets/scss/abstracts/_mixins.scss @@ -52,4 +52,9 @@ @warn "Unfortunately, no value could be retrieved from `#{$breakpoint}`. " + "Available breakpoints are: #{map-keys($breakpoints)}."; } +} + +@mixin font-size($step) { + font-size: var(--font-size-#{$step}); + line-height: calc(8px + 2ex); } \ No newline at end of file diff --git a/assets/scss/abstracts/_variables.scss b/assets/scss/abstracts/_variables.scss index d9acdb5..addd410 100644 --- a/assets/scss/abstracts/_variables.scss +++ b/assets/scss/abstracts/_variables.scss @@ -17,6 +17,14 @@ --color-contrast-higher: black; --color-text: var(--color-contrast-high); + + --font-size-sm: clamp(0.8rem, 0.17vw + 0.76rem, 0.89rem); + --font-size-base: clamp(1rem, 0.34vw + 0.91rem, 1.19rem); + --font-size-md: clamp(1.25rem, 0.61vw + 1.1rem, 1.58rem); + --font-size-lg: clamp(1.56rem, 1vw + 1.31rem, 2.11rem); + --font-size-xl: clamp(1.95rem, 1.56vw + 1.56rem, 2.81rem); + --font-size-xxl: clamp(2.44rem, 2.38vw + 1.85rem, 3.75rem); + --font-size-xxxl: clamp(3.05rem, 3.54vw + 2.17rem, 5rem); } [data-theme] { diff --git a/assets/scss/base/_base.scss b/assets/scss/base/_base.scss index 3258cda..570204c 100644 --- a/assets/scss/base/_base.scss +++ b/assets/scss/base/_base.scss @@ -50,6 +50,30 @@ a { } } +h1 { + @include font-size('xl'); +} + +h2 { + @include font-size('lg'); +} + +h3 { + @include font-size('md'); +} + +h4 { + @include font-size('base'); +} + +h5 { + @include font-size('sm'); +} + +h6 { + @include font-size('sm'); +} + table { border-collapse: collapse; display: block; @@ -57,13 +81,15 @@ table { } td, th { - border: 1px solid var(--color-contrast-low); + border: 1px solid var(--color-contrast-medium-low); padding: 10px 20px; font-size: 0.9rem; + line-height: 1.4rem; } th { - background-color: var(--color-contrast-low); + border: 1px solid var(--color-contrast-medium); + background-color: var(--color-contrast-medium-low); color: var(--color-contrast-high); font-size: 1rem; } @@ -73,13 +99,13 @@ td { } tr:nth-child(even) td { - background-color: var(--color-contrast-high); - color: var(--color-contrast-lower); + background-color: var(--color-contrast-lower); + color: var(--color-contrast-high); } tr:nth-child(odd) td { - background-color: var(--color-contrast-higher); - color: var(--color-contrast-low); + background-color: var(--color-contrast-low); + color: var(--color-contrast-high); } blockquote { @@ -88,7 +114,6 @@ blockquote { margin: 1.5em 10px; padding: 0.7em 10px; quotes: "\201C" "\201D"; - overflow-x: auto; p { display: inline; @@ -105,7 +130,6 @@ blockquote { } pre { - // padding: 20px; font-size: 1rem; line-height: 1.6rem; overflow-x: auto; @@ -115,6 +139,13 @@ code { overflow-x: scroll; } +pre:not([style]) { + // If no highlighting is applied already + background-color:#272822; + color:#f8f8f2; + padding: 20px; +} + p > code, li > code { background-color: var(--color-contrast-lower); font-size: 1rem; diff --git a/assets/scss/base/_typography.scss b/assets/scss/base/_typography.scss index b291cd5..e5169bc 100644 --- a/assets/scss/base/_typography.scss +++ b/assets/scss/base/_typography.scss @@ -12,21 +12,20 @@ .summary-text { font-weight: 300; - font-size: 1rem; - line-height: 1.6rem; + @include font-size('base'); color: var(--color-contrast-medium-high); } .meta-text { color: var(--color-contrast-medium); - font-size: 1rem; + @include font-size('sm'); font-weight: 400; display: flex; flex-wrap: wrap; - gap: 10px 20px; + gap: 6px 15px; } .fallback-text { color: var(--color-contrast-medium); - font-size: 1.2rem; + @include font-size('md'); } \ No newline at end of file diff --git a/assets/scss/components/_buttons.scss b/assets/scss/components/_buttons.scss index 8a19360..8861b0e 100644 --- a/assets/scss/components/_buttons.scss +++ b/assets/scss/components/_buttons.scss @@ -1,17 +1,17 @@ .btn-group { display: flex; column-gap: 15px; + margin-top: 30px; } %btn { border: 1px solid var(--color-primary); - padding: 0.5rem 0.7rem; - font-size: 0.9rem; + padding: 0.4rem 0.7rem; display: inline-block; + @include font-size('base'); @include respond-to('small') { - padding: 0.6rem 0.8rem; - font-size: 1.1rem; + padding: 0.5rem 0.8rem; } @include on-event() { diff --git a/assets/scss/components/_clipboard.scss b/assets/scss/components/_clipboard.scss index 19ea933..586f2f5 100644 --- a/assets/scss/components/_clipboard.scss +++ b/assets/scss/components/_clipboard.scss @@ -11,7 +11,6 @@ background-color: #ededed; border: 1px solid; border-radius: 6px; - font-size: 0.8em; z-index: 1; opacity: 0; transition: 0.1s; diff --git a/assets/scss/components/_code-highlight.scss b/assets/scss/components/_code-highlight.scss index ca6607d..0586704 100644 --- a/assets/scss/components/_code-highlight.scss +++ b/assets/scss/components/_code-highlight.scss @@ -1,10 +1,12 @@ .code-language { - position: absolute; - padding: 5px 15px; + position: relative; + padding: 6px 15px; border-radius: 5px; background-color: #272822; color: #7f7f7f; z-index: 1000; + top: 25px; + @include font-size('base'); } .highlight > pre { diff --git a/assets/scss/components/_draft-label.scss b/assets/scss/components/_draft-label.scss index 06d1197..bc42ceb 100644 --- a/assets/scss/components/_draft-label.scss +++ b/assets/scss/components/_draft-label.scss @@ -3,7 +3,7 @@ color: rgb(201, 8, 8); border: 1px solid rgb(201, 8, 8); border-radius: 5px; - font-size: 0.9rem; + @include font-size('sm'); padding: 2px 5px; font-weight: 300; } \ No newline at end of file diff --git a/assets/scss/components/_markdown.scss b/assets/scss/components/_markdown.scss index 00e0c72..c3c4315 100644 --- a/assets/scss/components/_markdown.scss +++ b/assets/scss/components/_markdown.scss @@ -1,11 +1,5 @@ .markdown { - font-size: 1.1rem; - line-height: 1.8rem; - - @include respond-to('medium') { - font-size: 1.2rem; - line-height: 2rem; - } + @include font-size('base'); p > img, figure > img { max-width: 100%; @@ -16,4 +10,10 @@ margin-left: 0; margin-right: 0; } + + figcaption { + @include font-size('sm'); + color: var(--color-contrast-medium); + font-weight: 300; + } } \ No newline at end of file diff --git a/assets/scss/components/_newsletter.scss b/assets/scss/components/_newsletter.scss index b08decd..c8095dd 100644 --- a/assets/scss/components/_newsletter.scss +++ b/assets/scss/components/_newsletter.scss @@ -1,25 +1,11 @@ .newsletter-header { color: var(--color-contrast-high); margin-bottom: 0; - - font-size: 1.5rem; - line-height: 2.2rem; - - @include respond-to('small') { - font-size: 1.8rem; - line-height: 2.6rem; - } } .newsletter-desc { color: var(--color-contrast-medium-high); - font-size: 1rem; - line-height: 1.7rem; - - @include respond-to('small') { - font-size: 1.2rem; - line-height: 2rem; - } + @include font-size('base'); } #newsletter-form { diff --git a/assets/scss/components/_page-header.scss b/assets/scss/components/_page-header.scss index 19abe7d..cd112a9 100644 --- a/assets/scss/components/_page-header.scss +++ b/assets/scss/components/_page-header.scss @@ -14,13 +14,7 @@ margin: 0; color: var(--color-contrast-high); font-weight: 500; - font-size: 1.8rem; - line-height: 2.2rem; - - @include respond-to('medium') { - font-size: 2.3rem; - line-height: 2.8rem; - } + @include font-size('lg'); } .page-header-desc { @@ -28,11 +22,5 @@ margin-top: 15px; color: var(--color-contrast-medium); font-weight: 400; - font-size: 1rem; - line-height: 1.6rem; - - @include respond-to('medium') { - font-size: 1.2rem; - line-height: 1.8rem; - } + @include font-size('base'); } \ No newline at end of file diff --git a/assets/scss/components/_pagination.scss b/assets/scss/components/_pagination.scss index fc71bfa..8b19ddd 100644 --- a/assets/scss/components/_pagination.scss +++ b/assets/scss/components/_pagination.scss @@ -6,7 +6,7 @@ gap: 15px 10px; margin-top: 50px; padding: 0; - font-size: 1rem; + @include font-size('base'); } .page-link { diff --git a/assets/scss/components/_toc.scss b/assets/scss/components/_toc.scss index 74e7ff1..786816c 100644 --- a/assets/scss/components/_toc.scss +++ b/assets/scss/components/_toc.scss @@ -14,7 +14,7 @@ } .toc-header, .toc-drop-icon { - font-size: 1rem; + @include font-size('sm'); font-weight: 500; margin: 0; text-align: center; @@ -22,8 +22,7 @@ .toc-contents { display: none; - font-size: 1rem; - line-height: 1.6rem; + @include font-size('sm'); &--active { display: block; diff --git a/assets/scss/layout/_footer.scss b/assets/scss/layout/_footer.scss index c27a519..b86570d 100644 --- a/assets/scss/layout/_footer.scss +++ b/assets/scss/layout/_footer.scss @@ -13,6 +13,6 @@ .footer-copyright { text-align: center; - font-size: 1rem; + @include font-size('base'); color: var(--color-contrast-medium-high); } \ No newline at end of file diff --git a/assets/scss/layout/_header.scss b/assets/scss/layout/_header.scss index 123ea20..fc68cc9 100644 --- a/assets/scss/layout/_header.scss +++ b/assets/scss/layout/_header.scss @@ -28,7 +28,7 @@ } .logo { - font-size: 1.8rem; + @include font-size('md'); font-weight: 700; text-decoration: none; width: fit-content; diff --git a/assets/scss/pages/_home.scss b/assets/scss/pages/_home.scss index 0d9e4ef..6beba33 100644 --- a/assets/scss/pages/_home.scss +++ b/assets/scss/pages/_home.scss @@ -22,35 +22,12 @@ .hero-title { font-weight: 900; margin-top: 0; - font-size: 2rem; - line-height: 2.5rem; - - @include respond-to('small') { - font-size: 2.5rem; - line-height: 3rem; - } - - @include respond-to('m-large') { - font-size: 3rem; - line-height: 3.6rem; - } + @include font-size('xl'); } .hero-subtitle { color: var(--color-contrast-medium-high); - - font-size: 1rem; - line-height: 1.7rem; - - @include respond-to('small') { - font-size: 1.2rem; - line-height: 2rem; - } - } - - .hero-btns { - @extend .btn-group; - margin-top: 20px; + @include font-size('base'); } } @@ -101,7 +78,7 @@ } #select-posts { - font-size: 0.9rem; + @include font-size('sm'); padding: 0.4rem; border: 1px solid var(--color-contrast-medium-low); border-radius: 5px; diff --git a/assets/scss/pages/_post-list.scss b/assets/scss/pages/_post-list.scss index a9a4c08..20a7401 100644 --- a/assets/scss/pages/_post-list.scss +++ b/assets/scss/pages/_post-list.scss @@ -14,12 +14,8 @@ .post-list-title { font-weight: 400; - font-size: 1.2rem; margin: 0; - - @include respond-to('small') { - font-size: 1.4rem; - } + @include font-size('md'); a { text-decoration: none; diff --git a/assets/scss/pages/_project-list.scss b/assets/scss/pages/_project-list.scss index 35fe684..705ed67 100644 --- a/assets/scss/pages/_project-list.scss +++ b/assets/scss/pages/_project-list.scss @@ -1,7 +1,7 @@ .project-list { display: flex; flex-wrap: wrap; - align-items: baseline; + align-items: flex-start; gap: 2rem 1rem; & > * { @@ -45,7 +45,7 @@ border-top-right-radius: 10px; a { - font-size: 0.9rem; + @include font-size('sm'); } } diff --git a/assets/scss/pages/_single.scss b/assets/scss/pages/_single.scss index 1bbb625..164f142 100644 --- a/assets/scss/pages/_single.scss +++ b/assets/scss/pages/_single.scss @@ -34,9 +34,12 @@ } } +.single-post-contents { + overflow: auto; +} + .series { - font-size: 1.1rem; - line-height: 1.8rem; + @include font-size('base'); margin: 2rem 0; } @@ -45,7 +48,7 @@ border: 1px solid var(--color-primary); border-radius: 5px; padding: 0.3rem; - font-size: 0.8rem; + @include font-size('sm'); font-weight: 500; margin-left: 10px; } @@ -62,7 +65,7 @@ border: 1px solid var(--color-contrast-medium-low); border-radius: 12px; padding: 10px; - font-size: 1.1rem; + @include font-size('base'); max-width: 300px; &:hover { @@ -73,9 +76,5 @@ } .related-posts { - font-size: 1.1rem; + @include font-size('base'); } - -.project-single-btns { - margin-top: 20px; -} \ No newline at end of file diff --git a/assets/scss/pages/_terms.scss b/assets/scss/pages/_terms.scss index 70c05c7..9248265 100644 --- a/assets/scss/pages/_terms.scss +++ b/assets/scss/pages/_terms.scss @@ -8,7 +8,7 @@ .term { border: 1px solid var(--color-primary); border-radius: 20px; - font-size: 0.8rem; + @include font-size('sm'); padding: 0.4rem 0.6rem; &:hover { @@ -18,7 +18,6 @@ } @include respond-to('small') { - font-size: 1rem; padding: 0.5rem 0.7rem; } } diff --git a/exampleSite/config/_default/params.toml b/exampleSite/config/_default/params.toml index 2069686..377ff95 100644 --- a/exampleSite/config/_default/params.toml +++ b/exampleSite/config/_default/params.toml @@ -7,6 +7,7 @@ disallow_search_engines = false # Disallow search engine crawling in robots.txt ### Content favicon = true # Enable favicon, add your favicon files to /static/ directory # avatar = 'avatar.png' # Custom avatar image in /assets/ +grayscale_avatar = true # Add a grayscale filter to the avatar image author = 'John Doe' # Default author for
meta description = "Personal blog and portfolio site of John Doe." # Add a global meta description to footer_text = "Built with [Hugo Liftoff](https://github.com/wjh18/hugo-liftoff) theme." # Customize footer text diff --git a/images/screenshot.png b/images/screenshot.png index efa097c..f5a3a65 100644 Binary files a/images/screenshot.png and b/images/screenshot.png differ diff --git a/images/tn.png b/images/tn.png index 7735d35..7031723 100644 Binary files a/images/tn.png and b/images/tn.png differ diff --git a/layouts/_default/_markup/render-codeblock.html b/layouts/_default/_markup/render-codeblock.html index 3686c31..6c45709 100644 --- a/layouts/_default/_markup/render-codeblock.html +++ b/layouts/_default/_markup/render-codeblock.html @@ -1,7 +1,6 @@ -{{ $class := .Attributes.class | default "" }} {{ $lang := .Attributes.lang | default .Type }} {{ if transform.CanHighlight $lang }} -{{ $lang }}{{ highlight .Inner $lang }}
-{{else}}
- {{ $lang }}{{ .Inner }}{{ $lang }}
-{{end}}
\ No newline at end of file
+ {{ $lang }}{{ highlight .Inner $lang }}
+{{ else }}
+ {{ .Inner }}
+{{ end }}
\ No newline at end of file
diff --git a/layouts/index.html b/layouts/index.html
index 9bfcc2e..8ad3beb 100644
--- a/layouts/index.html
+++ b/layouts/index.html
@@ -6,7 +6,7 @@ {{.}}
{{ end }} -