@hook.command
def rainbow(text):
 text = str(text)
 text = strip(text)
 col = list(COLORS.items())
 out = ''
 l = len(COLORS)
 for (i, t) in enumerate(text):
  if (t == ' '):
   out += t
  else:
   out += (col[(i % l)][1] + t)
 return out

@ hook . command def rainbow ( text ) : text = str ( text ) text = strip ( text ) col = list ( COLORS . items ( ) ) out = '' l = len ( COLORS ) for ( i , t ) in enumerate ( text ) : if ( t == ' ' ) : out += t else : out += ( col [ ( i % l ) ] [ 1 ] + t ) return out
returns a list of colors sampled at equal intervals over the spectrum .