Getting the Apple Color Picker to show a slider for transparency

Apparently, when writing an application that uses the system colorpicker, you have to tell it that you accept transparency or the color picker will not show the slider for it.

Does anyone know how to do this?

This s the color picker as it appears from “Insert color” in the Xojo IDE without a transparency slider:

This is the color picker which shows when changing a color in terminal’s preferences>settings:

How do I get the one with the opacity slider to show in my app?

(Also, it might be nice to have in the IDE)

Put a feature request in feedback for it in teh De as well in the framework… When the added the color alpha channel it would have been ben once to have added it…

But I don’t know if the Windows OS color picker (never nine linux!) has teh option to support transparency… If it does it should definitely IMO it should definitely been added Xplatfrom to the Framework… if not it would still be nice if they supported it in OSes that do support it… but I think it would make it less likely to get added.

  • karen

I have a class for doing this, however it acts a little different than SelectColor. The class was made primarily to have a working eye-dropper widget and the transparency option came along.

Here’s the demo. Go to SimplestDemo.chooserShowButton.Action and change the first line to read “PickColor.begin(self, theColor, true)” The 3rd parameter is whether to show the opacity slider or not.

Untested on 64bit. If it doesn’t work out of the box it should hopefully point in the right direction.

Works out of the box, thanks!

you can use NSColorPanelMBS class from MBS Plugins:

There we have a showsAlpha property.

Xojo would be a more fantastic tool if Xojo Inc would hire Christian and include all his plugins natively in Xojo …

But then Christian would probably not have the same income …

yes, but seing the speed Christian implement new things in his plugins, and the speed Xojo does … well ?
Christian would be a valuable asset for Xojo Inc. (Like Jason for iOS …)

Thanks for the compliments.

By far not as complete as Christian’s, but a native ColorPanel is available in AppleLib too. You can drag it on a layout to use its events directly, or use the shared class instance if you don’t need the events. (It’s in the ColorAdditions demo Window)

Hi Will,

Is there a version that is meanwhile adopted to 64bit?

For MBS plugin, you can set NSColorPanelMBS.showsAlpha to true.