Creating color swatches with Imagemagick and bash

by c

#!/bin/bash

if [ ! -d colors ]; then
mkdir colors
fi

for color in "$@"
do
convert -size 100x100 xc:$color colors/$color.jpg
done

Run with:

./colors.sh blue black green purple

Add a hash # in front of $color to generate by hex.