Hi, i wrote: > > rhex="$(printf '%2.2x' "$r")"
Greg Wooledge wrote: > As of bash 3.1, you can use printf -v rhex %2.2x "$r" I'm still at the bash level of DLD Linux 0.99pl13. > > bstart="$(expr "(" "$r" + "$g" ")" / 2 + "$blue_advantage")" > bstart=$(( (r+g)/2 + blue_advantage )) expr is nearly as old as i am. We old entities have to show solidarity. > > if test "$bstart" -lt "$blue_base" > Not wrong, but you could also use if ((bstart < blue_base)) "test" is one of my favorite four-letter words. > > for b in $(eval echo $(echo '{'"$bstart"..255..8'}')) > for ((b=bstart; b<=255; b+=8)) This is indeed a temptation for a C programmer like me. > > echo "#${rhex}${ghex}${bhex}" > Oh, is this what the *hex variables are for? Why not just leave them > in pseudo-integer form the whole time, and then use a single printf *here* > to convert them to hex for output? As programmer of MC 68000 BASIC machines i learned that i shall do everything outside the loop what does not have to be done inside. Pun aside: All your comments are valid and should be taken into account if a production version of a blueish color enumerator gets developed. My demonstration was mainly to get samples for testing whether my numerical understanding of blue matches my perception of blue on the given screen. Nicolas George wrote: > Key word: gamma. Yep. Several manipulating instances are involved in the transition from RGB values to human color perception. I hope that my 7600 RGB values are broadly accepted as blueish, though. Have a nice day :) Thomas