v7.2.0: Palettes! #91
bczsalba
announced in
Announcements
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
This version brings the long-awaited (at least by myself) color palette system!
Before that, the new
#auto
TIM pseudo-tag deserves a mention. It makes the parser look at the currently applied background color, and it is replaced with a color that properly contrasts it while parsing! This way,[alias #auto]Text
, will always be legible, regardless of the meaning ofalias
. It is also automatically used by all widget styles (whenever there is no foreground specified), so you can just define a style as@surface+1
, and PTG will make sure it looks nice and readable!Anyways, the palette. Here is the gist of it:
palettes
provides aPalette
classptg.palette
and in markupTIM gains the following sets of new aliases:
primary
secondary
tertiary
accent
surface
surface2
surface3
surface4
success
warning
error
Each color has 7 shades, and each shade a foreground and background variant. The base color (i.e. with no shade modifications) use the name as written above, and every other alias is defined as
{name}{+/-}{shade_amount}
, likeprimary-3
for the darkest shade of primary, and
surface+2for the second-brightest surface shade. Each alias comes complete with a background variant bound to
@{alias}`, such as@secondary+2
.It's easier to show than tell, so here is the new default palette, as exported by

ptg --palette --export-svg <filename>
:Changelog
Additions
#auto
TIM pseudo-tag that always gives properly contrasted foreground textpalettes
module for framework-wide color generation & configurationSynchronized Output
supportFancyReprWidget
ptg --palette
flagBugfixes
parsing.eval_alias
&MarkupLanguage.alias
Refactors
ptg
program & all builting widgets use the global paletteansi-
Showcase
Here is my home-grown project launcher,
lens
, using the new default color palette (and an upcoming new button widget, but that's for the next release notes):...and now, using it's custom-defined palette, using the primary color
#58A46F
:Here is
ptg
in the new default color palette:...and now with a bunch of randomly generated ones:
This discussion was created from the release v7.2.0: Palettes!.
Beta Was this translation helpful? Give feedback.
All reactions