You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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 of alias. 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:
The new module palettes provides a Palette class
This class can generate mashing colors from just one primary color input, with multiple possible strategies
The whole module now has a default palette that can be accessed using ptg.palette and in markup
TIM 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}, like primary-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
Add various color manipulation utilities
Add #auto TIM pseudo-tag that always gives properly contrasted foreground text
Add palettes module for framework-wide color generation & configuration
Add Synchronized Output support
Add FancyReprWidget
Add ptg --palette flag
Bugfixes
Fix markup aliases getting literalized during parsing.eval_alias & MarkupLanguage.alias
Fix background colors creating vertical seams in SVG exports
Fix colors getting localized pre-maturely
Refactors
Make all the ptg program & all builting widgets use the global palette
Prefix all ANSI colors with ansi-
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:
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
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
![palette](https://user-images.githubusercontent.com/66030897/183215065-be74551b-112d-4376-ae69-e99ff7c9195f.svg)
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