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
#autoTIM 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:
palettesprovides aPaletteclassptg.paletteand in markupTIM gains the following sets of new aliases:
primarysecondarytertiaryaccentsurfacesurface2surface3surface4successwarningerrorEach 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-3for the darkest shade of primary, andsurface+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
#autoTIM pseudo-tag that always gives properly contrasted foreground textpalettesmodule for framework-wide color generation & configurationSynchronized OutputsupportFancyReprWidgetptg --paletteflagBugfixes
parsing.eval_alias&MarkupLanguage.aliasRefactors
ptgprogram & 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
ptgin 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