

def __init__(self, fg, bg, colors=256):
    "\n        fg -- a string containing a comma-separated foreground color\n              and settings\n\n              Color values:\n              'default' (use the terminal's default foreground),\n              'black', 'dark red', 'dark green', 'brown', 'dark blue',\n              'dark magenta', 'dark cyan', 'light gray', 'dark gray',\n              'light red', 'light green', 'yellow', 'light blue', \n              'light magenta', 'light cyan', 'white'\n\n              High-color example values:\n              '#009' (0% red, 0% green, 60% red, like HTML colors)\n              '#fcc' (100% red, 80% green, 80% blue)\n              'g40' (40% gray, decimal), 'g#cc' (80% gray, hex),\n              '#000', 'g0', 'g#00' (black),\n              '#fff', 'g100', 'g#ff' (white)\n              'h8' (color number 8), 'h255' (color number 255)\n\n              Setting:\n              'bold', 'underline', 'blink', 'standout'\n\n              Some terminals use 'bold' for bright colors.  Most terminals\n              ignore the 'blink' setting.  If the color is not given then\n              'default' will be assumed.\n\n        bg -- a string containing the background color\n\n              Color values:\n              'default' (use the terminal's default background),\n              'black', 'dark red', 'dark green', 'brown', 'dark blue',\n              'dark magenta', 'dark cyan', 'light gray'\n\n              High-color exaples:\n              see fg examples above\n\n              An empty string will be treated the same as 'default'.\n\n        colors -- the maximum colors available for the specification\n\n                   Valid values include: 1, 16, 88 and 256.  High-color \n                   values are only usable with 88 or 256 colors.  With\n                   1 color only the foreground settings may be used.\n\n        >>> AttrSpec('dark red', 'light gray', 16)\n        AttrSpec('dark red', 'light gray')\n        >>> AttrSpec('yellow, underline, bold', 'dark blue')\n        AttrSpec('yellow,bold,underline', 'dark blue')\n        >>> AttrSpec('#ddb', '#004', 256) # closest colors will be found\n        AttrSpec('#dda', '#006')\n        >>> AttrSpec('#ddb', '#004', 88)\n        AttrSpec('#ccc', '#000', colors=88)\n        "
    if (colors not in (1, 16, 88, 256)):
        raise AttrSpecError(('invalid number of colors (%d).' % colors))
    self._value = (0 | (_HIGH_88_COLOR * (colors == 88)))
    self.foreground = fg
    self.background = bg
    if (self.colors > colors):
        raise AttrSpecError((('foreground/background (%s/%s) require ' + 'more colors than have been specified (%d).') % (repr(fg), repr(bg), colors)))

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