Style overview
Same as StyleCharacteristics (see StyleCharacteristics.ts) but, as syntaxic sugar, styles are callable functions that create Text’s (see Text.ts). For instance, const text = ASStyle.red('foo')
will create a text containing the string ‘foo’ styled in red.
Table of contents
Constructors
color
Builds a Style that applies color
as foreground color
Signature
export declare const color: (color: ASColor.Type) => Type
Destructors
style
Gets the style
property of self
Signature
export declare const style: MTypes.OneArgFunction<Type, ASStyleCharacteristics.Type>
toId
Returns the id of self
Signature
export declare const toId: (self: Type) => string
Equivalences
equivalence
Equivalence
Signature
export declare const equivalence: Equivalence.Equivalence<Type>
Guards
has
Type guard
Signature
export declare const has: (u: unknown) => u is Type
Instances
blinking
Blinking Style instance
Signature
export declare const blinking: Type
bold
Bold Style instance
Signature
export declare const bold: Type
defaultColor
Default foreground color Style instance
Signature
export declare const defaultColor: Type
dim
Dim Style instance
Signature
export declare const dim: Type
hidden
Hidden Style instance
Signature
export declare const hidden: Type
inversed
Inversed Style instance
Signature
export declare const inversed: Type
italic
Italic Style instance
Signature
export declare const italic: Type
none
None Style instance, i.e. Style that performs no styling
Signature
export declare const none: Type
notBlinking
NotBlinking Style instance
Signature
export declare const notBlinking: Type
notBold
NotBold Style instance
Signature
export declare const notBold: Type
notDim
NotDim Style instance
Signature
export declare const notDim: Type
notHidden
NotHidden Style instance
Signature
export declare const notHidden: Type
notInversed
NotInversed Style instance
Signature
export declare const notInversed: Type
notItalic
NotItalic Style instance
Signature
export declare const notItalic: Type
notOverlined
NotOverlined Style instance
Signature
export declare const notOverlined: Type
notStruckThrough
NotStruckThrough Style instance
Signature
export declare const notStruckThrough: Type
notUnderlined
NotUnderlined Style instance
Signature
export declare const notUnderlined: Type
overlined
Overlined Style instance
Signature
export declare const overlined: Type
struckThrough
Struck-through Style instance
Signature
export declare const struckThrough: Type
underlined
Underlined Style instance
Signature
export declare const underlined: Type
Models
Action (namespace)
Namespace of a Style used as an action
Type (interface)
Type of the action
Signature
export interface Type {
(...args: ReadonlyArray<string | ASText.Type>): ASText.Type
}
Bg (namespace)
Namespace for colors used as background colors
Bright (namespace)
Namespace for bright original colors
Bright (namespace)
Namespace for bright original colors
Type (interface)
Type that represents a Style
Signature
export interface Type extends Action.Type, Equal.Equal, MInspectable.Inspectable, Pipeable.Pipeable {
/** StyleCharacteristics that define this Style */
readonly style: ASStyleCharacteristics.Type
/** @internal */
readonly [_TypeId]: _TypeId
}
moduleTag
Module tag
Signature
export declare const moduleTag: "@parischap/ansi-styles/Style/"
Original instances
black
Original black color style instance
Signature
export declare const black: Type
blue
Original blue color style instance
Signature
export declare const blue: Type
cyan
Original cyan color style instance
Signature
export declare const cyan: Type
green
Original green color style instance
Signature
export declare const green: Type
magenta
Original magenta color style instance
Signature
export declare const magenta: Type
red
Original red color style instance
Signature
export declare const red: Type
white
Original white color style instance
Signature
export declare const white: Type
yellow
Original yellow color style instance
Signature
export declare const yellow: Type
Utils
mergeOver
Builds a new Style by merging self
and that
. In case of conflict (e.g self
contains Bold
and that
contains NotBold
), the style in that
will prevail.
Signature
export declare const mergeOver: (that: Type) => (self: Type) => Type
mergeUnder
Builds a new Style by merging self
and that
. In case of conflict (e.g self
contains Bold
and that
contains NotBold
), the style in self
will prevail.
Signature
export declare const mergeUnder: (that: Type) => (self: Type) => Type