earthbound19 / _ebDev

Various tools, mostly custom-made for art development.
2 stars 2 forks source link

ensure `hexplt2ppm.sh` works with hexplt format files that have comments #131

Open earthbound19 opened 2 years ago

earthbound19 commented 2 years ago

use this updated code from renderHexPalette.sh that gets all hex codes whatever else is around them:

get array of colors from file by extracting all matches of a pattern of six hex digits preceded by a #:

colorsArray=( $(grep -i -o '#[0-9a-f]{6}' $hexColorSrcFullPath | tr -d '#') ) # tr command removes pound symbol, and surrounding () makes it an actual array

Get number of colors (from array):

numColors=${#colorsArray[@]}