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

Method color_block

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

Source from the content-addressed store, hash-verified

1040 png_bytes = self._repr_png_()
1041 png_base64 = base64.b64encode(png_bytes).decode('ascii')
1042 def color_block(color):
1043 hex_color = to_hex(color, keep_alpha=True)
1044 return (f'<div title="{hex_color}" '
1045 'style="display: inline-block; '
1046 'width: 1em; height: 1em; '
1047 'margin: 0; '
1048 'vertical-align: middle; '
1049 'border: 1px solid #555; '
1050 f'background-color: {hex_color};"></div>')
1051
1052 return ('<div style="vertical-align: middle;">'
1053 f'<strong>{self.name}</strong> '

Callers

nothing calls this directly

Calls 1

to_hexFunction · 0.85

Tested by

no test coverage detected