Page MenuHome

Draw Border Around Icons
ClosedPublic

Authored by Jeroen Bakker (jbakker) on May 3 2019, 10:15 AM.

Details

Summary

When loading the monochrome icons blender will generate a border around them. This border will enhance the contrast when doing themes icons.
Only themes icons will be rendered with a border.

Icons 16x16:

Icons 32x32:

This is what it might look like when used in a light theme.

Diff Detail

Repository
rB Blender

Event Timeline

Jeroen Bakker (jbakker) retitled this revision from Interface: Icon Border to Draw Border Around Icons (WIP).May 3 2019, 10:26 AM
Jeroen Bakker (jbakker) edited the summary of this revision. (Show Details)
Jeroen Bakker (jbakker) edited the summary of this revision. (Show Details)May 3 2019, 10:30 AM
Jeroen Bakker (jbakker) edited the summary of this revision. (Show Details)May 3 2019, 11:01 AM
Jeroen Bakker (jbakker) edited the summary of this revision. (Show Details)May 3 2019, 11:02 AM
Jeroen Bakker (jbakker) updated this revision to Diff 15085.

Cleaned up

Only draw themes icons with border

Jeroen Bakker (jbakker) retitled this revision from Draw Border Around Icons (WIP) to Draw Border Around Icons.May 3 2019, 2:40 PM
Jeroen Bakker (jbakker) edited the summary of this revision. (Show Details)
Jeroen Bakker (jbakker) edited the summary of this revision. (Show Details)

Looks good to me!

Brecht Van Lommel (brecht) requested changes to this revision.May 3 2019, 3:47 PM

To be clear, this must still become a theme setting where you can choose the outline intensity. It would be enabled by default in Blender Light, but not in Blender Dark.

This revision now requires changes to proceed.May 3 2019, 3:47 PM

A limitation of this is when it is done.

With my dynamic experiments the outline was added at the time the icon was drawn, so it could act differently depending on the icon colour at that time. So a light icon could get an outline and a nearby dark icon might not. This method will necessarily cause some constraint on what themes can do.

When we first added these monochrome icons I wished we would have done it right and allowed uibut to have icon colour overrides that were used at the time of drawing, rather than broadly recolouring as we are for outliner and now Properties. We now removing the big advantage they had, being able to output them at any colour at will.

Jeroen Bakker (jbakker) planned changes to this revision.EditedMay 5 2019, 8:50 AM
  • Add option to disable the border drawing as a theme setting.

@Harley Acheson (harley) thanks for your feedback.

This task is the minimum that is needed for Blender 2.80; mid May we need to finalize this and there are still a lot of other stuff that needs to be completed.
Afterwards we can still adopt when it has been agreed upon. The first part you are requesting is a very small change (set the with_border variable to take this into account), but can lead to inconsistent UI experience.
I personally disagree about with your second request as then addon developers can create a christmas trees need to be theme aware what leads to undesired effects to end users.
But I am not the person to decide if we will do it. Both both are for the UI team to find out.

I think I was just wrong about this approach happening too early and broadly.

I think, in practice, it will work out wonderfully. That is because I think it will be enabled in more circumstances than we might initially think. Enabling dark outlines when using the dark theme might not seem to make sense, but I think that will happen. A dark outline does no harm for a light icon on a dark background, but it does help within that same theme when we have icons on less dark colors (like viewport shading icons). So I think in the end my initial worry is just without merit.

I personally disagree about with your second request as then addon developers can create a christmas trees need to be theme aware what leads to undesired effects to end users.

Yes, I never wanted uiBut (or operators) to have wide-open RGBA color overrides as that would end up a mess pretty quickly. But instead to just use theme Color ids. What I thought ideal is if uiBut started with an icon_color of TH_UNDEFINED and would therefore, by default, act as it does now and use TH_TEXT for the icon color. But if set then widget_draw_icon() would use this color instead. That way the Outliner could draw the same icons in the same colors it does now, using the same theme preferences, but just not in a way that colors those icons for all uses outside of the Outliner.

Jeroen Bakker (jbakker) edited the summary of this revision. (Show Details)May 7 2019, 8:31 AM

Added theme setting when to draw a border around the icons.

@Brecht Van Lommel (brecht) I added an option in the theme for when the border should be drawn. In stead of a boolean I used an enum so it is more future proof when adding other selections. If you prefer a boolean, please lemme know.

I would expect that in the future we also want to theme the color of the border and perhaps the sharpness of the border to create a shadow effect.

Currently it looks like this:

Personally I find the effect a little on the strong side. Is the Outline color/opacity hardcoded to be black with 100% alpha?

In any case, now that it's a theme setting we can keep it off for the default theme.

Code style: seamed that clang-format ignored a whitespace

Opacity control is a must. Now it looks... well... not good.

Brecht Van Lommel (brecht) requested changes to this revision.May 7 2019, 11:05 AM

I don't think we need to give an outline to all icons. Only do it for themed icons since it doesn't work well for all icons, and once we expose that possibility we are stuck dealing with the associated problems at some point.

Instead I would like to see a float 0..1 factor for the outline intensity, going from fully transparent to opaque black. Probably the default for Blender light can be a bit lower than 1.

source/blender/editors/interface/interface_icons.c
868

This should only be done if needed by the theme, and not take up memory or startup time otherwise.

This revision now requires changes to proceed.May 7 2019, 11:05 AM

@Brecht Van Lommel (brecht)

Only do it for themed icons

This patch already does that - in the theme you can set it to only apply to the 'themed' icons.

This patch already does that - in the theme you can set it to only apply to the 'themed' icons.

Yes, and there should be no preference to do it for all icons. Because if we add functionality we should support it properly, and it doesn't work well now.

Removed the draw border around all icons option.

Just to be clear, if we have an 0..1 slider I don't think we need the enum at all. It can just do nothing when the value is 0.0.

  • migrated the icon_border enum to icon_flags
  • only generate the bordered icon texture when needed
Harbormaster completed remote builds in B3533: Diff 15192.
Jeroen Bakker (jbakker) marked an inline comment as done.May 7 2019, 4:42 PM

Looks promising. Maybe those outlines should be always enabled, even for the dark theme.
Outlines always helps in readability imho.

Brecht Van Lommel (brecht) requested changes to this revision.May 9 2019, 11:43 AM

Not sure if this is waiting for review or not, but marking as request changes since the boolean should become a 0..1 slider.

This revision now requires changes to proceed.May 9 2019, 11:43 AM

Not sure if this is waiting for review or not, but marking as request changes since the boolean should become a 0..1 slider.

Ah I misread. will work on it.

theme can adjust the intensity of the border

This revision was not accepted when it landed; it landed in state Needs Review.May 9 2019, 7:56 PM
This revision was automatically updated to reflect the committed changes.