rumps icon indicating copy to clipboard operation
rumps copied to clipboard

Change color of text in menubar

Open mdbraber opened this issue 6 years ago • 4 comments

It's possible to use color icons, but is it also possible to change the text color in the menubar?

mdbraber avatar Jan 31 '19 21:01 mdbraber

I don't think I've seen this before but it's maybe possible. Anyone know?

jaredks avatar Feb 02 '19 14:02 jaredks

It's hacky, but this works (only changing the alpha channel in this example):

color = NSColor.colorWithCalibratedRed_green_blue_alpha_(1, 1, 1, 0.4)
attributes = propertyListFromPythonCollection({NSForegroundColorAttributeName: color}, conversionHelper=lambda x: x)
string = NSAttributedString.alloc().initWithString_attributes_(' ' + self.active_station, attributes)
self._nsapp.nsstatusitem.setAttributedTitle_(string)

I've used this in my RadioBar app

mdbraber avatar Feb 03 '19 13:02 mdbraber

If you want to make a PR, this seems cool.

jaredks avatar Feb 03 '19 13:02 jaredks

@jaredks a function for this would be nice, but I think this requires some good design to figure out what would be a universal way to do this. I'll leave it for now, if I need a general way I'll submit a PR.

mdbraber avatar Feb 03 '19 15:02 mdbraber