Skip to content

fontlabapp.fontui.teaching_text.palette

palette

What: Inspect the live FontLab theme palette for script-panel colours. How: Read this panel's own palette on Refresh. List all twenty colour roles for Active, Inactive and Disabled, plus six text/background contrast pairs. A role missing by name is listed as unavailable; its contrast pairs are omitted. Why: Role-based colours follow the host theme. Fixed hexadecimal themes do not. Usage: Refresh after a theme change. Copy the report for diagnosis, or copy the code below into a panel method. The code reads roles from that panel's palette. Benefit: Choose readable script colours without changing FontLab preferences. Contrast composites foreground alpha over opaque backgrounds. A translucent background has no single ratio and is reported explicitly. Ratios describe palette values; widget styles can render differently.

Setup: FontLab 9, Python 3.11, Fly and fontlabapp. Modeless, read-only panel. Independent rewrite of the Qt Styles and Style Sheet example ideas (Riverbank Computing, Nokia). Based on the author's own FontLab sample, Apache-2.0. Idea only; no upstream code or assets included.

Complete member index

Every captured member retains its own identity. Identical captured declaration text is linked once; this does not establish native inheritance or interchangeable objects.

Member Kind Signature Summary
GROUPS attribute
PAIRS attribute
RGBA attribute
ROLES attribute
build function (parent: Any=None) -> Any Build the original controls as a hidden child for an owned lab tab. (shared captured text)
contrast function (foreground: RGBA, background: RGBA) -> float | None Compute the sRGB luminance ratio after foreground alpha compositing.
main function (*, embedded: bool=False, parent: Any=None) -> Any Inspect this panel's palette without setting any palette or style.
palette_report function (palette: Any, palette_type: Any) -> str Read available roles once; list missing names and skip affected pairs.
role_code function () -> str Return compact role lookup and a concrete house-panel label usage.
role_value function (palette_type: Any, name: str) -> Any Use numeric role 20 for PlaceholderText; return None for absent names.