Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
These changes give
Faces primacy, replacing the use ofSymbols to name faces. This change is capitalised on to address several long-standing pain points with face/style management in StyledStrings.The supplants #99 and #110, and perhaps also #100.
This closes #87, and should also help with #61.
Motivation
The current system has several issues:
AnnotatedStringprintingAnyvalue type in annotationsREPL_History_search_unselected)styled"{bluue:text}"renders unstyled)Faces andSymbols throughout the APISolution
Parameterised annotation values:
AnnotatedString{S}becomesAnnotatedString{S, V}, allowing dispatch on the annotation value type without piracy (see: JuliaLang/julia#60527).Face primacy: Named faces are now referenced by
Faceobjects rather thanSymbols. Theface""macro provides convenient access (face"red"instead of:red). Faces are hybrid-interned: created at compile time, registered at runtime.Palettes: Three new macros for module-scoped face definitions:
@defpalette!- define a set of named faces@registerpalette!- register faces at runtime (in__init__)@usepalettes!- import faces from other modulesFace remapping:
remapfacessubstitutes faces at string construction time, complementing the existingwithfaceswhich operates at display time.Example
Breaking changes
None. The old
Symbol-based API remains supported with deprecation warnings.