StyleMap overview
This module implements a named, inspectable map from PPPartName values to PPStyle’s (see Style.ts). A PPStyleMap therefore defines which style to apply to each visual element of a stringified value. Two pre-built instances are provided: - none: no styling applied. - darkMode: a color scheme suited to dark-mode terminals.
Use the make function to define custom instances if the pre-built ones do not suit your needs.
Table of contents
Constructors
make
Constructor of a PPStyleMap
Signature
export declare const make: (params: MTypes.Data<Type>) => Type
Destructors
get
Returns the Style associated with partName which identifies a part of a stringified value. Returns ASContextStyler.none if partName is not present in self.
Signature
export declare const get: (partName: PPPartName.Type) => MTypes.OneArgFunction<Type, PPStyle.Type>
Equivalences
equivalence
Equivalence
Signature
export declare const equivalence: Equivalence.Equivalence<Type>
Getters
id
Returns the id property of self
Signature
export declare const id: MTypes.OneArgFunction<Type, string>
styles
Returns the styles property of self
Signature
export declare const styles: MTypes.OneArgFunction<Type, PPStyles.Type>
Instances
darkMode
StyleMap instance for ansi dark mode
Signature
export declare const darkMode: Type
none
StyleMap instance that doesn’t apply any formatting (uses the none ASContextStyler of the ansi- styles library for all parts to be formatted)
Signature
export declare const none: Type
Models
Type (class)
Type that represents a PPStyleMap
Signature
export declare class Type {
private constructor({ id, styles }: MTypes.Data<Type>)
}
make (static method)
Static constructor
Signature
static make(params: MTypes.Data<Type>): Type
[MData.idSymbol] (method)
Returns the id of this
Signature
[MData.idSymbol](): string | (() => string)
[Hash.symbol] (method)
Calculates the hash value of this
Signature
[Hash.symbol](): number
[MEquivalenceBasedEqualityData.isEquivalentToSymbol] (method)
Function that implements the equivalence of this and that
Signature
[MEquivalenceBasedEqualityData.isEquivalentToSymbol](this: this, that: this): boolean
[MEquivalenceBasedEqualityData.hasSameTypeMarkerAsSymbol] (method)
Predicate that returns true if that has the same type marker as this
Signature
[MEquivalenceBasedEqualityData.hasSameTypeMarkerAsSymbol](that: unknown): boolean
id (property)
Id of this PPStyleMap instance. Useful for equality and debugging.
Signature
readonly id: string
styles (property)
Map of Style’s to be applied to the different parts of the value to stringify
Signature
readonly styles: PPStyles.Type
Module markers
moduleTag
Module tag
Signature
export declare const moduleTag: "@parischap/pretty-print/Parameters/StyleMap/"