Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding sRGB colors to ImGui style. #7826

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

RisingLiberty
Copy link

@RisingLiberty RisingLiberty commented Jul 28, 2024

This is a pull request to enable SRGB colors within ImGui for all 3 styles (dark, light, classic)
All linear colors have been converted to sRGB formats. The reason sRGB colors are hardcoded instead of calculated at runtime from the linear colors is for performance reasons. This brings in extra maintance as when the default style colors are changed, both the linear and sRGB values need updating.

This PR got created to resolve the issue raised in #578

To enable the sRGB colors, simply add ImGuiConfigFlags_IsSRGB to the config flags and update the style

ImGuiIO& io = ImGui::GetIO();
io.ConfigFlags |= ImGuiConfigFlags_IsSRGB;
ImGui::StyleColorsDark();

Normal dark theme
normal_dark

sRGB dark theme before change
srgb_before_change

sRGB dark theme after change
srgb_after_change

If ImGuiConfigFlags_IsSRGB is specified to the ImGui config, it'll use the sRGB colors instead of the default ones, which are linear.
@RisingLiberty
Copy link
Author

This can probably be merged with #2943

@adv-sw
Copy link

adv-sw commented Aug 19, 2024

this doesn't degamma color wheels, only theme colors so is an incomplete solution.

here's a generic, dynamic fix to the issue (dx12 only - other backends can be upgraded in a similar fashion)

#7904

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants