-
Notifications
You must be signed in to change notification settings - Fork 23
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
Option to Follow Site's Header Color #68
Comments
If I recall correctly, the FabTabs addon for Firefox (which used to have the same functionality, pre-Quantum) took screenshot of the top 200px of the page and used the median color (excluding white, black and other boring colors from consideration). That worked pretty well. |
@JanPokorny You have good memory!!! :) I completely forgot about FabTabs!!! Still, if the color does not match "exactly" i'm not sure if it will work... :) |
Easiest way would probably be to group similar colors by hue and just pick the most common one. You want the saturation and brightness of the colored tabs to be normalised anyway, so the text is always readable. |
and would we be able to maintain that "continuity feeling" between firefox toolbars and site's header? |
Thank you both for requesting this feature :) Can you test out this feature on the beta channel before I release it? Go to the VivaldiFox preferences page, then change the "Fallback source". |
For info, it extracts the median color of the 50 top pixels of the page. |
Hi @nt1m It's not exactly how i dreamed about it. My idea (which does not mean it's a good idea or that it is doable) was to provide the idea of "continuity" between browser toolbars and webpage, (reason why i suggested from the top pixel) But in this 2 examples that does not happen: but now that you mentioned the top 50pixels... instead of taking sample from top 50 pixels "vertically", why not the top-center 50 pixels "horizontally"? It's not that it's bad the way it is!!! It's a lot better... i'm just shooting ideas that can (or not) make it even better =) |
@maverick74 I agree that choosing white in the first example isn't ideal -- much better would be choosing the blue color. That's why I proposed ignoring black, white and other boring colors. @nt1m First of all, some bug reports:
Feedback: The new algorithm works really well for some pages (https://ksi.fi.muni.cz/ or https://imgur.com/), but it doesn't look very good with pages with white-ish background -- as there are many of those, they all tend to have the same color. I believe that choosing the accent color of the page instead in those cases will lead to tabs looking more colorful and pretty. I propose discarding colors near white from the median calculation, which will lead to the accent color being chosen instead (e.g. blue here http://www.chriskrycho.com/ and yellow here https://fi.muni.cz/ ). (I remember FabTabs doing something similar to that, maybe discarding all colors with low saturation? Historical screenshot of FabTabs using the accent color instead of background color ) Anyways, thanks for implementing this feature! I'm sure that after some polishing, it will look as good as FabTabs once did. |
@JanPokorny examples: in the case of: in my ideia the tabs/toolbars color should have been the darkblue present on the site's top line |
@maverick74 @JanPokorny Thank you both for testing!
One way to solve this is to use the top 2px or so, to avoid white being the dominant color.
This wouldn't solve the problem you've pointed out unfortunately, since white would still stay dominant.
The algorithm for page icons ignores those colors. For this mode, I've noticed ignoring shades of grey isn't very good for "continuity". For example, YouTube would select red instead of white, which would not make the header background match the chosen color. I agree however that it would make the chosen colors less boring though. I think this is really up to the user's opinion here: for https://www.mojebanka.cz, I would guess @JanPokorny would prefer red as it's more colorful, but @maverick74 would prefer white to make the user interface match the page header background for "continuity". I guess the solution here would be allow configuring this using two separate modes.
This is because the API I use (tabs.captureVisibleTab()) captures screenshots of the scrolled area. There's another
I think this is because I resize down screenshots to have a maximum width of 256 for performance. I'll consider increasing this max-width since it was originally chosen for icons (see issue #39) Thanks for all the feedback! I'll go ahead with two separate modes: one that takes the 2 first pixels of the page, while keeping "boring" colors (continuity) and another mode that takes the 50 first pixels while ignoring "boring" colors (FabTabs style). In case you're interested in checking the algorithm:
|
@nt1m You're right that this is just a matter of preference, whether to prefer the background color or the accent color. (I have noticed that most pages setting the Ad the scrolling issue: the tab color is recomputed on each reload? (Reloading or pressing "back" keeps the scrolled position.) Wouldn't computing (and caching) the color for each domain only during the first load help? (Obligatory "FabTabs did it that way".) I can see some issues with that:
I think that rethinking when the color is computed and when the cached color is used could solve more problems (#63, #64, #65 all seem related) and furthermore it wouldn't matter that much if the color-computing algorithm was a little slower. |
Well, i agree with the proposed solution ;) |
@maverick74 @JanPokorny Alright, I've uploaded beta 2: https://addons.mozilla.org/en-US/firefox/addon/vivaldifox/versions/beta Please let me know how well that works, and what configuration you've picked (I've also added a setting to disable meta tag color extraction). Thanks for the feedback! The mode that ignores boring colors doesn't work as well as I want to (the ideal would be a mix of ignoring and not ignoring), but it now works exactly like FabTabs: it takes the 200px top pixels (works better than 50 when ignoring boring colors), then extracts the median color. As for the "continuity" mode, it works quite well and I am quite satisfied with the result. It seems to work even better when disabling meta tag extraction :) @JanPokorny Caching is very hard to get right in all situations. There's some kind of tab-based caching done atm, and some update filtering done as well (to avoid flashing the color too much), and it doesn't work perfectly as you point out with the other issues. I agree it could be improved to do some smart domain/url caching as well, but too much caching (=memory usage) can slow down the add-on too. |
@nt1m The new accent color choosing algorithm doesn't seem to work. For https://www.mojebanka.cz/, it chooses light pink, https://fi.muni.cz/ gets white (even when disabling the theme-color preference). Even a page with a large red banner got white: https://www.csfd.cz/. I suspect it might be something with the way you resize the screenshot. Also, for the boring-color algorithm, I suggest converting the color representation to HSV and discarding all colors with low saturation (<10%, perhaps) -- this way, white or gray gets discarded even with a slight color tint. |
@nt1m Also, you say that you take the median color. Have you tried taking the most common color instead? (I suggest by converting to HSV and then counting colors by hue in "buckets" 0-10, 10-20... while remembering the average color for each bucket. Then take the average color of the largest bucket.) |
@nt1m when its able to get the color it works like a charm. Right like i dreamed about, however sometimes it can't get the color... no clue why. After a refresh it gets it. Exceptions found: http://www.sapo.pt - http://www.imdb.com - top colors do not match. Any clue why? https://www.space.com/ - https://addons.mozilla.org/en-US/firefox/addon/vivaldifox/ - might worth checking out why it's not working |
@nt1m Just to illustrate my point with low saturation, Facebook uses this color for background, and it gets chosen instead of the dark blue-purple: hsl(216, 13%, 92%). The dark blue-purple is hsl(220, 46%, 48%). I have checked the saturation of many accent colors, and have never seen a saturation lower than 40%. I think that setting the threshold around 30% will work for most of the sites. |
@maverick74 It gets the color as soon as it can, that means the page might not be loaded when the color is extracted, and it ends up taking white. I'm currently blocked on an API that would allow me to do that properly. After that I'll be able to fix the issues @JanPokorny pointed out. Thank you both for testing! |
@nt1m Thank you for your work on this addon! Is there a ticket opened with Mozilla for the API issue? |
@JanPokorny https://bugzilla.mozilla.org/show_bug.cgi?id=1427463 I'm planning to work on the bug, but I'll probably only get to it in 2 weeks. So it will probably land in Firefox around Firefox 59-60. |
@nt1m Hi, i was coming to suggest that GitLab is not well either, but since you already identified the problem there's no need for it anymore :). Thank you so much for your work on this feature. I'll keep an eye on that bug report as well. Where this already works it looks pretty awesome, will be waiting for that fix. Thank you a lot (@nt1m ) again. |
@nt1m i'm sorry for asking, but just out of curiosity, in the bug you mention that "allows matching the header color with the two first pixels of the page". Why do you need the first 2 pixels? |
@maverick74 Whoops, I meant the two top pixel rows of the page. It's already possible at the moment with tabs.captureVisibleTab(), but it doesn't let you wait for the page to load, so it sometimes it captures 2 white rows. |
@nt1m I still don't get it!!! LOLOL |
@maverick74 It doesn't really matter which you take -- taking two full rows just makes the result better on pages with irregular top graphics. |
@nt1m With "accent color" mode, a seemingly random (but page-deterministic) color is assigned to black-and-white pages ( 1, 2, 3 ). Is the random color intentional, or is it just a bug of the color-extraction algorithm? I also noticed that it happens even on pages that aren't completely B&W, like random pages on Wikipedia. (Wikipedia has blue links in the header.) Also, it turns out long PDFs get recolored every time new pages get loaded, so the tab color changes randomly during scrolling on B&W PDFs. Try scrolling around here: https://eloquentjavascript.net/Eloquent_JavaScript.pdf |
@JanPokorny Due to the way Firefox renders text, black text is not always black. If you take a screenshot and zoom in the black-and-white, you'll see the text edges are not exactly black. As for wikipedia, yes, once the algorithm detects a color different than shades of gray (boring colors), it immediately strips out boring colors from the list. The continuity mode is currently the mode that works best. Unfortunately for the accent color mode, it's hard to have a perfect algorithm, sometimes you do want the boring colors (eg. white on Wikipedia), most of the time you don't want them... I'm thinking the page icon might be a better choice if you want non-boring colors. |
@nt1m Oh, that makes sense, I suspected that it has to do something with anti-aliasing. I'm sad that the accent color mode doesn't work as intended -- I wouldn't really mind if it chose the blue link color for Wikipedia, but there are two bigger problems that arose while using it for a little while:
When (and if) the API gets fixed, I suggest trying out https://jariz.github.io/vibrant.js/ for the color selection. It looks it is able to extract even small amounts of accent color (e.g. the cat's eyes). Compare with the same cat image with Color-Thief. |
@JanPokorny I suspect mojebanka.cz is due to the slideshow images on the page. (Since the accent color mode takes the 200px top pixels of the page). Thanks for showing me vibrant.js! It looks interesting, but I'd have to do some performance tests first (this is the main reason I prefer my own little algorithm vs a big library). I might consider tweaking the algorithm according to what vibrant.js does. |
@nt1m The new version of Vibrant.js has WebWorker support, does that help the performance? (https://github.com/akfish/node-vibrant) I think that using caching, a potentially single-per-domain operation wouldn't hurt the performance much. (Only downside would be that it could catch a wrong color on an initial load -- e.g. a cookie disclaimer -- that would introduce a need for "Recolor this tab" context menu button. Is such button possible with the current API?) Ad mojebanka.cz: |
@nt1m How's the work on the API (1427463)? |
@maverick74 The API is now in Firefox Beta 59. I just haven't got time to work on VivaldiFox lately. Hopefully next week I'll be able to. |
@nt1m Great News Tim (No need to rush! As always, Real Life gets in the middle - I know what that is...) Thank you :D !!! |
@nt1m FF59 is almost here. Any ETA for this detail? |
@maverick74 I've got lots of things going on at the moment unfortunately :/ I'll try to look at it in April during my break. |
@nt1m No problem... was just asking to have an idea. This way i'll turn off my thinking of this issue until april :) |
Sorry for pushing this again, I've just been super busy these days. I'm planning to have this for version 3. I put June as deadline for myself, but I might be able to finish before. |
@nt1m funny, i was thinking about leaving a reply here today. So, take your time. We'll wait!!! But please, when there are news leave a note here. I'll keep an eye in this bug :) |
Off-topic: @nt1m don't know if you're aware or if it applies but i think vivaldi-fox could have great chances here: https://www.extensionschallenge.com/ |
@nt1m Great to see this is on the "fix" path =D |
Hey @maverick74 @JanPokorny, Thanks for your patience :) Please let me know how well it works :) |
Hi @nt1m :) I think it's working great now (after i explored options more carefully)!!! Will see how it behaves during the day =D |
Two small suggestions/details (IF they're possible):
|
@maverick74 Thanks for testing ! For 1, there's unfortunately no way to provide this, the native color is not exposed to extensions. For 2, there's no good way to do this, the only possible way involves an extra performance overhead and doesn't work on privileged pages unfortunately. Maybe this will change things: https://bugzilla.mozilla.org/show_bug.cgi?id=1429337 |
@nt1m Well, i'm not particularly concerned about 1 or 2. They're just "details"!!! The major feature is already accomplished with this release!!! I'm really happy with it!!! It seems to be working great!!! Thank you for your work, Tim!!! :D It really looks awesome |
@nt1m in my opinion - from my use of it until now - i believe it is release-ready! Did not find anything worth noting. |
@nt1m Will you this keep this bug open until bugzilla's1429337 is fixed? Or is there other reasons to keep it open? |
@maverick74 Sorry I completely forgot to provide updates about this. Version 3.0 got released to the wide public with this feature: https://addons.mozilla.org/en-US/firefox/addon/vivaldifox/versions/ Thanks for all your testing! |
Hi @nt1m i thought you were talking about https://bugzilla.mozilla.org/show_bug.cgi?id=1429337 and i missed it. About v3.0, i noticed it :) Thank you :) It works great!!! :) |
@nt1m regarding bugzilla's 1429337 mentioned above: Do you have any patch sketched for this bug or is it too much to complicated (or time consuming)? Should i create a new bug here to track it? |
@maverick74 I don't have time to work on it myself unfortunately, but I don't think it's too difficult to do. |
OK Tim, Thanks for clarifying it. maybe some other time... :) |
Based on the comments on AMO's page:
Would be really cool that, instead of getting the color from the favicon, the addon could get the colors from the top of a webpage.
taking GitHub's example, VivaldiFox would color tabs and toolbars with black color. The effect of this, for those who might like it, would be the apparent merge between Firefox's UI and the Site's Look and feel.
As already mentioned we could have options to pick color from:
I think the last option would be the most functional.
This would naturally have problems if we get to a site that has a header with a picture or a picture with degrade. But i think we can't do much in that cases and it would, at least, have one of picture's color.
The text was updated successfully, but these errors were encountered: