CueText Color

anyway to control this?

I’m looking to create a dark theme, and changing textcolor works fine, but cuetext has a set color and doesn’t show

Use a label or canvas over the TextField displaying the cue text, which you render invisible when there is text, or when user clicks on the TF to gain focus ?

kinda of defeats the purspose of having CueText doesn’t it

You want to change the cue text color, and that looks very much not possible in the Text Field Mac OS X Class, as well as in Windows, at least as far as I can tell. So what you want to do has to be done another way. I do not think it defeats the purpose of having cue text, it simply replaces an inadequate property by another technique.

If I understood right your post, what you want to do is to have a cue text of a different color. You can achieve that with an overlaid label or canvas. Now it may not suit your sense of purity, but when the framework does not provide, one has to make due. or forget the color change.

Alternatively, you could probably use TextInputCanvas, which if its name is not too deceptive should let you draw a cue text of any color. Set aside a bottle of Tylenol, though :wink: It looks like the kind of control that requires deep involvement.

Update : Just found this in SO.

It does seem possible to change the placeholder color in NSTextField :

For Windows, the Cue Banner does not seem terribly evident.

So I take it that we still can’t change the cue colour?


Fair enough.

I like the function of Cue Text - I find it useful. I don’t really care that much to change the colour, but a slightly lighter grey as the default would be much better.

For Windows, I recently used a transparent TextField with super TextArea to place whatever I wanted underneath the control :

For Mac, placing a Canvas over the TextField does the trick very nicely, as it does not block events. Some code in GetFocus to make the canvas transparent, and that should do the trick. Plus code in TextChange to make it visible again when text = “”.

I noticed that the NSTextFieldMBS class has a placeholderAttributedString property.
Not sure in what extend this property of the MBS plug-in can change about the Placeholder- or CueText. But I’m sure it must be doable.

[quote=177921:@Michel Bujardet]It does seem possible to change the placeholder color in NSTextField :
swift - Cocoa NSTextField change placeholder color - Stack Overflow [/quote]
I think the properties in that plug-in are mapped. But I’m not sure if all the functions are mapped.

I just recently purchased the MBS plugin set. And I am still at a play-around-level. But, it’s pretty wild!

The theme of my app is quite dark. And the default dark CueText is not really legible against the dark textField. And no, my theme is not based on the OS’s DarkMode.