Skip to content

Commit

Permalink
fix: allow setting default theme(color mode) in no-script browsers cl…
Browse files Browse the repository at this point in the history
…oses #50 (PR #85)

Co-authored-by: Vladyslav Shurbin <2917600-kusyka911@users.noreply.gitlab.com>
  • Loading branch information
kusyka911 and Vladyslav Shurbin authored Jul 26, 2023
1 parent 79a3101 commit 970bdd9
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion layouts/index.html
Original file line number Diff line number Diff line change
@@ -1,8 +1,18 @@
<!DOCTYPE html>
{{- $defaultColor := .Site.Params.defaultColor | default "auto" -}}

{{/* allow website developer to enforce default dark mode */}}
{{- if eq $defaultColor "dark" -}}
<html lang="{{ .Site.LanguageCode }}" class="dark">
{{- else if eq $defaultColor "light" -}}
<html lang="{{ .Site.LanguageCode }}" class="light">
{{- else -}}
<html lang="{{ .Site.LanguageCode }}">
{{- end -}}

{{- partial "head.html" . -}}

<body data-theme="{{ .Site.Params.defaultColor | default "auto" }}" class="notransition">
<body data-theme="{{ $defaultColor }}" class="notransition">
{{- partial "scriptsBodyStart.html" . -}}
{{- partial "header.html" . -}}
<div class="wrapper">
Expand Down

0 comments on commit 970bdd9

Please sign in to comment.