It seems that it’s been asked a few times on the internet, but it never got any satisfying answer.
I am trying to pick a color in the viewport, I used to use bgl.glReadPixels but it seems it’s been deprecated in 2.91 in some way, it only returns black in my case and I was not able to find a workaround.
The Color widget picker on the other hand seems to be the perfect tool for the job. However I hit two issues:
I don’t want the color widget, I just want the color picker. bpy.ops.ui.eyedropper_color() in my own operator only returns {‘PASS_THROUGH’}.
Let’s say I accept to use a color property in the UI, I still want to run some functions before running the picker, which is not possible AFAIK? The set or update functions only happen after I finished picking.
If anyone has an idea how to add a simple color picker, I’d appreciate the help!
I support it. I can get background and grid color but not object color. I get always black pixel on the object
buffer = bgl.Buffer(bgl.GL_FLOAT, [1, 3])
bgl.glReadPixels(self.mouse[0], self.mouse[1], 1, 1, bgl.GL_RGBA, bgl.GL_FLOAT, buffer)
I’m not a developer (yet) but I want to hotkey the color picker to pick the Color Attributes in grease pencil while drawing/painting. is there any way to do that please?