https://github.com/fent/irc-colors.js
Color and formatting for irc bots made easy. Inspired by colors.js and cli-color.
https://github.com/fent/irc-colors.js
colors irc node
Last synced: 3 months ago
JSON representation
Color and formatting for irc bots made easy. Inspired by colors.js and cli-color.
- Host: GitHub
- URL: https://github.com/fent/irc-colors.js
- Owner: fent
- License: mit
- Created: 2011-07-23T16:14:12.000Z (almost 15 years ago)
- Default Branch: master
- Last Pushed: 2020-11-15T08:11:17.000Z (over 5 years ago)
- Last Synced: 2025-04-27T16:49:42.553Z (about 1 year ago)
- Topics: colors, irc, node
- Language: JavaScript
- Homepage:
- Size: 113 KB
- Stars: 35
- Watchers: 3
- Forks: 7
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# irc.colors.js
Easily use colored output and formatting in your irc bots.
[](http://travis-ci.org/fent/irc-colors.js)

[](https://codecov.io/gh/fent/irc-colors.js)
# Usage
```javascript
const c = require('irc-colors');
...
ircbot.say('#chan', c.blue('hello everyone')); // prints blue text
ircbot.say('#chan', c.underline.red('WARNING')); // can be chained
ircbot.say('#chan', c.white.bgblack('inverted')); // white text with black background
warn = c.bold.red.bgyellow;
ircbot.say('#chan', warn('BIGGER WARNING')); // bold red text with yellow background
ircbot.say('#chan', c.rainbow('having fun!'); // prints rainbow colored text
```
### But wait, there's more!
If you don't mind changing the prototype of the String object, then use the global() function.
```javascript
require('irc-colors').global()
...
ircbot.say('#chan', 'say something'.irc.red()); // prints red text
ircbot.say('#chan', 'hi everyone!'.irc.green.bold()); // prints green bold text
ircbot.say('#chan', 'etc etc'.irc.underline.grey.bgblack()) // chains work too
```
Global syntax was inspired by [colors.js](https://github.com/marak/colors.js) and because of that, there's possibility that you might want to use that module along with this one. That's why the *irc* property of a String needs to be called first to use the formatting functions.
## Colors

Original name or alternate can be used, without spaces
bot.say('#chat', c.bluecyan('hi'));
## Styles

## Extras

## Strip
You can also strip out any colors/style from IRC messages.
* `stripColors`
* `stripStyle`
* `stripColorsAndStyle`
```js
const c = require('irc-colors');
ircbot.on('message', (from, message) => {
console.log(c.stripColorsAndStyle(message));
});
```
# Install
npm install irc-colors
# Tests
Tests are written with [vows](http://vowsjs.org/)
```bash
npm test
```