OtterBrowser / otter-browser

Otter Browser aims to recreate the best aspects of the classic Opera (12.x) UI using Qt5
https://otter-browser.org
GNU General Public License v3.0
1.79k stars 272 forks source link

Fix custom icons on dark themes #1761

Closed MorsMortium closed 3 months ago

MorsMortium commented 3 months ago

Fixes #1670

Frenzie commented 3 months ago

Sounds cool. :-)

Emdek commented 3 months ago

@MorsMortium, sadly this is not the right way to deal with this issue, from the start we were supposed to use the SVG icons directly and simply replace the primary color by the one specified by palette (perhaps own entry for icons, with text color as fallback, plus perhaps some extra work to deal with macOS, since they disconnect the menu bar from main window…). There is some work on introducing custom color palette definitions (more keys than simple QPalette) but it needs more discussions. The problem is that there were some issues with custom QIconEngine (AFAIR applying effects for icon states, maybe something else)… The alternative was to create on disk files on demand, which has it's own benefits, since it is also a cache, and it is also easier, so probably it is the best way to go. There is one more detail that makes it more complex, it would be a good idea to follow this spec, since there are already cases where it would be useful to have dedicated smaller sizes for some icons that are scaling down in ugly way.

MorsMortium commented 3 months ago

@Emdek I think this could be tackled in smaller steps.

I could remake the icons in svg and also do the color replacing. In fact I did the replacing, just to test if it's doable. The remaining parts I can't do. But, this would solve the issue still, and bring it closer to the state described by you. I'll show the example I did, in which I replaced the color of some nodes in an svg. It is the go previous button/icon. The svg itself has a group with an id named "main", everything in that group is recolored, nothing outside of it. Would this be acceptable?

image

MorsMortium commented 3 months ago

Of course the icon was just a quick test and the code needs some tests for return values and using the actual color, instead of blue.

Emdek commented 2 months ago

@MorsMortium, the icons are made from SVGs, which can be found here. Basic color replacement can be done by simply replacing {placeholder} as string, unless you are attempting to replace more than primary color. Perhaps we could postpone usage of the spec for now, but I would really prefer to have some external format instead of inventing own… The plan is to allow to import icon themes as addons (ZIP files or folders). Palette has some initial work done but needs feedback for deciding on file format (kinda similar issue like with icons spec, trying to create "perfect" solution from the gecko). macOS… This one is the least important right now, since Apple makes it impossible to create packages for that platform without paying them for the ability to sign them.

Sorry for late reply, it might be a better idea to contact me via our IRC channel.

Emdek commented 2 months ago

BTW, there is one more benefit of following that icon spec, ability to use dedicated icons for specific sizes, since in some cases one common SVG icon produces crappy results for 22 x 22 etc.