mirror of
https://github.com/ocornut/imgui.git
synced 2026-11-14 19:04:44 +00:00
ColorPicker / ColorEdit Widget Wrong Conversion from HSV to RGB #2722
Labels
No labels
accidentally closed
android
backends
bug
building
clipper
coloredit
color spaces
cplusplus
data types
demo
disabled
doc
docking
dpi
drag drop
drawing/drawlist
dropped
dx12
enhancement
focus
font/text
gallery
help wanted
idle/power saving
ime
in progress
inputs
inputtext
internals
label/id and id stack
language bindings
layout
linux/bsd
menus
multi-contexts
multi-threading
multi-viewports
nav
news/info
opengl
optimization
osx/ios
overlap
plot/graph
popups
question
scrolling
selection
settings
sliders/drags
style
tables/columns
tabs
test wanted
tools
tooltips
tree
tricks & tips
useful widgets
vulkan
web
window pos/depth
window sizing
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
ocornut/imgui#2722
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Version/Branch of Dear ImGui:
Version: 1.72b
Branch: master
My Issue:
Hi, I think color picker doesn't work well when doing conversion from HSV to RGB.
When I set S to 0, it jumps to red. In Photoshop color picker doesn't do that.
Is there a way to force the color picker to not use HSV format? So I don't have to bother regarding this issue. I saw
ImGuiColorEditFlags_DisplayRGBflag, but although I'm using it, it still displays HSV when I pick a color. How about also displayingImGuiColorEditFlags_DisplayRGBandImGuiColorEditFlags_DisplayHex? The assertion doesn't allow that.Have you tried
ImGuiColorEditFlags_InputRGB?@IAmEki, Thanks! I see with the new changes it does display RGB with this flag, but the problem where the color transition jumps to red still there. I think the color values needs to be clamped.
See #2383 (and #2384) to understand the issue.
If your code is storing RGB i don't think this is fully solvable.
InputHSVflag to avoid those singularities.I don't know if there is a better solution. @haldean would know perhaps ?
I agree 100% with what you said Omar; as long as the application is holding all of the color state, the widget doesn't have enough information to keep the hue slider in the same place when S/V go to 0. To fix, you'd have to pass HSV values (using
InputHSV) or the library would need to store a "last hue" somewhere.Hmmm, we could probably store a "last hue" associated to the last active widget ID, and have ColorEdit4/ColorPicker4 restore that hue on edit.. That would maybe attenuate the issue enough?
Thank you @ocornut. Looking into this issue more in depth, I believe storing last hue could potentially solve this issue. However, I'm pretty new to using ImGui, so I'm not confident enough with the sources providing a pull request to this, but I'll try to see if something comes up in mind.
Merged a fix for this, thank you @rokups !
The fixes stores last Hue for a given RGB set.
Note that the picker has another singularity of the same kind, when setting V=0 breaks Saturation. A fix for that other issue could be nice sometimes.