

def _color_desc_256(num):
    "\n    Return a string description of color number num.\n    0..15 -> 'h0'..'h15' basic colors (as high-colors)\n    16..231 -> '#000'..'#fff' color cube colors\n    232..255 -> 'g3'..'g93' grays\n\n    >>> _color_desc_256(15)\n    'h15'\n    >>> _color_desc_256(16)\n    '#000'\n    >>> _color_desc_256(17)\n    '#006'\n    >>> _color_desc_256(230)\n    '#ffd'\n    >>> _color_desc_256(233)\n    'g7'\n    >>> _color_desc_256(234)\n    'g11'\n\n    "
    assert ((num >= 0) and (num < 256)), num
    if (num < _CUBE_START):
        return ('h%d' % num)
    if (num < _GRAY_START_256):
        num -= _CUBE_START
        (b, num) = ((num % _CUBE_SIZE_256), (num // _CUBE_SIZE_256))
        (g, num) = ((num % _CUBE_SIZE_256), (num // _CUBE_SIZE_256))
        r = (num % _CUBE_SIZE_256)
        return ('#%x%x%x' % (_CUBE_STEPS_256_16[r], _CUBE_STEPS_256_16[g], _CUBE_STEPS_256_16[b]))
    return ('g%d' % _GRAY_STEPS_256_101[(num - _GRAY_START_256)])

dataset/ETHPy150Open AnyMesh/anyMesh-Python/example/urwid/display_common.py _color_desc_256/original