Tryst::Theme
Reads the ACTIVE ttk theme's colors, so an owner-drawn widget doesn't
hardcode colors that clash with aqua/clam/dark - the piece every
ad-hoc canvas widget skips and then looks wrong on one platform (see
OwnerDrawnWidget's own doc comment). Nothing else in this codebase reads
a ttk style color before this - every existing ttk::style call
elsewhere is a configure (write), never a lookup (read).
Two steps because ttk itself only deals in color NAMES, not numbers:
ttk::style lookup hands back a symbolic system color on aqua (e.g.
"systemWindowBackgroundColor") but a literal hex string on most other
themes (e.g. "#dcdad5" on clam) - confirmed directly against both,
not assumed. #rgb resolves whichever kind Tk handed back into actual
8-bit channels via winfo rgb, which accepts both forms uniformly.
Constructors
Instance methods
The theme's own selection/highlight color - the closest thing ttk has to a single "accent" color, used the same way a selected list row or a focused entry's border already draws with it.
The current window/widget background, e.g. what an owner-drawn widget's own canvas should clear to so it doesn't stand out as a different color than its surroundings.
The raw Tk colour name/hex string, for another widget's own
-background option - skips #background's RGB round-trip, which
loses precision winfo rgb's 16-bit -> 8-bit downscale can round
away.
A raw ttk style option, resolved to 8-bit RGB. Falls back to
default (any real Tk color name or hex string) if the active
theme has no answer for option on style - confirmed directly
that an unrecognized option returns empty rather than raising, so
this always needs a caller-supplied fallback to stay meaningful.
The current text/foreground color.
Resolves any Tk color name (symbolic like "systemWindowBackgroundColor"
or literal like "#dcdad5") to 8-bit RGB. winfo rgb itself always
answers in 16-bit-per-channel values (0-65535), hence the //257
(65535/255) downscale - the window argument only matters for a
window-specific palette (8-bit displays), never for the truecolor
case every platform this project targets actually has, so "." is
always fine regardless of which style the color came from.