qarp.plotting.styles

Plot styles: the named colour schemes and the qarp matplotlib theme. Public depth: flat. Submodules are private.

qarp.plotting.styles.get_text_color(background_color: str) str[source]

Determine optimal text color (black or white) based on background luminance.

Uses the relative luminance formula from WCAG 2.0 guidelines to determine whether black or white text provides better contrast.

Parameters:

background_color – Hex color string (e.g., ‘#FF5500’ or ‘FF5500’)

Returns:

‘#000000’ (black) for light backgrounds, ‘#FFFFFF’ (white) for dark backgrounds

qarp.plotting.styles.qarp_rc(use_latex: bool = False) Dict[source]

Scoped rc params for OpenQARP figures — apply via plt.rc_context.

qarp.plotting.styles.register_fonts() str | None[source]

Register the bundled Spline Sans Mono faces with matplotlib.

Returns the usable mono family name (bundled face, or the first system fallback found), or None if only the generic monospace is available. Cached: registration mutates matplotlib’s global font manager once.

qarp.plotting.styles.tint(color: str, amount: float) str[source]

Blend color toward white; amount is the retained color fraction.

qarp.plotting.styles.CLASSIC_COLORS = {'box': '#EFEFEF', 'h': '#B9DAFB', 'measure': '#FF8579', 'p': '#F8C66B', 'reset': '#FF8579', 'rx': '#B8E1F4', 'ry': '#F2C94C', 'rz': '#C89DF1', 's': '#F8C66B', 'sdg': '#F8C66B', 't': '#94FBE1', 'tdg': '#94FBE1', 'u': '#F8C66B', 'x': '#EAB8E4', 'y': '#CF8C8F', 'z': '#B5E1BD'}

dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object’s

(key, value) pairs

dict(iterable) -> new dictionary initialized as if via:

d = {} for k, v in iterable:

d[k] = v

dict(**kwargs) -> new dictionary initialized with the name=value pairs

in the keyword argument list. For example: dict(one=1, two=2)

qarp.plotting.styles.COLORBLIND_COLORS = {'box': '#EFEFEF', 'h': '#E69F00', 'measure': '#FF0000', 'p': '#D55E00', 'reset': '#FF0000', 'rx': '#0072B2', 'ry': '#D55E00', 'rz': '#CC79A7', 's': '#999999', 'sdg': '#999999', 't': '#E69F00', 'tdg': '#E69F00', 'u': '#CC79A7', 'x': '#56B4E9', 'y': '#009E73', 'z': '#F0E442'}

dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object’s

(key, value) pairs

dict(iterable) -> new dictionary initialized as if via:

d = {} for k, v in iterable:

d[k] = v

dict(**kwargs) -> new dictionary initialized with the name=value pairs

in the keyword argument list. For example: dict(one=1, two=2)

qarp.plotting.styles.COLOR_SCHEMES = {'classic': {'box': '#EFEFEF', 'h': '#B9DAFB', 'measure': '#FF8579', 'p': '#F8C66B', 'reset': '#FF8579', 'rx': '#B8E1F4', 'ry': '#F2C94C', 'rz': '#C89DF1', 's': '#F8C66B', 'sdg': '#F8C66B', 't': '#94FBE1', 'tdg': '#94FBE1', 'u': '#F8C66B', 'x': '#EAB8E4', 'y': '#CF8C8F', 'z': '#B5E1BD'}, 'colorblind': {'box': '#EFEFEF', 'h': '#E69F00', 'measure': '#FF0000', 'p': '#D55E00', 'reset': '#FF0000', 'rx': '#0072B2', 'ry': '#D55E00', 'rz': '#CC79A7', 's': '#999999', 'sdg': '#999999', 't': '#E69F00', 'tdg': '#E69F00', 'u': '#CC79A7', 'x': '#56B4E9', 'y': '#009E73', 'z': '#F0E442'}, 'default': {'box': '#f4f7f9', 'h': '#101b2d', 'measure': '#c77d02', 'p': '#2e4fd8', 'reset': '#c77d02', 'rx': '#2e4fd8', 'ry': '#2e4fd8', 'rz': '#2e4fd8', 's': '#101b2d', 'sdg': '#101b2d', 'swap': '#101b2d', 't': '#101b2d', 'tdg': '#101b2d', 'u': '#2e4fd8', 'x': '#101b2d', 'y': '#101b2d', 'z': '#101b2d'}, 'deuteranopia': {'box': '#EFEFEF', 'h': '#0077BB', 'measure': '#EE3377', 'p': '#DDAA33', 'reset': '#EE3377', 'rx': '#004488', 'ry': '#DDAA33', 'rz': '#AA3377', 's': '#BBBBBB', 'sdg': '#BBBBBB', 't': '#0077BB', 'tdg': '#0077BB', 'u': '#AA3377', 'x': '#33BBEE', 'y': '#EE7733', 'z': '#FFDD44'}, 'grayscale': {'box': '#F0F0F0', 'h': '#E0E0E0', 'measure': '#404040', 'p': '#989898', 'reset': '#404040', 'rx': '#B0B0B0', 'ry': '#909090', 'rz': '#707070', 's': '#D0D0D0', 'sdg': '#D0D0D0', 't': '#E8E8E8', 'tdg': '#E8E8E8', 'u': '#787878', 'x': '#A0A0A0', 'y': '#808080', 'z': '#C0C0C0'}, 'high_contrast': {'box': '#DDDDDD', 'h': '#0000FF', 'measure': '#FF0000', 'p': '#FFCC00', 'reset': '#FF0000', 'rx': '#000088', 'ry': '#FFCC00', 'rz': '#8800FF', 's': '#888888', 'sdg': '#888888', 't': '#00FFFF', 'tdg': '#00FFFF', 'u': '#8800FF', 'x': '#FF00FF', 'y': '#FF8800', 'z': '#00FF00'}, 'protanopia': {'box': '#EFEFEF', 'h': '#0077BB', 'measure': '#CC3311', 'p': '#DDAA33', 'reset': '#CC3311', 'rx': '#004488', 'ry': '#DDAA33', 'rz': '#BB5566', 's': '#999999', 'sdg': '#999999', 't': '#0077BB', 'tdg': '#0077BB', 'u': '#BB5566', 'x': '#33BBEE', 'y': '#EE7733', 'z': '#FFDD44'}, 'qarp': {'box': '#f4f7f9', 'h': '#101b2d', 'measure': '#c77d02', 'p': '#2e4fd8', 'reset': '#c77d02', 'rx': '#2e4fd8', 'ry': '#2e4fd8', 'rz': '#2e4fd8', 's': '#101b2d', 'sdg': '#101b2d', 'swap': '#101b2d', 't': '#101b2d', 'tdg': '#101b2d', 'u': '#2e4fd8', 'x': '#101b2d', 'y': '#101b2d', 'z': '#101b2d'}, 'tritanopia': {'box': '#EFEFEF', 'h': '#EE3377', 'measure': '#CC3311', 'p': '#CC3311', 'reset': '#CC3311', 'rx': '#117733', 'ry': '#CC3311', 'rz': '#AA4499', 's': '#999999', 'sdg': '#999999', 't': '#EE3377', 'tdg': '#EE3377', 'u': '#AA4499', 'x': '#33BB33', 'y': '#EE7733', 'z': '#FF6677'}}

dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object’s

(key, value) pairs

dict(iterable) -> new dictionary initialized as if via:

d = {} for k, v in iterable:

d[k] = v

dict(**kwargs) -> new dictionary initialized with the name=value pairs

in the keyword argument list. For example: dict(one=1, two=2)

qarp.plotting.styles.DEFAULT_COLORS = {'box': '#f4f7f9', 'h': '#101b2d', 'measure': '#c77d02', 'p': '#2e4fd8', 'reset': '#c77d02', 'rx': '#2e4fd8', 'ry': '#2e4fd8', 'rz': '#2e4fd8', 's': '#101b2d', 'sdg': '#101b2d', 'swap': '#101b2d', 't': '#101b2d', 'tdg': '#101b2d', 'u': '#2e4fd8', 'x': '#101b2d', 'y': '#101b2d', 'z': '#101b2d'}

dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object’s

(key, value) pairs

dict(iterable) -> new dictionary initialized as if via:

d = {} for k, v in iterable:

d[k] = v

dict(**kwargs) -> new dictionary initialized with the name=value pairs

in the keyword argument list. For example: dict(one=1, two=2)

qarp.plotting.styles.DEUTERANOPIA_COLORS = {'box': '#EFEFEF', 'h': '#0077BB', 'measure': '#EE3377', 'p': '#DDAA33', 'reset': '#EE3377', 'rx': '#004488', 'ry': '#DDAA33', 'rz': '#AA3377', 's': '#BBBBBB', 'sdg': '#BBBBBB', 't': '#0077BB', 'tdg': '#0077BB', 'u': '#AA3377', 'x': '#33BBEE', 'y': '#EE7733', 'z': '#FFDD44'}

dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object’s

(key, value) pairs

dict(iterable) -> new dictionary initialized as if via:

d = {} for k, v in iterable:

d[k] = v

dict(**kwargs) -> new dictionary initialized with the name=value pairs

in the keyword argument list. For example: dict(one=1, two=2)

qarp.plotting.styles.GRAYSCALE_COLORS = {'box': '#F0F0F0', 'h': '#E0E0E0', 'measure': '#404040', 'p': '#989898', 'reset': '#404040', 'rx': '#B0B0B0', 'ry': '#909090', 'rz': '#707070', 's': '#D0D0D0', 'sdg': '#D0D0D0', 't': '#E8E8E8', 'tdg': '#E8E8E8', 'u': '#787878', 'x': '#A0A0A0', 'y': '#808080', 'z': '#C0C0C0'}

dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object’s

(key, value) pairs

dict(iterable) -> new dictionary initialized as if via:

d = {} for k, v in iterable:

d[k] = v

dict(**kwargs) -> new dictionary initialized with the name=value pairs

in the keyword argument list. For example: dict(one=1, two=2)

qarp.plotting.styles.HIGH_CONTRAST_COLORS = {'box': '#DDDDDD', 'h': '#0000FF', 'measure': '#FF0000', 'p': '#FFCC00', 'reset': '#FF0000', 'rx': '#000088', 'ry': '#FFCC00', 'rz': '#8800FF', 's': '#888888', 'sdg': '#888888', 't': '#00FFFF', 'tdg': '#00FFFF', 'u': '#8800FF', 'x': '#FF00FF', 'y': '#FF8800', 'z': '#00FF00'}

dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object’s

(key, value) pairs

dict(iterable) -> new dictionary initialized as if via:

d = {} for k, v in iterable:

d[k] = v

dict(**kwargs) -> new dictionary initialized with the name=value pairs

in the keyword argument list. For example: dict(one=1, two=2)

qarp.plotting.styles.PROTANOPIA_COLORS = {'box': '#EFEFEF', 'h': '#0077BB', 'measure': '#CC3311', 'p': '#DDAA33', 'reset': '#CC3311', 'rx': '#004488', 'ry': '#DDAA33', 'rz': '#BB5566', 's': '#999999', 'sdg': '#999999', 't': '#0077BB', 'tdg': '#0077BB', 'u': '#BB5566', 'x': '#33BBEE', 'y': '#EE7733', 'z': '#FFDD44'}

dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object’s

(key, value) pairs

dict(iterable) -> new dictionary initialized as if via:

d = {} for k, v in iterable:

d[k] = v

dict(**kwargs) -> new dictionary initialized with the name=value pairs

in the keyword argument list. For example: dict(one=1, two=2)

qarp.plotting.styles.QARP_COLORS = {'box': '#f4f7f9', 'h': '#101b2d', 'measure': '#c77d02', 'p': '#2e4fd8', 'reset': '#c77d02', 'rx': '#2e4fd8', 'ry': '#2e4fd8', 'rz': '#2e4fd8', 's': '#101b2d', 'sdg': '#101b2d', 'swap': '#101b2d', 't': '#101b2d', 'tdg': '#101b2d', 'u': '#2e4fd8', 'x': '#101b2d', 'y': '#101b2d', 'z': '#101b2d'}

dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object’s

(key, value) pairs

dict(iterable) -> new dictionary initialized as if via:

d = {} for k, v in iterable:

d[k] = v

dict(**kwargs) -> new dictionary initialized with the name=value pairs

in the keyword argument list. For example: dict(one=1, two=2)

qarp.plotting.styles.TRITANOPIA_COLORS = {'box': '#EFEFEF', 'h': '#EE3377', 'measure': '#CC3311', 'p': '#CC3311', 'reset': '#CC3311', 'rx': '#117733', 'ry': '#CC3311', 'rz': '#AA4499', 's': '#999999', 'sdg': '#999999', 't': '#EE3377', 'tdg': '#EE3377', 'u': '#AA4499', 'x': '#33BB33', 'y': '#EE7733', 'z': '#FF6677'}

dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object’s

(key, value) pairs

dict(iterable) -> new dictionary initialized as if via:

d = {} for k, v in iterable:

d[k] = v

dict(**kwargs) -> new dictionary initialized with the name=value pairs

in the keyword argument list. For example: dict(one=1, two=2)