gui.palette.badge_for

gui.palette.badge_for(meaning)

The badge of a level or state.

Parameters

Name Type Description Default
meaning str "error", "warning", "ok", "info", "selection", "running" or "survived". Any other word gets the info badge. required

Returns

Name Type Description
Badge Badge Background, text colour and label.

Examples

from spotregen.gui.palette import badge_for, contrast_ratio

for meaning in ("error", "warning", "ok"):
    badge = badge_for(meaning)
    print(meaning, badge.background, round(contrast_ratio(badge.foreground, badge.background), 1))
error #D55E00 5.4
warning #E69F00 9.3
ok #009E73 6.1