diff --git a/.gitignore b/.gitignore index 261a569..81b816c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ *.html thumbnails/ +*.js \ No newline at end of file diff --git a/README.md b/README.md index 9212265..0e315b6 100644 --- a/README.md +++ b/README.md @@ -5,6 +5,7 @@ A place where to find gruvbox theme wallpapers. 1. Fork the project. 2. Add the wallpapers that you have in their respective folder. +3. For light variants: Place the light-themed wallpapers in a light/ subfolder within the category. 3. Make a pull request. > [!CAUTION] diff --git a/app.js b/app.js deleted file mode 100644 index 39853ed..0000000 --- a/app.js +++ /dev/null @@ -1,60 +0,0 @@ -function loadPage(section, page) { - let buttons = document.getElementById(section).getElementsByTagName("button"); - let currSel; - for (let i in buttons) { - if (buttons[i].classList?.contains("selected")) { - if (page - 1 == i) return; - else { - currSel = buttons[i]; - break; - } - } - } - - fetch(section + "_page" + page + ".html") - .then((response) => response.text()) - .then((data) => { - document.getElementById(section + "-content").innerHTML = data; - if (currSel) { - currSel.classList.remove("selected"); - } - document.getElementById(section).getElementsByTagName("button")[page - 1].classList.add("selected"); - }); -} - -function activeSection(section) { - hideAll(); - - const targetSection = document.getElementById(section); - targetSection.focus(); - targetSection.classList.add("selected"); - setTimeout(() => { - targetSection.scrollIntoView({ block: "start", behavior: "smooth" }); - }, 100); -} - -function hideAll() { - document.querySelectorAll(".section").forEach((s) => { - s.classList.remove("selected"); - }); -} -const HIDDEN_CLASS = "hidden"; - -function hideThemeSwitcher(currentTheme) { - if (currentTheme == "dark") { - document.getElementById("dark-icon")?.classList.add(HIDDEN_CLASS); - document.getElementById("light-icon")?.classList.remove(HIDDEN_CLASS); - } else { - document.getElementById("light-icon")?.classList.add(HIDDEN_CLASS); - document.getElementById("dark-icon")?.classList.remove(HIDDEN_CLASS); - } -} -function setTheme(newTheme) { - document.documentElement.style.setProperty("color-scheme", newTheme); - hideThemeSwitcher(newTheme); -} - -function switchTheme() { - setTheme(document.documentElement.style.getPropertyValue("color-scheme")=="dark"?"light":"dark"); -} - diff --git a/build.sh b/build.sh index 0943800..2e7cffd 100755 --- a/build.sh +++ b/build.sh @@ -26,59 +26,206 @@ generate_thumbnails() { rm -rf thumbnails/* # Count total number of images - total_images=$(find ./wallpapers -type f | wc -l) + total_images=$(find ./wallpapers -type f \( -iname "*.jpg" -o -iname "*.jpeg" -o -iname "*.png" \) | wc -l) current_image=0 for section_dir in ./wallpapers/*; do section_name="${section_dir##*/}" mkdir -p "thumbnails/$section_name" + # Process dark images (base directory) for img in "$section_dir"/*; do + [ -f "$img" ] || continue + case "$img" in + *.jpg|*.jpeg|*.png|*.JPG|*.JPEG|*.PNG) ;; + *) continue ;; + esac + current_image=$((current_image + 1)) local img_filename="${img##*/}" local thumbnail="thumbnails/$section_name/$img_filename" echo "($current_image/$total_images): $img -> $thumbnail" convert "$img" -resize 300x300 "$thumbnail" done + + # Process light images if light folder exists + if [ -d "$section_dir/light" ]; then + mkdir -p "thumbnails/$section_name/light" + for img in "$section_dir/light"/*; do + [ -f "$img" ] || continue + case "$img" in + *.jpg|*.jpeg|*.png|*.JPG|*.JPEG|*.PNG) ;; + *) continue ;; + esac + + current_image=$((current_image + 1)) + local img_filename="${img##*/}" + local thumbnail="thumbnails/$section_name/light/$img_filename" + echo "($current_image/$total_images): $img -> $thumbnail" + convert "$img" -resize 300x300 "$thumbnail" + done + fi done echo "Thumbnail generation complete: $total_images images processed" } -write_section_header() { - echo "write section header ..." - echo "