Skip to content

Instantly share code, notes, and snippets.

@matejaputic
Last active July 8, 2025 11:59
Show Gist options
  • Select an option

  • Save matejaputic/b81a6b897faed06855228f02c5895ac2 to your computer and use it in GitHub Desktop.

Select an option

Save matejaputic/b81a6b897faed06855228f02c5895ac2 to your computer and use it in GitHub Desktop.
Make Dark Mode PDF
#!/usr/bin/env zsh
PATH=/opt/homebrew/bin:$PATH
DIR=$(dirname "$1")
FILENAME=$(basename "$1" .pdf)
magick -density 600 "$1" \
-background white -alpha remove \
-auto-level \
-brightness-contrast 50 -clamp \
-fuzz 7% -fill "#202020" -opaque white \
-fuzz 5% -fill "#E0E0E0" -opaque black \
-filter Lanczos -resize 50% \
-compress Zip -quality 100 \
"$DIR/$FILENAME-dark.pdf"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment