src/lsi/utils/term.py
def get_color_hash(string, _min=MIN_COLOR_BRIGHT, _max=MAX_COLOR_BRIGHT):
    """
    Hashes a string and returns a number between ``min`` and ``max``.
    """
    hash_num = int(hashlib.sha1(string.encode('utf-8')).hexdigest()[:6], 16)
    _range = _max - _min
    num_in_range = hash_num % _range
    return color(_min + num_in_range)
def get_color_hash(string, _min=MIN_COLOR_BRIGHT, _max=MAX_COLOR_BRIGHT):
    hash_num = int(hashlib.sha1(string.encode('utf-8')).hexdigest()[:6], 16)
    _range = _max - _min
    num_in_range = hash_num % _range
    return color(_min + num_in_range)
def get_color_hash ( string , _min = MIN_COLOR_BRIGHT , _max = MAX_COLOR_BRIGHT ) : hash_num = int ( hashlib . sha1 ( string . encode ( 'utf-8' ) ) . hexdigest ( ) [ : 6 ] , 16 ) _range = _max - _min num_in_range = hash_num % _range return color ( _min + num_in_range )
Hashes a string and returns a number between ``min`` and ``max``.
Hashes a string and returns a number between min and max .