Something to play with, consider, or talk about...
The central premise here is that the colors of the overlays on the 3DView window can no longer be set by the theme. This is because the background of the 3DView can be specified by the world color, the viewport color, or the theme color. Therefore you can pick any theme you wish with a background color that you like, but that color doesn't stay as you can select a different color without changing theme. For example changing it with Properties / World / Viewport color. Or Shading / Background / Viewport color.
This issue is noticed the most by simply changing from the Default workspace to "2D Animation" workspace, since doing so changes the background color via the viewport color.
The following image is a capture of how it is now with default theme before and after changing to the 2D workspace. You'll notice that the overlay text is always white. There is an assumption in the code that TH_TEXT and TH_TEXT_HI are always white in all themes. And therefore the shadow is hard-coded to black. So the only reason it is always visible is because the shadow is so large. The icons of the gizmos are always white because icons always use TH_TEXT for color and so can't change as the viewport color changes. And the color of the highlight circle behind the icons doesn't change, which makes it hard to see with some color combinations.
This patch selects text colors, shadows, and scrim color automatically based on the color of the background, regardless if set in work, viewport, or theme. So the are always nicely visible regardless of what is chosen. And it tries to harmonize the colors between overlays and gizmos.
The following captures what it looks like after the patch is applied and changing from default them to the 2D workspace:
You'll notice that text is a light color on the dark background, but dark on the light background. The icons also change color, and the overall look of gizmos when selected or not seems consistent.
I've tested it will all current themes and with any colors I could think of and it always remains nicely readable.
view3d_utils.c. Enhanced ED_view3d_background_color_get() so that it can work earlier in the space-creation process, and will also take into account gradient backgrounds. Added new helper functions to create contrasting colors from background color
space_view3d.c. New procedure that gets a nice contrasting text color from background color and overwrites the 3dview main area's TH_TEXT and TH_TEXT_HI. This is called minimally by responding to NC_WINDOW (them color changes), ND_SPACE_VIEW3D (Viewport color changes), and ND_WORLD (world color changes).
view3d_draw.c & view_draw_legacy.c. Drawing the view name and other overlays using a text shadow that contrasts with text color, not just hardcoded to black.
view3d_gizmo.navigate.c. Moves color-setting code from WIDGETGROUP_navigate_setup and into a new WIDGETGROUP_navigate_refresh so it can update the widgets if the background changes