Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable unibody when multi tabs is exist #51

Closed
wants to merge 3 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down Expand Up @@ -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];
}
Expand All @@ -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('')];
}

Expand All @@ -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 : '';
Expand Down