Coder Social home page Coder Social logo

irc-colors.js's Introduction

irc.colors.js Build Status

Easily use colored output and formatting in your irc bots.

Usage

var 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.

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 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

colors

Original name or alternate can be used, without spaces

bot.say('#chat', c.bluecyan('hi'));

Styles

styles

Extras

extras

Strip

You can also strip out any colors/style from IRC messages.

  • stripColors
  • stripStyle
  • stripColorsAndStyle
var c = require('irc-colors');

ircbot.on('message', function(from, message) {
  console.log(c.stripColorsAndStyle(message));
});

Install

npm install irc-colors

Tests

Tests are written with vows

npm test

License

MIT

irc-colors.js's People

Contributors

fent avatar rahatarmanahmed avatar

Watchers

Justin Li avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.