Skip to content

Commit

Permalink
docs: improve screenshot generation script
Browse files Browse the repository at this point in the history
  • Loading branch information
tomcur committed Jul 19, 2024
1 parent ff51589 commit 0d01703
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 13 deletions.
7 changes: 2 additions & 5 deletions media/grayscale-light.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 2 additions & 5 deletions media/verf-light.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 8 additions & 3 deletions scripts/screenshots.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,26 @@ if [ -n "$SCREENSHOT_NVIM" ]; then
NVIM="$SCREENSHOT_NVIM"
fi

cargo build --release
BIN=./target/release/hi-nvim-rs

for light_dark in "light" "dark"; do
for colorscheme in "highlow" "verf" "twocolor" "grayscale"; do
cargo run -- ./colorschemes/$colorscheme.toml >"$DIR/$colorscheme.vim"
$BIN -- ./colorschemes/$colorscheme.toml >"$DIR/$colorscheme.vim"

(
# exit on a timer to perform some other commands in the meantime
echo ":lua vim.defer_fn(function() vim.cmd('q!') end, 50)"
echo -ne ":12\rnVjj$"
sleep 0.1
sleep 0.5
) | termsnap --term xterm-256color --columns 58 --lines 20 --render-before-clear -- \
"$NVIM" --clean \
-c "source ./scripts/nvim-config.vim" \
-c "set bg=$light_dark" \
-c "source $DIR/$colorscheme.vim" \
./hi-nvim-rs-web/code-examples/rust.rs \
>./media/$colorscheme-$light_dark.svg
>./media/$colorscheme-$light_dark.svg &
done
done

wait

0 comments on commit 0d01703

Please sign in to comment.