Hi,

refining my proposal i tested this function to list about 7600 blueish
colors:

---------------------------------------------------------------------------
#!/bin/bash

# Minimum brightness for blue to be perceivable
blue_base=64

# Minimum advantage of blue over (red + green)/2
blue_advantage=64

# Iterate in steps of 8 to reduce the number of solutions (from ~1e6 to ~1e4)
# Also avoid the highest quarter of values of red and green
for r in {0..192..8}
do
  rhex="$(printf '%2.2x' "$r")"
  for g in {0..192..8}
  do
    ghex="$(printf '%2.2x' "$g")"
    bstart="$(expr "(" "$r" + "$g" ")" / 2 + "$blue_advantage")"
    if test "$bstart" -lt "$blue_base"
    then
      bstart="$blue_base"
    fi
    if test "$bstart" -le 255
    then
      for b in $(eval echo $(echo '{'"$bstart"..255..8'}'))
      do
        bhex="$(printf '%2.2x' "$b")"
        echo "#${rhex}${ghex}${bhex}"
      done
    fi
  done
done

---------------------------------------------------------------------------

All random samples from this list yielded blueish background with
  xterm -bg "$value" &
I hope there are not local spots of non-blue appearance.

(Greg Wooledge might have a better proposal for the eval-echo-echo
gesture to bring a variable value into the bash {x...y..step}
enumeration.)

It turned out that in my eyes high values of red can unblue ignificantly
higher values of blue to some pinkish magenta. Very low values of blue are
perceived as black, unless real black is there ifor comparison (then it's
midnight blue).


Have a nice day :)

Thomas

Reply via email to