Skip to content

Commit

Permalink
improve favicon inversion (Croydon#114)
Browse files Browse the repository at this point in the history
  • Loading branch information
makoto-motohashi committed Feb 15, 2019
1 parent 7f8d4d3 commit 29a0789
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 11 deletions.
3 changes: 1 addition & 2 deletions lib/fast-average-color-4.2.0.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 13 additions & 9 deletions sidebar.js
Original file line number Diff line number Diff line change
Expand Up @@ -365,19 +365,23 @@ let VerticalTabsReloaded = class VerticalTabsReloaded
const fac = new FastAverageColor();
fac.getColorAsync(imgEl, (color) =>
{
if(color.isDark)
if(!color.error)
{
imgEl.classList.remove("tab-icon-image-light");
imgEl.classList.add("tab-icon-image-dark");
}
else
{
imgEl.classList.remove("tab-icon-image-dark");
imgEl.classList.add("tab-icon-image-light");
// if(color.isDark)
if(color.value[0] <= 80 && color.value[1] <= 80 && color.value[2] <= 80)
{
imgEl.classList.remove("tab-icon-image-light");
imgEl.classList.add("tab-icon-image-dark");
}
else
{
imgEl.classList.remove("tab-icon-image-dark");
imgEl.classList.add("tab-icon-image-light");
}
}
log.debug(color);
fac.destroy();
});
}, {mode: "precision"});
}

log.debug("status: " + tabElement.getAttribute("status"));
Expand Down

0 comments on commit 29a0789

Please sign in to comment.