godotengine / godot-proposals

Godot Improvement Proposals (GIPs)
MIT License
1.12k stars 69 forks source link

Add theme items to customize checkbox modulate colors #10492

Open nongvantinh opened 3 weeks ago

nongvantinh commented 3 weeks ago

Describe the project you are working on

I am developing a project in the Godot Engine that requires a flexible and dynamic user interface across multiple themes. Each theme is intended to have a unique color scheme, including the colors of checkbox icons for both checked and unchecked states. The project is targeted for mobile platforms, where minimizing application size is a crucial consideration.

Describe the problem or limitation you are having in your project

Currently, Godot requires creating separate image assets for each color variation of checkbox icons when switching between themes. This approach leads to an increase in the number of image assets, which in turn increases the overall size of the application. Since mobile devices have limited storage and strict size requirements for apps, this redundancy is not ideal. The need to manage multiple identical images with only color differences also complicates the workflow and increases the potential for errors.

Describe the feature / enhancement and how it helps to overcome the problem or limitation

The proposed feature is an enhancement that allows the color of checkbox icons (both checked and unchecked) to be dynamically altered based on the active theme. Instead of creating multiple image assets, developers could apply a color tint to a single base icon, reducing the number of images needed and significantly decreasing the application size. This enhancement would also streamline the workflow for developers, making it easier to implement theme changes without the need to manage multiple image assets.

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

This feature could be implemented by allowing developers to set a color property for the checkbox icons directly within the theme settings. The color property would apply a tint to the base icon, dynamically altering its appearance to match the theme's color scheme.

If this enhancement will not be used often, can it be worked around with a few lines of script?

Yes

Is there a reason why this should be core and not an add-on in the asset library?

This enhancement should be part of the core engine because it addresses a common requirement for theming in modern user interfaces, especially for mobile applications where size optimization is critical. By integrating this feature into the core, Godot would offer a more powerful and flexible theming system, reducing the burden on developers and making the engine more appealing for mobile and theme-driven projects. As dynamic theming is a widely used feature in UI design, having this capability built into the engine would benefit a broad range of developers.

Calinou commented 3 weeks ago

If this is to be implemented in CheckBox, I'd expect this to be available in CheckButton as well for consistency.