Add dark background (#1024)
Co-authored-by: Emruz Hossain <hossainemruz@gmail.com>
This commit is contained in:
parent
35a1686bfe
commit
f8befe62cc
1 changed files with 67 additions and 0 deletions
|
@ -20,6 +20,10 @@
|
||||||
{{ $backgroundImage = site.Params.background }}
|
{{ $backgroundImage = site.Params.background }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
|
{{ $darkBackgroundImage:= $backgroundImage }}
|
||||||
|
{{ if site.Params.darkBackground }}
|
||||||
|
{{ $darkBackgroundImage = site.Params.darkBackground }}
|
||||||
|
{{ end }}
|
||||||
|
|
||||||
{{ $authorImage:= "/images/default-avatar.png" }}
|
{{ $authorImage:= "/images/default-avatar.png" }}
|
||||||
{{ if $author.image }}
|
{{ if $author.image }}
|
||||||
|
@ -73,6 +77,41 @@
|
||||||
{{ $large := $src}}
|
{{ $large := $src}}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
|
{{/* get file that matches the filename as specified as src="" in shortcode */}}
|
||||||
|
{{ $darkSrc := resources.Get $darkBackgroundImage }}
|
||||||
|
|
||||||
|
{{/* resize the src image to the given sizes */}}
|
||||||
|
|
||||||
|
{{ $darkTiny := $darkSrc.Resize $tinyw }}
|
||||||
|
{{ $darkSmall := $darkSrc.Resize $smallw }}
|
||||||
|
{{ $darkMedium := $darkSrc.Resize $mediumw }}
|
||||||
|
{{ $darkLarge := $darkSrc.Resize $largew }}
|
||||||
|
|
||||||
|
{{/* only use images smaller than or equal to the src (original) image size, as Hugo will upscale small images */}}
|
||||||
|
{{/* set the sizes attribute to (min-width: 35em) 1200px, 100vw unless overridden in shortcode */}}
|
||||||
|
|
||||||
|
{{ if lt $darkSrc.Width "500" }}
|
||||||
|
{{ $darkTiny := $src}}
|
||||||
|
{{ $darkSmall := $src}}
|
||||||
|
{{ $darkMedium := $src}}
|
||||||
|
{{ $darkLarge := $src}}
|
||||||
|
{{ end }}
|
||||||
|
|
||||||
|
{{ if lt $src.Width "800" }}
|
||||||
|
{{ $darkSmall := $src}}
|
||||||
|
{{ $darkMedium := $src}}
|
||||||
|
{{ $darkLarge := $src}}
|
||||||
|
{{ end }}
|
||||||
|
|
||||||
|
{{ if lt $src.Width "1200" }}
|
||||||
|
{{ $darkMedium := $src}}
|
||||||
|
{{ $darkLarge := $src}}
|
||||||
|
{{ end }}
|
||||||
|
|
||||||
|
{{ if lt $src.Width "1500" }}
|
||||||
|
{{ $darkLarge := $src}}
|
||||||
|
{{ end }}
|
||||||
|
|
||||||
<div class="container-fluid home" id="home">
|
<div class="container-fluid home" id="home">
|
||||||
<style>
|
<style>
|
||||||
/* 0 to 299 */
|
/* 0 to 299 */
|
||||||
|
@ -100,6 +139,34 @@
|
||||||
background-image: url('{{ $src.RelPermalink }}');
|
background-image: url('{{ $src.RelPermalink }}');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
html[data-theme='dark'] {
|
||||||
|
/* 0 to 299 */
|
||||||
|
#homePageBackgroundImageDivStyled {
|
||||||
|
background-image: url('{{ $darkTiny.RelPermalink }}');
|
||||||
|
}
|
||||||
|
/* 300 to X */
|
||||||
|
@media (min-width: 500px) and (max-width: 800px) { /* or 301 if you want really the same as previously. */
|
||||||
|
#homePageBackgroundImageDivStyled {
|
||||||
|
background-image: url('{{ $darkSmall.RelPermalink }}');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@media (min-width: 801px) and (max-width: 1200px) { /* or 301 if you want really the same as previously. */
|
||||||
|
#homePageBackgroundImageDivStyled {
|
||||||
|
background-image: url('{{ $darkMedium.RelPermalink }}');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@media (min-width: 1201px) and (max-width: 1500px) { /* or 301 if you want really the same as previously. */
|
||||||
|
#homePageBackgroundImageDivStyled {
|
||||||
|
background-image: url('{{ $darkLarge.RelPermalink }}');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@media (min-width: 1501px) { /* or 301 if you want really the same as previously. */
|
||||||
|
#homePageBackgroundImageDivStyled {
|
||||||
|
background-image: url('{{ $darkSrc.RelPermalink }}');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
<span class="on-the-fly-behavior"></span>
|
<span class="on-the-fly-behavior"></span>
|
||||||
<div
|
<div
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue