summaryrefslogtreecommitdiff
path: root/.config/kitty/kitty-themes/.tools/generate_themes_previews.sh
diff options
context:
space:
mode:
authorIndrajith K L2023-09-08 14:43:41 +0530
committerIndrajith K L2023-09-08 14:43:41 +0530
commit0f144c1ef9d831b1c663ef998f40e22c33156d9e (patch)
treedd20b22ce18b5e6e0b00b43d1b5a2699792563f1 /.config/kitty/kitty-themes/.tools/generate_themes_previews.sh
downloadDotFiles-master.tar.gz
DotFiles-master.tar.bz2
DotFiles-master.zip
Initial CommitHEADmaster
* Adds Basic dot files configs
Diffstat (limited to '.config/kitty/kitty-themes/.tools/generate_themes_previews.sh')
-rwxr-xr-x.config/kitty/kitty-themes/.tools/generate_themes_previews.sh32
1 files changed, 32 insertions, 0 deletions
diff --git a/.config/kitty/kitty-themes/.tools/generate_themes_previews.sh b/.config/kitty/kitty-themes/.tools/generate_themes_previews.sh
new file mode 100755
index 0000000..63e5825
--- /dev/null
+++ b/.config/kitty/kitty-themes/.tools/generate_themes_previews.sh
@@ -0,0 +1,32 @@
+#!/usr/bin/env bash
+# This script generate all preview images for the themes
+
+root="$(git rev-parse --show-toplevel)"
+tools="$root/.tools"
+
+PATH=$tools:$PATH
+
+# new kitty window, return its id
+id=$(kitty @ new-window --title themes --window-type os --cwd "$tools")
+# start bash without reading the profile nor the configuration
+kitty @ send-text --match id:"$id" "/usr/bin/env bash --noprofile --norc\n"
+kitty @ set-font-size 24
+
+# save all preview in this directory
+previews="$root/_previews"
+if [ ! -d "$previews" ]; then
+ mkdir "$previews"
+fi
+
+while read -r theme
+do
+ echo "Genereting theme preview for $theme"
+ preview_directory=$previews/$(basename "${theme%.*}")
+ [ ! -d "$preview_directory" ] && mkdir "$preview_directory"
+ preview_filename=$previews/$(basename "${theme%.*}")/preview.png
+ generate_theme_preview.sh "$id" "$theme" "$preview_filename"
+ mogrify -resize 1024x\> "$preview_filename"
+done < /dev/stdin
+
+kitty @ close-window --match id:"$id"
+kitty @ set-font-size 16