def ConvertTo255( x):
    """
    The color scheme has been chosen to create a typical
    earthlike or M class , planet.
    """
    x = x / abs( x) * 3 * sqrt( abs( x / 3))
    if x > 0:
        x /= 1.5
    if x > 2.5:
        return 'white'
    if x < -0.6: # blues
        return '#0000' + ColStr( int( random() * 55) + 200)
    if x < -0.2: # -0.6 to -0.2 cyan colours
        x = int(( -x - 0.6) / 0.4 * 127) + 127
        return '#50' + ColStr( int( x / 2) + 30) + ColStr( 255 - x)
    if x > 1.7: # grey colours 1.7 - 2.5
        x = int(( x - 1.7) / 0.8 * 127) + 127
        return '#' + ColStr( x) + ColStr( x) + ColStr( x)
    if x > 1.5: # brown colours 1.5 - 1.7
        x = int(( x - 1.5) / 0.2 * 120 / 2)  + 120
        return '#' + ColStr( x + 30) + ColStr( x - 30) + ColStr( x - 30)
    if x > 1.0: # kaki colours 0.8 - 1.3
        z = 1 - ( x - 0.8) / 0.7
        x = 150 - int( z * 60)
        y = 190 + int( z * 20)
        z = 100 - int( z * 30)
        return '#' + ColStr( x) + ColStr( y) + ColStr( z)
    else: # green colours -0.2 - 1.0
        x = int(( x - 0.2) / 1.6 * 60) + 120
        return '#20' + ColStr( x + 60) + ColStr( x)

    The color scheme has been chosen to create a typical
    earthlike or M class , planet.
    
recipes/Python/576521_Blobby_Planet/recipe-576521.py