diff --git a/colors.js b/colors.js index c3fc81f..083e459 100644 --- a/colors.js +++ b/colors.js @@ -100,19 +100,14 @@ exports.addSequencer('zebra', function (letter, i, exploded) { return i % 2 === 0 ? letter : letter.inverse; }); -exports.setTheme = function (theme, cb) { - if(typeof cb !== 'function') { - cb = function (err, result) { - console.log(err); - }; - } +exports.setTheme = function (theme) { if (typeof theme === 'string') { try { exports.themes[theme] = require(theme); applyTheme(exports.themes[theme]); - cb(null, exports.themes[theme]); + return exports.themes[theme]; } catch (err) { - return cb(err); + return err; } } else { applyTheme(theme); diff --git a/example.js b/example.js index a0d686c..1af7895 100644 --- a/example.js +++ b/example.js @@ -67,11 +67,7 @@ console.log("this is a warning".warn); console.log("this is an input".input); // Load a theme from file -colors.setTheme('./themes/winston-dark.js', function(err){ - if (err) { - return console.log('error loading theme '.error, err) - } - // outputs black text - console.log("this is an input".input); -}); +colors.setTheme('./themes/winston-dark.js'); + +console.log("this is an input".input);