def getAlongWayHexadecimalColor(beginBrightness, colorWidth, difference, endColorTuple, wayLength):
 alongWay = 1.0
 if (wayLength != 0.0):
  alongWay = (0.4 + (0.6 * min(1.0, abs((float(difference) / float(wayLength))))))
 hexadecimalColor = '#'
 oneMinusAlongWay = (1.0 - alongWay)
 for primaryIndex in xrange(3):
  hexadecimalColor += getAlongWayHexadecimalPrimary(beginBrightness, oneMinusAlongWay, colorWidth, endColorTuple[primaryIndex], alongWay)
 return hexadecimalColor

def getAlongWayHexadecimalColor ( beginBrightness , colorWidth , difference , endColorTuple , wayLength ) : alongWay = 1.0 if ( wayLength != 0.0 ) : alongWay = ( 0.4 + ( 0.6 * min ( 1.0 , abs ( ( float ( difference ) / float ( wayLength ) ) ) ) ) ) hexadecimalColor = '#' oneMinusAlongWay = ( 1.0 - alongWay ) for primaryIndex in xrange ( 3 ) : hexadecimalColor += getAlongWayHexadecimalPrimary ( beginBrightness , oneMinusAlongWay , colorWidth , endColorTuple [ primaryIndex ] , alongWay ) return hexadecimalColor
get a color along the way from begin brightness to the end color .