Eto ColorPicker default color

Dear Rhino users and developers,

is it possible to send some custom color list (with my default color) to Eto ColorPicker, like in Rhino.UI.Dialogs.ShowColorDialog? Or add additional action which would call method to set to default color here?:


@curtisw could you help here? Could I extend/inherit-override something to achieve this goal? Any suggestion for direction which I could follow would be appreciated.

Hi @mlukasz87,

Use one of the many Dialogs.ShowColorDialog methods.

For example:

var oldColor = System.Drawing.Color.CornflowerBlue;
var color4f = new Rhino.Display.Color4f(oldColor);
var allowAlpha = true;
var rc = Rhino.UI.Dialogs.ShowColorDialog(ref color4f, allowAlpha);
if (rc)
  var newColor = color4f.AsSystemColor();

– Dale

Thank you @dale for answer. It is possible to run this Dialogs.ShowColorDialog instead of default ColorPicker dialog (which is same dialog but without possibility to use my color list)? When I use OnMouseDown it overrides behaviour over whole control area, including right side of it - turning it into a simple button which makes no sense.

I could do it also with Button object having dynamically changing background color, but I have troubles with binding Button background color to my ViewModel property.

Hi @mlukasz87,

My apologies, but I don’t understand what you are doing.

If you want a custom color list, just use the Dialogs.ShowColorDialog that accepts a NamedColorList as a parameter.

Or am I confused?

– Dale

I would like to trigger this dialog by control in panel which would have background color of currently used color. To achieve this I was thinking about using Eto ColorPicker or Eto Button. Do you think this is possible?

Yes. See of the attached gives you any ideas. (26.1 KB)

– Dale

1 Like

Thank you @dale !

this undocumented method was my missing puzzle to bind button background correctly: