Skip to content

Commit

Permalink
Display information instead of stack traces if the user didn't enter …
Browse files Browse the repository at this point in the history
…a valid color.

closes ryanzec#1
  • Loading branch information
jantimon committed May 10, 2016
1 parent 0bb5ec7 commit d2304dd
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,14 @@
var oneColor = require('onecolor');
var chalk = require('chalk');
var ntc = require('./ntc');
var color = oneColor(process.argv[2]);

if (!process.argv[2]) {
console.log('Usage: name-that-color "#C0FFEE"');
} else if (color === false) {
console.log('"' + process.argv[2] + '" is not a valid color.');
} else {
console.log(chalk.magenta(process.argv[2]) + ' name is ' + chalk.cyan(ntc.name(oneColor(process.argv[2]).hex())[1]));
}


console.log(chalk.magenta(process.argv[2]) + ' name is ' + chalk.cyan(ntc.name(oneColor(process.argv[2]).hex())[1]));

0 comments on commit d2304dd

Please sign in to comment.