Skip to content

Instantly share code, notes, and snippets.

@yusent
Last active April 6, 2021 01:17
Show Gist options
  • Save yusent/50c474ad4a2b8c4d14b59d4d97da2200 to your computer and use it in GitHub Desktop.
Save yusent/50c474ad4a2b8c4d14b59d4d97da2200 to your computer and use it in GitHub Desktop.
A script to select a random base16 theme from base16-shell project for the current terminal ignoring some keywords
#!/bin/sh
scripts_dir="$HOME/.config/base16-shell/scripts"
if [ -d $scripts_dir ]
then
blacklist="light|brushtrees|cupertino|github|cupcake|tomorrow|fruit"
entries=($(ls -d "$scripts_dir"/* | grep -Ev "$blacklist"))
# Seed random generator
random=$$$(date +%s)
selected_entry=${entries[$RANDOM % ${#entries[@]} ]}
theme_name=$(basename "$selected_entry" | cut -d. -f1)
echo "Using $theme_name theme"
source $selected_entry
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment