New color picker

Is there any documentation regarding the changes they made to the color picker and how it affects old code using the old colour picker which had solid color brushes by name only?

For example, I would like to know if ToDxBrush() has been updated to now handle opacity because previously I always used an undocumented method and a separate int variable to make a user defined opacity brush. So just wondering how to migrate everything, or if I need to at all.

Also, if you define a Brush with ARGB as a user property. What happens when someone opens up the indicator in the old version of NT with old color picker which only has solid colors as a drop down menu and no alpha.?

2 Likes

I have same question.

I still create and freeze with a GUI variable for alpha Opacity in State.Configure.

I can only change the opacity and not the color unless I open and change the code.

Would like to know if there is new documentation to set Brushes with opacity that will appear in GUI of indicator properties.

~Robotman

I had a play around:

SolidColorBrush riskFill = new(Color.FromArgb(60, 231, 76, 60));
riskFill.Freeze();

Is the correct way to create a Brush with Opacity and it populates the new picker with the correct alpha. You may notice that many NT tools still have a separate property for Opacity. Like the rectangle tool for example. This still works, so basically if you use the new color picker to draw red with 50% alpha. Then the separate opacity property works separately on top of this. It’s a little confusing to have 2 separate opacity controls on the same object.

As far as I see, we don’t need to do any updating of any code. Brushes.Red etc still works to create a solid color. I guess the only thing to bare is mind is if you use brushes with Alpha built in WITHOUT a separate opacity field then opacity won’t be controllable by the user on versions prior to 8.1.7.

1 Like

Thanks!

I will try it out tomorrow!

~Robotman