Replies: 1 comment 1 reply
-
The focus stylebox is drawn on top of other styleboxes using the same alpha mode (i.e. straight alpha unless the Control uses a CanvasItemMaterial with the premultiplied alpha blend mode). It is not intended to replace underlying styleboxes entirely. The reason the focus stylebox is drawn on top is to allow normal/hover/pressed styleboxes to remain visible for better accessibility and UI feel, while still allowing a focus outline to display at the same time. See also #2011 (which was closed, but I think should still be implemented). |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I noticed that even if you create a custom theme where all the modes (normal, hover, focus, pressed, disabled) use the same StyleBox (it's a weird idea but apparently the Theme editor does it by default; but that's another issue), the focus with have a darker shade for the BG Color at runtime. Technically, the alpha on BG Color is set to 1 on focus. You can verify this by playing with the alpha and notice that the difference shows when non-focus BG Color have some alpha < 1 and Focus BG Color alpha is high enough (the formula takes into account the alpha set in the StyleBox).
I cannot explain what happens, and that prevents me from doing complete customization if I want. Like not changing BG color at all and only changing texture; unless I make sure to set all alpha to 1 to be safe.
Do you know which formula is used, and could this be documented? And above all, can we tune behavior to disable it, customize the alpha formula, etc. ?
Note: may not be visible with default theme. Try to create custom theme with default StyleBoxFlat, which uses transparent BG color, to make it show
Beta Was this translation helpful? Give feedback.
All reactions