Skip to content

Commit

Permalink
Implemented rainbow display since chalk doesnt do that
Browse files Browse the repository at this point in the history
  • Loading branch information
wesleytodd committed Sep 1, 2013
1 parent b24b9a4 commit ce8f5e8
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 4 deletions.
10 changes: 10 additions & 0 deletions test/art.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
var art = require('../util/art')
assert = require('assert'),
test = require('./lib/runner');

test('It\'s a disco mania!!', function(done) {
console.log(art.go);
done();
});

test.go();
28 changes: 24 additions & 4 deletions util/art.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,25 @@
var chalk = require('chalk');

// Rainbow display
var rainbowColors = [
chalk.red,
chalk.yellow,
chalk.green,
chalk.blue,
chalk.magenta
];
chalk.rainbow = function(str) {
var arStr = str.split(''),
out = '';
for (var i in arStr) {
if (arStr[i] == ' ' || arStr[i] == '\t' || arStr[i] == '\n')
out += arStr[i];
else
out += rainbowColors[i % rainbowColors.length](arStr[i]);
}
return out;
};

module.exports = {
wp : [
'',
Expand Down Expand Up @@ -31,10 +51,10 @@ module.exports = {
chalk.grey(' ..:::.. ..:::..'),
chalk.grey(' ..:::::.. '),
'',
' A Yeoman Generator For WordPress'.red,
chalk.red(' A Yeoman Generator For WordPress'),
''
].join('\n'),
go : [
go : chalk.rainbow([
' ',
' __ __ _______ ______ _______ _ _ _______ _______ _______ __ ',
' | | | || || _ | | | | | _ | || | | || | | |',
Expand All @@ -43,8 +63,8 @@ module.exports = {
' | || ___|| __ || ___| | || ___| | || || |_| | |__|',
' | _ || |___ | | | || |___ | _ || |___ | |_| || | __ ',
' |__| |__||_______||___| |_||_______| |__| |__||_______| |_______||_______| |__|',
' '
].join('\n').rainbow,
''
].join('\n')),
wawa : chalk.red([
'',
'____ __ ____ ___ ____ __ ____ ___ __ __ ',
Expand Down

0 comments on commit ce8f5e8

Please sign in to comment.