

def register_palette_entry(self, name, foreground, background, mono=None, foreground_high=None, background_high=None):
    'Register a single palette entry.\n\n        name -- new entry/attribute name\n\n        foreground -- a string containing a comma-separated foreground\n        color 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            Settings:\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        background -- a string containing the background color\n\n            Background 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        mono -- a comma-separated string containing monochrome terminal\n        settings (see "Settings" above.)\n\n            None = no terminal settings (same as \'default\')\n\n        foreground_high -- a string containing a comma-separated\n        foreground color and settings, standard foreground\n        colors (see "Color values" above) or high-colors may\n        be used\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            None = use foreground parameter value\n\n        background_high -- a string containing the background color,\n        standard background colors (see "Background colors" above)\n        or high-colors (see "High-color example values" above)\n        may be used\n\n            None = use background parameter value\n        '
    basic = AttrSpec(foreground, background, 16)
    if (type(mono) == tuple):
        mono = ','.join(mono)
    if (mono is None):
        mono = DEFAULT
    mono = AttrSpec(mono, DEFAULT, 1)
    if (foreground_high is None):
        foreground_high = foreground
    if (background_high is None):
        background_high = background
    high_256 = AttrSpec(foreground_high, background_high, 256)

    def large_h(desc):
        if (not desc.startswith('h')):
            return False
        num = int(desc[1:], 10)
        return (num > 15)
    if (large_h(foreground_high) or large_h(background_high)):
        high_88 = basic
    else:
        high_88 = AttrSpec(foreground_high, background_high, 88)
    signals.emit_signal(self, UPDATE_PALETTE_ENTRY, name, basic, mono, high_88, high_256)
    self._palette[name] = (basic, mono, high_88, high_256)

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