def convert_to_color ( object, name, value ):
    """ Converts a tuple or an integer to an RGB color value, or raises a
    TraitError if that is not possible.
    """
    if (type( value ) in SequenceTypes) and (len( value ) == 3):
        return ( range_check( value[0] ),
                 range_check( value[1] ),
                 range_check( value[2] ) )
    if type( value ) is int:
        num = int( value )
        return ( (num / 0x10000)        / 255.0
                 ((num / 0x100) & 0xFF) / 255.0,
                 (num & 0xFF)           / 255.0 )
    raise TraitError
dataset/ETHPy150Open enthought/traitsui/traitsui/null/rgb_color_trait.py/convert_to_color/original