123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456 |
- /*!
- * ansi-colors <https://github.com/doowb/ansi-colors>
- *
- * Copyright (c) 2015-2017, Brian Woodward.
- * Released under the MIT License.
- */
- 'use strict';
- /**
- * Module dependencies
- */
- var wrap = require('ansi-wrap');
- /**
- * Wrap a string with ansi codes to create a black background.
- *
- * ```js
- * console.log(colors.bgblack('some string'));
- * ```
- *
- * @param {string} message String to wrap with ansi codes.
- * @return {string} Wrapped string
- * @api public
- * @name bgblack
- */
- exports.bgblack = function bgblack(message) {
- return wrap(40, 49, message);
- };
- /**
- * Wrap a string with ansi codes to create a blue background.
- *
- * ```js
- * console.log(colors.bgblue('some string'));
- * ```
- *
- * @param {string} message String to wrap with ansi codes.
- * @return {string} Wrapped string
- * @api public
- * @name bgblue
- */
- exports.bgblue = function bgblue(message) {
- return wrap(44, 49, message);
- };
- /**
- * Wrap a string with ansi codes to create a cyan background.
- *
- * ```js
- * console.log(colors.bgcyan('some string'));
- * ```
- *
- * @param {string} message String to wrap with ansi codes.
- * @return {string} Wrapped string
- * @api public
- * @name bgcyan
- */
- exports.bgcyan = function bgcyan(message) {
- return wrap(46, 49, message);
- };
- /**
- * Wrap a string with ansi codes to create a green background.
- *
- * ```js
- * console.log(colors.bggreen('some string'));
- * ```
- *
- * @param {string} message String to wrap with ansi codes.
- * @return {string} Wrapped string
- * @api public
- * @name bggreen
- */
- exports.bggreen = function bggreen(message) {
- return wrap(42, 49, message);
- };
- /**
- * Wrap a string with ansi codes to create a magenta background.
- *
- * ```js
- * console.log(colors.bgmagenta('some string'));
- * ```
- *
- * @param {string} message String to wrap with ansi codes.
- * @return {string} Wrapped string
- * @api public
- * @name bgmagenta
- */
- exports.bgmagenta = function bgmagenta(message) {
- return wrap(45, 49, message);
- };
- /**
- * Wrap a string with ansi codes to create a red background.
- *
- * ```js
- * console.log(colors.bgred('some string'));
- * ```
- *
- * @param {string} message String to wrap with ansi codes.
- * @return {string} Wrapped string
- * @api public
- * @name bgred
- */
- exports.bgred = function bgred(message) {
- return wrap(41, 49, message);
- };
- /**
- * Wrap a string with ansi codes to create a white background.
- *
- * ```js
- * console.log(colors.bgwhite('some string'));
- * ```
- *
- * @param {string} message String to wrap with ansi codes.
- * @return {string} Wrapped string
- * @api public
- * @name bgwhite
- */
- exports.bgwhite = function bgwhite(message) {
- return wrap(47, 49, message);
- };
- /**
- * Wrap a string with ansi codes to create a yellow background.
- *
- * ```js
- * console.log(colors.bgyellow('some string'));
- * ```
- *
- * @param {string} message String to wrap with ansi codes.
- * @return {string} Wrapped string
- * @api public
- * @name bgyellow
- */
- exports.bgyellow = function bgyellow(message) {
- return wrap(43, 49, message);
- };
- /**
- * Wrap a string with ansi codes to create black text.
- *
- * ```js
- * console.log(colors.black('some string'));
- * ```
- *
- * @param {string} message String to wrap with ansi codes.
- * @return {string} Wrapped string
- * @api public
- * @name black
- */
- exports.black = function black(message) {
- return wrap(30, 39, message);
- };
- /**
- * Wrap a string with ansi codes to create blue text.
- *
- * ```js
- * console.log(colors.blue('some string'));
- * ```
- *
- * @param {string} message String to wrap with ansi codes.
- * @return {string} Wrapped string
- * @api public
- * @name blue
- */
- exports.blue = function blue(message) {
- return wrap(34, 39, message);
- };
- /**
- * Wrap a string with ansi codes to create bold text.
- *
- * ```js
- * console.log(colors.bold('some string'));
- * ```
- *
- * @param {string} message String to wrap with ansi codes.
- * @return {string} Wrapped string
- * @api public
- * @name bold
- */
- exports.bold = function bold(message) {
- return wrap(1, 22, message);
- };
- /**
- * Wrap a string with ansi codes to create cyan text.
- *
- * ```js
- * console.log(colors.cyan('some string'));
- * ```
- *
- * @param {string} message String to wrap with ansi codes.
- * @return {string} Wrapped string
- * @api public
- * @name cyan
- */
- exports.cyan = function cyan(message) {
- return wrap(36, 39, message);
- };
- /**
- * Wrap a string with ansi codes to create dim text.
- *
- * ```js
- * console.log(colors.dim('some string'));
- * ```
- *
- * @param {string} message String to wrap with ansi codes.
- * @return {string} Wrapped string
- * @api public
- * @name dim
- */
- exports.dim = function dim(message) {
- return wrap(2, 22, message);
- };
- /**
- * Wrap a string with ansi codes to create gray text.
- *
- * ```js
- * console.log(colors.gray('some string'));
- * ```
- *
- * @param {string} message String to wrap with ansi codes.
- * @return {string} Wrapped string
- * @api public
- * @name gray
- */
- exports.gray = function gray(message) {
- return wrap(90, 39, message);
- };
- /**
- * Wrap a string with ansi codes to create green text.
- *
- * ```js
- * console.log(colors.green('some string'));
- * ```
- *
- * @param {string} message String to wrap with ansi codes.
- * @return {string} Wrapped string
- * @api public
- * @name green
- */
- exports.green = function green(message) {
- return wrap(32, 39, message);
- };
- /**
- * Wrap a string with ansi codes to create grey text.
- *
- * ```js
- * console.log(colors.grey('some string'));
- * ```
- *
- * @param {string} message String to wrap with ansi codes.
- * @return {string} Wrapped string
- * @api public
- * @name grey
- */
- exports.grey = function grey(message) {
- return wrap(90, 39, message);
- };
- /**
- * Wrap a string with ansi codes to create hidden text.
- *
- * ```js
- * console.log(colors.hidden('some string'));
- * ```
- *
- * @param {string} message String to wrap with ansi codes.
- * @return {string} Wrapped string
- * @api public
- * @name hidden
- */
- exports.hidden = function hidden(message) {
- return wrap(8, 28, message);
- };
- /**
- * Wrap a string with ansi codes to create inverse text.
- *
- * ```js
- * console.log(colors.inverse('some string'));
- * ```
- *
- * @param {string} message String to wrap with ansi codes.
- * @return {string} Wrapped string
- * @api public
- * @name inverse
- */
- exports.inverse = function inverse(message) {
- return wrap(7, 27, message);
- };
- /**
- * Wrap a string with ansi codes to create italic text.
- *
- * ```js
- * console.log(colors.italic('some string'));
- * ```
- *
- * @param {string} message String to wrap with ansi codes.
- * @return {string} Wrapped string
- * @api public
- * @name italic
- */
- exports.italic = function italic(message) {
- return wrap(3, 23, message);
- };
- /**
- * Wrap a string with ansi codes to create magenta text.
- *
- * ```js
- * console.log(colors.magenta('some string'));
- * ```
- *
- * @param {string} message String to wrap with ansi codes.
- * @return {string} Wrapped string
- * @api public
- * @name magenta
- */
- exports.magenta = function magenta(message) {
- return wrap(35, 39, message);
- };
- /**
- * Wrap a string with ansi codes to create red text.
- *
- * ```js
- * console.log(colors.red('some string'));
- * ```
- *
- * @param {string} message String to wrap with ansi codes.
- * @return {string} Wrapped string
- * @api public
- * @name red
- */
- exports.red = function red(message) {
- return wrap(31, 39, message);
- };
- /**
- * Wrap a string with ansi codes to reset ansi colors currently on the string.
- *
- * ```js
- * console.log(colors.reset('some string'));
- * ```
- *
- * @param {string} message String to wrap with ansi codes.
- * @return {string} Wrapped string
- * @api public
- * @name reset
- */
- exports.reset = function reset(message) {
- return wrap(0, 0, message);
- };
- /**
- * Wrap a string with ansi codes to add a strikethrough to the text.
- *
- * ```js
- * console.log(colors.strikethrough('some string'));
- * ```
- *
- * @param {string} message String to wrap with ansi codes.
- * @return {string} Wrapped string
- * @api public
- * @name strikethrough
- */
- exports.strikethrough = function strikethrough(message) {
- return wrap(9, 29, message);
- };
- /**
- * Wrap a string with ansi codes to underline the text.
- *
- * ```js
- * console.log(colors.underline('some string'));
- * ```
- *
- * @param {string} message String to wrap with ansi codes.
- * @return {string} Wrapped string
- * @api public
- * @name underline
- */
- exports.underline = function underline(message) {
- return wrap(4, 24, message);
- };
- /**
- * Wrap a string with ansi codes to create white text.
- *
- * ```js
- * console.log(colors.white('some string'));
- * ```
- *
- * @param {string} message String to wrap with ansi codes.
- * @return {string} Wrapped string
- * @api public
- * @name white
- */
- exports.white = function white(message) {
- return wrap(37, 39, message);
- };
- /**
- * Wrap a string with ansi codes to create yellow text.
- *
- * ```js
- * console.log(colors.yellow('some string'));
- * ```
- *
- * @param {string} message String to wrap with ansi codes.
- * @return {string} Wrapped string
- * @api public
- * @name yellow
- */
- exports.yellow = function yellow(message) {
- return wrap(33, 39, message);
- };
|