Skip to content

Commit

Permalink
Fix the color wrap function
Browse files Browse the repository at this point in the history
  • Loading branch information
cattode committed Sep 3, 2013
1 parent 6108735 commit 58580f4
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lib/colors.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,11 @@ codes = {
exports.codes = codes;

function wrap(color, text, reset_color) {
reset_color = typeof(a) != 'undefined' ? a : 'reset';
return codes[color] + text + codes[reset_color];
if(codes[color]) {
text = codes[color] + text;
text += (codes[reset_color]) ? codes[reset_color] : codes['reset'];
}
return text;
};
exports.wrap = wrap;

0 comments on commit 58580f4

Please sign in to comment.