chalk#ChalkInstance TypeScript Examples

The following examples show how to use chalk#ChalkInstance. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: node-colors.ts    From xiome with MIT License 6 votes vote down vote up
export function nodeColors(force?: boolean): Colors {
	let chalkstick: ChalkInstance

	if (force === true)
		chalkstick = new Chalk({level: 1})
	else if (force === false)
		chalkstick = new Chalk({level: 0})
	else
		chalkstick = new Chalk()

	const bind = <T extends Colorizer>(colorfunc: T) =>
		colorfunc.bind(chalkstick)

	return {
		log: bind(chalkstick.cyan),
		info: bind(chalkstick.cyanBright),
		debug: bind(chalkstick.blueBright),
		warn: bind(chalkstick.yellow),
		error: bind(chalkstick.redBright),
	}
}