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..18409ae 100644 --- a/README.md +++ b/README.md @@ -5,10 +5,11 @@ 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] -> - Use files under 25mg +> - Use files under 25mb > - Avoid spaces in names > [!TIP] @@ -16,6 +17,37 @@ A place where to find gruvbox theme wallpapers. I tend to accept any contributions, but let's keep the site with images that match or look good with the gruvbox's color scheme :'). + +## Nix package + +1. **Use [nix flakes](https://wiki.nixos.org/wiki/Flakes)**: + +2. Add the following to your `flake.nix` file: + +```nix +inputs = { + gruvbox-wallpapers.url = "github:AngelJumbo/gruvbox-wallpapers"; + # ... +}; +``` + +3. Then, in your Home Manager configuration: + +```nix +{ + inputs, + pkgs, + ... +}: { + home.file = { + "path/to/dir" = { + source = inputs.gruvbox-wallpapers.packages."${pkgs.stdenv.hostPlatform.system}".default; + recursive = true; + }; + }; +} +``` + ## Disclaimer Most of the images shared here are community contributions, and their original sources are often unknown. If you are the rightful owner of any image and would like it removed, please contact me by opening an issue. For any use beyond personal scope, I recommend performing a reverse image search to verify the origin. 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..d1b573a 100755 --- a/build.sh +++ b/build.sh @@ -26,147 +26,481 @@ 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 "