diff --git a/index.js b/index.js index 970231d..24f6f0b 100644 --- a/index.js +++ b/index.js @@ -21,6 +21,7 @@ function getUserOptions(configObj) { if (Array.isArray(configObj.pokemon)) { return configObj.pokemon[Math.floor(Math.random() * configObj.pokemon.length)]; } + return configObj.pokemon || 'pikachu'; }, get poketab() { @@ -52,14 +53,17 @@ function getThemeColors(theme) { if (name === 'random') { return getRandomTheme(themes.pokemon); } + if (Object.prototype.hasOwnProperty.call(themes, name)) { // Choose a random theme from the given category -- i.e. `fire` return getRandomTheme(themes[name]); } + if (Object.prototype.hasOwnProperty.call(themes.pokemon, name)) { // Return the requested pokemon theme -- i.e. `lapras` return [name, themes.pokemon[name]]; } + // Got non-existent theme name thus resolve to default return ['pikachu', themes.pokemon.pikachu]; } @@ -71,6 +75,7 @@ function getMediaPaths(theme) { if (process.platform === 'win32') { return [imagePath, gifPath].map(item => item.join('').replace(/\\/g, '/')); } + return [imagePath.join(''), gifPath.join('')]; } @@ -87,10 +92,16 @@ exports.decorateConfig = config => { const transparent = color(secondary).alpha(0).string(); const header = color(background).isDark() ? '#FAFAFA' : '#010101'; const isSecondaryDark = color(secondary).isDark(); - const activeTab = isSecondaryDark ? '#FAFAFA' : '#383A42'; + const activeTab = (() => { + if (options.unibody) { + return background; + } + + return isSecondaryDark ? '#FAFAFA' : '#383A42'; + })(); const highlight = isSecondaryDark ? '#FFFFFF' : '#000000'; const secondHighlight = isSecondaryDark ? '#C7C7C7' : '#686868'; - const tab = color(activeTab).darken(0.1); + const tab = unibody ? activeTab : color(activeTab).darken(0.1); // Set poketab const tabContent = options.poketab ? gifPath : '';