Page MenuHome

T64177 Toolbar icon theming support
ClosedPublic

Authored by Yevgeny Makarov (jenkm) on Jan 22 2020, 8:35 AM.

Details

Summary

T64177 Toolbar icon theming support.

Toolbar icons will be automatically "inverted" depending on the background (toolbar item inner) color.

Diff Detail

Repository
rB Blender

Event Timeline

Yevgeny Makarov (jenkm) edited the summary of this revision. (Show Details)

The theme option has been removed.
Now icons are inverted depending on the background color.
Made as simple as possible.

LGTM, but I'm not sure it was necessary to add yet another patch to do the same thing? You can just update your other one :)

Anyway, it's not so important - the main thing is that this seems to work well. In my testing it appears to work great.

This revision is now accepted and ready to land.Jan 22 2020, 8:28 PM

The first (abandoned) version is D6532, if anyone is interested.

Adding @Campbell Barton (campbellbarton) as reviewer since he coded toolbar icons, and @Clément Foucault (fclem) since he commented on previous implementation.

Hope the other reviewers are ok with me removing them from this - if not, feel free to say so.

I believe all colors here are in sRGB space.

Please convert to linear colors before doing any operations and convert back to sRGB for storage.

Also I would like to see if just decomposing to hsv and inverting the Value component is better or just the same.

Clément Foucault (fclem) requested changes to this revision.Jan 23 2020, 1:59 PM
This revision now requires changes to proceed.Jan 23 2020, 1:59 PM

It seems faster and more correct to change the colors in BKE_icon_geom_rasterize before rasterization, instead of after.

Then, maybe not to invert colors every time at re-rasterization, but once at loading .dat-files and store two sets of colors.

Or maybe even better to store two prepared sets of colors in .dat files.
In this case it can be manually prepared materials as William originally suggested in the T64177.

@Brecht Van Lommel (brecht) @Campbell Barton (campbellbarton) ?

To me that seems fine, it's probably a more effective way to get good looking results. But @Campbell Barton (campbellbarton) and @William Reynish (billreynish) know this system better than me.

Yevgeny Makarov (jenkm) retitled this revision from T64177 Toolbar icon theming support (second version) to T64177 Toolbar icon theming support.Jan 24 2020, 1:21 PM

The version using ibuf->rect.

The version using geom->colors.

I believe all colors here are in sRGB space. Please convert to linear colors before doing any operations and convert back to sRGB for storage.
Also I would like to see if just decomposing to hsv and inverting the Value component is better or just the same.

Using HSL now, gives the same result. I tried to use linear colors and HSV, for some reason it doesn't produce good results at all.

It seems faster and more correct to change the colors in BKE_icon_geom_rasterize before rasterization, instead of after.

Now it changes colors before rasterization.

Brecht Van Lommel (brecht) accepted this revision.EditedFeb 3 2020, 6:42 PM

Inverting in sRGB usually works better than scene linear, since it's more perceptually linear.

I'll commit this with some code tweaks.

This revision was not accepted when it landed; it landed in state Needs Review.Feb 3 2020, 6:43 PM
This revision was automatically updated to reflect the committed changes.