def rgb_to_yiq(r, g=None, b=None):
if type(r) in [list,tuple]:<EOL><INDENT>r, g, b = r<EOL><DEDENT>y = (r * <NUM_LIT>) + (g * <NUM_LIT>) + (b *<NUM_LIT>)<EOL>i = (r * <NUM_LIT>) - (g * <NUM_LIT>) - (b *<NUM_LIT>)<EOL>q = (r * <NUM_LIT>) - (g * <NUM_LIT>) + (b *<NUM_LIT>)<EOL>return (y, i, q)<EOL>
Convert the color from RGB to YIQ.

    Parameters:
      :r:
        The Red component value [0...1]
      :g:
        The Green component value [0...1]
      :b:
        The Blue component value [0...1]

    Returns:
      The color as an (y, i, q) tuple in the range:
      y[0...1],
      i[0...1],
      q[0...1]

    >>> '(%g, %g, %g)' % rgb_to_yiq(1, 0.5, 0)
    '(0.592263, 0.458874, -0.0499818)'