Theme Update

This commit is contained in:
Francesco 2024-04-22 17:12:48 +02:00
parent 16d9fb1710
commit 70a938a3a5
3 changed files with 32 additions and 1 deletions

View file

@ -281,4 +281,13 @@ footer a {
.autonumber h4:before {
content: counter(h2-counter) "." counter(h3-counter) "." counter(h4-counter) "\00a0\00a0";
}
/* Dark mode */
.dark .img-light {
display: none !important;
}
.light .img-dark {
display: none !important;
}

View file

@ -1 +1,14 @@
console.log('This site was generated by Hugo.');
const images = document.querySelectorAll('img');
images.forEach(img => {
if (img.src.endsWith('#dark-mode')) {
console.log('found');
img.onload = function () {
console.log(`Image loaded: ${img.src}`);
};
}
});

View file

@ -0,0 +1,9 @@
{{ $url := .Destination | safeURL }}
{{/* Append class to figures based on ending -> #dark or #light */}}
<figure {{ $file_name_array :=split $url "#" }} {{ $file_name_len :=len $file_name_array }} {{ if eq (index
$file_name_array (sub $file_name_len 1)) "dark" }} class="img-dark" {{ else if eq (index $file_name_array (sub
$file_name_len 1)) "light" }} class="img-light" {{end }}>
<img src="{{ $url }}">
</figure>