Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
David Ralph committed Sep 22, 2021
1 parent 9b0a4c2 commit c67cf54
Show file tree
Hide file tree
Showing 12 changed files with 444 additions and 442 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ node_modules/

# Files
yarn.lock
package-lock.json
package-lock.json
2 changes: 1 addition & 1 deletion .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ example/
src/

# Files
tsconfig.json
tsconfig.json
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2019-2021 David Ralph (ohlookitsderpy)
Copyright (c) 2019-2021 David Ralph

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
11 changes: 1 addition & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,4 @@ Simple ANSI styling for your terminal
* Set alias for colours and styles with leeks.alias()

## Usage
See the [documentation](https://docs.davidjcralph.co.uk/#/leeks) and [example](https://github.com/davidjcralph/leeks.js/blob/main/example/test.js)

## Credits
[ansicolors](https://github.com/thlorenz/ansicolors), [ansistyles](https://github.com/thlorenz/ansistyles), [W3C](https://www.w3.org/TR/2018/REC-css-color-3-20180619/) and [Stack Overflow](https://stackoverflow.com/a/33206814) - Reference

[colorette](https://github.com/jorgebucaran/colorette) - Colour support checking code

[Stack Overflow](https://stackoverflow.com/questions/5623838/rgb-to-hex-and-hex-to-rgb) - Hex support

and all the contributors!
See the [documentation](https://docs.davidcralph.co.uk/#/leeks) and [example](example/test.js)
2 changes: 1 addition & 1 deletion example/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@ console.log(error('test'));
console.log(leeks.colours.blue`hello there`);

leeks.alias('primary', 'colours', leeks.colours.green);
console.log(leeks.colours.primary('hi'));
console.log(leeks.colours.primary('hi'));
252 changes: 126 additions & 126 deletions index.d.ts
Original file line number Diff line number Diff line change
@@ -1,127 +1,127 @@
declare module 'leeks.js' {
type Styles = 'reset' | 'bold' | 'dim' | 'italic' | 'underline' | 'overline' | 'blink' | 'inverse' | 'strikethrough' | 'nostrikethrough' | 'nounderline' | 'nooverline' | 'noblink' | 'noinverse';
type Colors = 'black' | 'red' | 'green' | 'yellow' | 'blue' | 'magenta' | 'cyan' | 'white' | 'gray' | 'grey' |
'blackBright' | 'redBright' | 'yellowBright' | 'blueBright' | 'magentaBright' | 'cyanBright' | 'whiteBright' | 'greenBright' |
'bgBlack' | 'bgRed' | 'bgGreen' | 'bgYellow' | 'bgBlue' | 'bgMagenta' | 'bgCyan' | 'bgWhite' |
'bgBlackBright' | 'bgRedBright' | 'bgGreenBright' | 'bgBlueBright' | 'bgMagentaBright' | 'bgCyanBright' | 'bgWhiteBright' | 'bgYellowBright' |
'bgGray' | 'bgGrey';

type Keywords = 'black' | 'silver' | 'gray' | 'white' | 'maroon' | 'red' | 'purple' | 'fuchsia' | 'green' | 'lime' | 'olive' |
'yellow' | 'navy' | 'blue' | 'teal' | 'aqua' | 'aliceblue' | 'antiquewhite' | 'aquamarine' | 'azure' | 'beige' | 'bisque' | 'blanchedalmond' | 'blueviolet' | 'brown' | 'burlywood' | 'cadetblue' |
'chartreuse' | 'chocolate' | 'coral' | 'cornflowerblue' | 'cornsilk' | 'crimson' | 'cyan' | 'darkblue' | 'darkcyan' | 'darkgoldenrod' | 'darkgray' | 'darkgreen' | 'darkgrey' | 'darkkhaki' |
'darkmagenta' | 'darkolivegreen' | 'darkorange' | 'darkorchid' | 'darkred' | 'darksalmon' | 'darkseagreen' | 'darkslateblue' | 'darkslategray' | 'darkslategrey' | 'darkturquoise' | 'darkviolet' |
'deeppink' | 'deepskyblue' | 'dimgray' | 'dimgrey' | 'dodgerblue' | 'firebrick' | 'floralwhite' | 'forestgreen' | 'gainsboro' | 'ghostwhite' | 'gold' | 'goldenrod' | 'greenyellow' | 'grey' | 'honeydew' |
'hotpink' | 'indianred' | 'indigo' | 'ivory' | 'khaki' | 'lavender' | 'lavenderblush' | 'lawngreen' | 'lemonchiffon' | 'lightblue' | 'lightcoral' | 'lightcyan' | 'lightgoldenrodyellow' | 'lightgray' | 'lightgreen' |
'lightgrey' | 'lightpink' | 'lightsalmon' | 'lightseagreen' | 'lightskyblue' | 'lightslategray' | 'lightslategrey' | 'lightsteelblue' | 'lightyellow' | 'limegreen' | 'linen' | 'magenta' | 'mediumaquamarine' | 'mediumblue' |
'mediumorchid' | 'mediumpurple' | 'mediumseagreen' | 'mediumslateblue' | 'mediumspringgreen' | 'mediumturquoise' | 'mediumvioletred' | 'midnightblue' | 'mintcream' | 'mistyrose' | 'moccasin' | 'navajowhite' | 'oldlace' |
'olivedrab' | 'orange' | 'orangered' | 'orchid' | 'palegoldenrod' | 'palegreen' | 'paleturquoise' | 'palevioletred' | 'papayawhip' | 'peachpuff' | 'peru' | 'pink' | 'plum' | 'powderblue' | 'rosybrown' | 'royalblue' |
'saddlebrown' | 'salmon' | 'sandybrown' | 'seagreen' | 'seashell' | 'sienna' | 'skyblue' | 'slateblue' | 'slategray' | 'slategrey' | 'snow' | 'springgreen' | 'steelblue' | 'tan' | 'thistle' | 'tomato' | 'turquoise' |
'violet' | 'wheat' | 'whitesmoke' | 'yellowgreen';

/** Alias for `colours` */
export const colors: {
[x in Colors]: (t: string) => string;
};

/**
* Change the colour of the given text (List: https://docs.davidjcralph.co.uk/#/leeks)
* @param {string} t The text to change the colour of
*/
export const colours: {
[x in Colors]: (t: string) => string
};

/**
* Change the style of the given text (List: https://docs.davidjcralph.co.uk/#/leeks)
* @param {string} t The text to change the style of
*/
export const styles: {
[x in Styles]: (t: string) => string
};

/**
* Change the colour of the given text (List: https://docs.davidjcralph.co.uk/#/leeks)
* @param {string} t The text to change the colour of
*/
export const keywords: {
[x in Keywords]: (t: string) => string
};

/**
* Change the background colour of the given text (List: https://docs.davidjcralph.co.uk/#/leeks)
* @param {string} t The text to change the colour of
*/
export const bgKeywords: {
[x in Keywords]: (t: string) => string
};

/** Alias for `supportsColour` */
export const supportsColor: boolean;

/** Check if colours are supported (From https://github.com/jorgebucaran/colorette) (returns false on all browsers) */
export const supportsColour: boolean;

/**
* Change the background colour of the given text using 8-bit colours
* @param i The 8-bit colour to use
* @param t The text to show with the 8-bit colour
*/
export const eightBit: (i: string, t: string) => string;

/**
* Change the background colour of the given text using 8-bit colours
* @param i The 8-bit colour to use
* @param t The text to show with the 8-bit colour
*/
export const eightBitBg: (i: string, t: string) => string;

/**
* Change the colour of the given text using RGB
* @param rgb An array of the RGB to use
* @param t The text to show with the RGB color
*/
export const rgb: (rgb: [number, number, number], t: string) => string;

/**
* Change the background colour of the given text using RGB
* @param rgb An array of the RGB to use
* @param t The text to show with the RGB colour
*/
export const rgbBg: (rgb: [number, number, number], t: string) => string;

/**
* Change the colour of the given text using hexadecimals
* @param {string} hex The hex to use
* @param {string} t The text to show with the hexadecimal colour
* @credit [Stack Overflow](https://stackoverflow.com/q/5623838)
*/
export const hex: (hex: string, t: string) => string;

/**
* Change the background colour of the given text using hexadecimals
* @param {string} hex The hex to use
* @param {string} t The text to show with the hexadecimal colour
* @credit [Stack Overflow](https://stackoverflow.com/q/5623838)
*/
export const hexBg: (hex: string, t: string) => string;

/**
* Set an alias
* @param {string} name The name of the alias
* @param {string} type Either "colours", "colors" or "styles"
* @param {string} value The colour/style you want to use, e.g leeks.colours.green
*/
export type alias = () => void;

/** Enable colour support for leeks.js */
export type enableColours = () => void;

/** Alias for `enableColours` */
export type enableColors = () => void;

/** Disable colour support for leeks.js */
export type disableColours = () => void;

/** Alias for `disabeColours` */
export type disableColors = () => void;
}
type Styles = 'reset' | 'bold' | 'dim' | 'italic' | 'underline' | 'overline' | 'blink' | 'inverse' | 'strikethrough' | 'nostrikethrough' | 'nounderline' | 'nooverline' | 'noblink' | 'noinverse';
type Colors = 'black' | 'red' | 'green' | 'yellow' | 'blue' | 'magenta' | 'cyan' | 'white' | 'gray' | 'grey' |
'blackBright' | 'redBright' | 'yellowBright' | 'blueBright' | 'magentaBright' | 'cyanBright' | 'whiteBright' | 'greenBright' |
'bgBlack' | 'bgRed' | 'bgGreen' | 'bgYellow' | 'bgBlue' | 'bgMagenta' | 'bgCyan' | 'bgWhite' |
'bgBlackBright' | 'bgRedBright' | 'bgGreenBright' | 'bgBlueBright' | 'bgMagentaBright' | 'bgCyanBright' | 'bgWhiteBright' | 'bgYellowBright' |
'bgGray' | 'bgGrey';

type Keywords = 'black' | 'silver' | 'gray' | 'white' | 'maroon' | 'red' | 'purple' | 'fuchsia' | 'green' | 'lime' | 'olive' |
'yellow' | 'navy' | 'blue' | 'teal' | 'aqua' | 'aliceblue' | 'antiquewhite' | 'aquamarine' | 'azure' | 'beige' | 'bisque' | 'blanchedalmond' | 'blueviolet' | 'brown' | 'burlywood' | 'cadetblue' |
'chartreuse' | 'chocolate' | 'coral' | 'cornflowerblue' | 'cornsilk' | 'crimson' | 'cyan' | 'darkblue' | 'darkcyan' | 'darkgoldenrod' | 'darkgray' | 'darkgreen' | 'darkgrey' | 'darkkhaki' |
'darkmagenta' | 'darkolivegreen' | 'darkorange' | 'darkorchid' | 'darkred' | 'darksalmon' | 'darkseagreen' | 'darkslateblue' | 'darkslategray' | 'darkslategrey' | 'darkturquoise' | 'darkviolet' |
'deeppink' | 'deepskyblue' | 'dimgray' | 'dimgrey' | 'dodgerblue' | 'firebrick' | 'floralwhite' | 'forestgreen' | 'gainsboro' | 'ghostwhite' | 'gold' | 'goldenrod' | 'greenyellow' | 'grey' | 'honeydew' |
'hotpink' | 'indianred' | 'indigo' | 'ivory' | 'khaki' | 'lavender' | 'lavenderblush' | 'lawngreen' | 'lemonchiffon' | 'lightblue' | 'lightcoral' | 'lightcyan' | 'lightgoldenrodyellow' | 'lightgray' | 'lightgreen' |
'lightgrey' | 'lightpink' | 'lightsalmon' | 'lightseagreen' | 'lightskyblue' | 'lightslategray' | 'lightslategrey' | 'lightsteelblue' | 'lightyellow' | 'limegreen' | 'linen' | 'magenta' | 'mediumaquamarine' | 'mediumblue' |
'mediumorchid' | 'mediumpurple' | 'mediumseagreen' | 'mediumslateblue' | 'mediumspringgreen' | 'mediumturquoise' | 'mediumvioletred' | 'midnightblue' | 'mintcream' | 'mistyrose' | 'moccasin' | 'navajowhite' | 'oldlace' |
'olivedrab' | 'orange' | 'orangered' | 'orchid' | 'palegoldenrod' | 'palegreen' | 'paleturquoise' | 'palevioletred' | 'papayawhip' | 'peachpuff' | 'peru' | 'pink' | 'plum' | 'powderblue' | 'rosybrown' | 'royalblue' |
'saddlebrown' | 'salmon' | 'sandybrown' | 'seagreen' | 'seashell' | 'sienna' | 'skyblue' | 'slateblue' | 'slategray' | 'slategrey' | 'snow' | 'springgreen' | 'steelblue' | 'tan' | 'thistle' | 'tomato' | 'turquoise' |
'violet' | 'wheat' | 'whitesmoke' | 'yellowgreen';

/** Alias for `colours` */
export const colors: {
[x in Colors]: (t: string) => string;
};

/**
* Change the colour of the given text (List: https://docs.davidcralph.co.uk/#/leeks)
* @param {string} t The text to change the colour of
*/
export const colours: {
[x in Colors]: (t: string) => string
};

/**
* Change the style of the given text (List: https://docs.davidcralph.co.uk/#/leeks)
* @param {string} t The text to change the style of
*/
export const styles: {
[x in Styles]: (t: string) => string
};

/**
* Change the colour of the given text (List: https://docs.davidcralph.co.uk/#/leeks)
* @param {string} t The text to change the colour of
*/
export const keywords: {
[x in Keywords]: (t: string) => string
};

/**
* Change the background colour of the given text (List: https://docs.davidcralph.co.uk/#/leeks)
* @param {string} t The text to change the colour of
*/
export const bgKeywords: {
[x in Keywords]: (t: string) => string
};

/** Alias for `supportsColour` */
export const supportsColor: boolean;

/** Check if colours are supported (From https://github.com/jorgebucaran/colorette) (returns false on all browsers) */
export const supportsColour: boolean;

/**
* Change the background colour of the given text using 8-bit colours
* @param i The 8-bit colour to use
* @param t The text to show with the 8-bit colour
*/
export const eightBit: (i: string, t: string) => string;

/**
* Change the background colour of the given text using 8-bit colours
* @param i The 8-bit colour to use
* @param t The text to show with the 8-bit colour
*/
export const eightBitBg: (i: string, t: string) => string;

/**
* Change the colour of the given text using RGB
* @param rgb An array of the RGB to use
* @param t The text to show with the RGB color
*/
export const rgb: (rgb: [number, number, number], t: string) => string;

/**
* Change the background colour of the given text using RGB
* @param rgb An array of the RGB to use
* @param t The text to show with the RGB colour
*/
export const rgbBg: (rgb: [number, number, number], t: string) => string;

/**
* Change the colour of the given text using hexadecimals
* @param {string} hex The hex to use
* @param {string} t The text to show with the hexadecimal colour
* @credit [Stack Overflow](https://stackoverflow.com/q/5623838)
*/
export const hex: (hex: string, t: string) => string;

/**
* Change the background colour of the given text using hexadecimals
* @param {string} hex The hex to use
* @param {string} t The text to show with the hexadecimal colour
* @credit [Stack Overflow](https://stackoverflow.com/q/5623838)
*/
export const hexBg: (hex: string, t: string) => string;

/**
* Set an alias
* @param {string} name The name of the alias
* @param {string} type Either "colours", "colors" or "styles"
* @param {string} value The colour/style you want to use, e.g leeks.colours.green
*/
export type alias = () => void;

/** Enable colour support for leeks.js */
export type enableColours = () => void;

/** Alias for `enableColours` */
export type enableColors = () => void;

/** Disable colour support for leeks.js */
export type disableColours = () => void;

/** Alias for `disabeColours` */
export type disableColors = () => void;
};
64 changes: 32 additions & 32 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,34 +1,34 @@
{
"name": "leeks.js",
"version": "0.2.2",
"description": "Simple ANSI styling for your terminal",
"author": "David Ralph",
"license": "MIT",
"main": "dist/index.js",
"types": "index.d.ts",
"bugs": {
"url": "https://github.com/davidcralph/leeks.js/issues"
},
"homepage": "https://leeks.js.org",
"repository": {
"type": "git",
"url": "https://github.com/davidcralph/leeks.js"
},
"keywords": [
"color",
"colour",
"colors",
"colours",
"ansi",
"style",
"styles",
"terminal",
"console",
"lightweight",
"rgb",
"256"
],
"devDependencies": {
"@types/node": "^16.0.0"
}
"name": "leeks.js",
"version": "0.2.2",
"description": "Simple ANSI styling for your terminal",
"author": "David Ralph",
"license": "MIT",
"main": "dist/index.js",
"types": "index.d.ts",
"bugs": {
"url": "https://github.com/davidcralph/leeks.js/issues"
},
"homepage": "https://leeks.js.org",
"repository": {
"type": "git",
"url": "https://github.com/davidcralph/leeks.js"
},
"keywords": [
"color",
"colour",
"colors",
"colours",
"ansi",
"style",
"styles",
"terminal",
"console",
"lightweight",
"rgb",
"256"
],
"devDependencies": {
"@types/node": "^16.9.6"
}
}
Loading

0 comments on commit c67cf54

Please sign in to comment.