MCPcopy Index your code
hub / github.com/matplotlib/matplotlib / color_block

Method color_block

lib/matplotlib/colors.py:2149–2157  ·  view source on GitHub ↗
(color)

Source from the content-addressed store, hash-verified

2147 png_bytes = self._repr_png_()
2148 png_base64 = base64.b64encode(png_bytes).decode('ascii')
2149 def color_block(color):
2150 hex_color = to_hex(color, keep_alpha=True)
2151 return (f'<div title="{hex_color}" '
2152 'style="display: inline-block; '
2153 'width: 1em; height: 1em; '
2154 'margin: 0; '
2155 'vertical-align: middle; '
2156 'border: 1px solid #555; '
2157 f'background-color: {hex_color};"></div>')
2158
2159 return ('<div style="vertical-align: middle;">'
2160 f'<strong>{self.name}</strong> '

Callers

nothing calls this directly

Calls 1

to_hexFunction · 0.85

Tested by

no test coverage detected