Breaking changes:
+ const x = crayon as any as Crayon<...>
- const x = crayon as Crayon<...>
Improvements:
- Fixed issue with overwriting config properties
- Fixed issues with extending styles
- Improved
rgb -> ansi8
and rgb -> ansi4
color conversion
- Improved typings, in addition to extending styles it's now possible to extend functions and their typings:
import crayon from 'crayon.js';
import { Crayon } from 'crayon.js/lib/types';
/*
Styles - Template Literal Type
example: 'gray' | 'grey'
default: void
Functions - Template Literal Type
example: 'rainbowize' | 'somethingelse'
default: void
Object - object
example: {
rainbowize: (shift: number) => Crayon<Styles, Functions, Object>
}
default: void
*/
type Styles = 'gray' | 'grey';
type Functions = 'somethingelse';
type Object = {
rainbowize: (shift: number) => Crayon<Styles, Functions, Object>
};
const typedCrayon = crayon as any as Crayon<Styles, Functions, Object>;
// now typedCrayon has autocompletion for gray, grey, somethingelse (no arguments autocompletion) and rainbowize