eight-colors
Advanced tools
Comparing version 1.1.0 to 1.1.1
/** | ||
* Eight Colors | ||
*/ | ||
export function black(str: string): string; | ||
export function red(str: string): string; | ||
export function green(str: string): string; | ||
export function yellow(str: string): string; | ||
export function blue(str: string): string; | ||
export function magenta(str: string): string; | ||
export function cyan(str: string): string; | ||
export function white(str: string): string; | ||
export type bg = { | ||
export type ColorHandler = (str: string) => string | ||
export const black: ColorHandler; | ||
export const red: ColorHandler; | ||
export const green: ColorHandler; | ||
export const yellow: ColorHandler; | ||
export const blue: ColorHandler; | ||
export const magenta: ColorHandler; | ||
export const cyan: ColorHandler; | ||
export const white: ColorHandler; | ||
type BG = { | ||
black, | ||
@@ -24,3 +27,5 @@ red, | ||
export type br = { | ||
export const bg: BG; | ||
type BR = { | ||
black, | ||
@@ -35,16 +40,18 @@ red, | ||
bg | ||
bg: BG | ||
} | ||
export function reset(str: string): string; | ||
export function bold(str: string): string; | ||
export function faint(str: string): string; | ||
export function italic(str: string): string; | ||
export function underline(str: string): string; | ||
export function inverse(str: string): string; | ||
export function hidden(str: string): string; | ||
export function strike(str: string): string; | ||
export const br: BR; | ||
export const reset: ColorHandler; | ||
export const bold: ColorHandler; | ||
export const faint: ColorHandler; | ||
export const italic: ColorHandler; | ||
export const underline: ColorHandler; | ||
export const inverse: ColorHandler; | ||
export const hidden: ColorHandler; | ||
export const strike: ColorHandler; | ||
// remove color | ||
export function remove(str: string): string; | ||
export const remove: ColorHandler; | ||
@@ -57,47 +64,11 @@ // console log | ||
export function logBlack(...args: string[]): string; | ||
export function logRed(...args: string[]): string; | ||
export function logGreen(...args: string[]): string; | ||
export function logYellow(...args: string[]): string; | ||
export function logBlue(...args: string[]): string; | ||
export function logMagenta(...args: string[]): string; | ||
export function logCyan(...args: string[]): string; | ||
export function logWhite(...args: string[]): string; | ||
export type ColorLogHandler = (...args: string[]) => string; | ||
export type EC = { | ||
black, | ||
red, | ||
green, | ||
yellow, | ||
blue, | ||
magenta, | ||
cyan, | ||
white, | ||
bg, | ||
br, | ||
reset, | ||
bold, | ||
faint, | ||
italic, | ||
underline, | ||
inverse, | ||
hidden, | ||
strike, | ||
remove, | ||
log, | ||
logBlack, | ||
logRed, | ||
logGreen, | ||
logYellow, | ||
logBlue, | ||
logMagenta, | ||
logCyan, | ||
logWhite | ||
} | ||
export default EC; | ||
export const logBlack: ColorLogHandler; | ||
export const logRed: ColorLogHandler; | ||
export const logGreen: ColorLogHandler; | ||
export const logYellow: ColorLogHandler; | ||
export const logBlue: ColorLogHandler; | ||
export const logMagenta: ColorLogHandler; | ||
export const logCyan: ColorLogHandler; | ||
export const logWhite: ColorLogHandler; |
{ | ||
"name": "eight-colors", | ||
"version": "1.1.0", | ||
"version": "1.1.1", | ||
"description": "Eight colors for the console", | ||
@@ -20,3 +20,4 @@ "main": "./lib/index.js", | ||
"scripts": { | ||
"test": "node ./scripts/test.js", | ||
"test": "npm run link && node ./scripts/test.cjs && node ./scripts/test.mjs", | ||
"link": "sf link ./ -f", | ||
"build": "sf lint && sf b -p", | ||
@@ -23,0 +24,0 @@ "patch": "npm run build && sf publish patch -r" |
129
README.md
@@ -22,21 +22,2 @@ # Eight Colors | ||
// check out all APIs | ||
console.log(EC); | ||
// print all APIs | ||
const print = (parent, ls) => { | ||
if (typeof parent === 'function') { | ||
console.log(`${ls.join('.')}(String)`); | ||
return; | ||
} | ||
for (const k in parent) { | ||
print(parent[k], ls.concat(k)); | ||
} | ||
}; | ||
print(EC, ['EC']); | ||
// text color | ||
@@ -78,67 +59,66 @@ console.log(EC.red('red string')); | ||
EC.logMagenta('logMagenta 3 arguments', '2', '3'); | ||
EC.logColor('logColor 2 arguments with color', '2', 'red'); | ||
EC.logColor('logColor 2 arguments without color', '2'); | ||
``` | ||
![](/scripts/screenshots.png) | ||
## All APIs | ||
## APIs | ||
```js | ||
EC.black(String) | ||
EC.red(String) | ||
EC.green(String) | ||
EC.yellow(String) | ||
EC.blue(String) | ||
EC.magenta(String) | ||
EC.cyan(String) | ||
EC.white(String) | ||
EC.black(str) | ||
EC.red(str) | ||
EC.green(str) | ||
EC.yellow(str) | ||
EC.blue(str) | ||
EC.magenta(str) | ||
EC.cyan(str) | ||
EC.white(str) | ||
EC.bg.black(String) | ||
EC.bg.red(String) | ||
EC.bg.green(String) | ||
EC.bg.yellow(String) | ||
EC.bg.blue(String) | ||
EC.bg.magenta(String) | ||
EC.bg.cyan(String) | ||
EC.bg.white(String) | ||
EC.bg.black(str) | ||
EC.bg.red(str) | ||
EC.bg.green(str) | ||
EC.bg.yellow(str) | ||
EC.bg.blue(str) | ||
EC.bg.magenta(str) | ||
EC.bg.cyan(str) | ||
EC.bg.white(str) | ||
EC.br.black(String) | ||
EC.br.red(String) | ||
EC.br.green(String) | ||
EC.br.yellow(String) | ||
EC.br.blue(String) | ||
EC.br.magenta(String) | ||
EC.br.cyan(String) | ||
EC.br.white(String) | ||
EC.br.black(str) | ||
EC.br.red(str) | ||
EC.br.green(str) | ||
EC.br.yellow(str) | ||
EC.br.blue(str) | ||
EC.br.magenta(str) | ||
EC.br.cyan(str) | ||
EC.br.white(str) | ||
EC.br.bg.black(String) | ||
EC.br.bg.red(String) | ||
EC.br.bg.green(String) | ||
EC.br.bg.yellow(String) | ||
EC.br.bg.blue(String) | ||
EC.br.bg.magenta(String) | ||
EC.br.bg.cyan(String) | ||
EC.br.bg.white(String) | ||
EC.br.bg.black(str) | ||
EC.br.bg.red(str) | ||
EC.br.bg.green(str) | ||
EC.br.bg.yellow(str) | ||
EC.br.bg.blue(str) | ||
EC.br.bg.magenta(str) | ||
EC.br.bg.cyan(str) | ||
EC.br.bg.white(str) | ||
EC.reset(String) | ||
EC.bold(String) | ||
EC.faint(String) | ||
EC.italic(String) | ||
EC.underline(String) | ||
EC.inverse(String) | ||
EC.hidden(String) | ||
EC.strike(String) | ||
EC.reset(str) | ||
EC.bold(str) | ||
EC.faint(str) | ||
EC.italic(str) | ||
EC.underline(str) | ||
EC.inverse(str) | ||
EC.hidden(str) | ||
EC.strike(str) | ||
EC.remove(String) | ||
EC.remove(str) | ||
EC.log(String) | ||
EC.logColor(String, ColorName) | ||
EC.log(str) | ||
EC.logColor(str, ColorName) | ||
EC.logBlack(String) | ||
EC.logRed(String) | ||
EC.logGreen(String) | ||
EC.logYellow(String) | ||
EC.logBlue(String) | ||
EC.logMagenta(String) | ||
EC.logCyan(String) | ||
EC.logWhite(String) | ||
EC.logBlack(str) | ||
EC.logRed(str) | ||
EC.logGreen(str) | ||
EC.logYellow(str) | ||
EC.logBlue(str) | ||
EC.logMagenta(str) | ||
EC.logCyan(str) | ||
EC.logWhite(str) | ||
``` | ||
@@ -165,2 +145,5 @@ | ||
* 1.1.1 | ||
- fixed types | ||
* 1.1.0 | ||
@@ -167,0 +150,0 @@ - added types |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
10644
150
158