 |
 |
ShapeShifter/Themed colors
|
 |
|
 |
|
Forum Regular
Join Date: Dec 2002
Status:
Offline
|
|
I have an app (MenuMeters) that for various reasons renders some text into an NSImage which is then placed into an NSMenuItem. Recently a user pointed out that the rendered text is always black, which when used with darker background ShapeShifter themes makes the text hard to read. This is not a problem for other menu items because somewhere, somehow ShapeShifter changes the standard MDEF text color to properly contrast against the dark background.
I never use themes myself, but I'm wondering if anyone is aware of a method to determine the current MDEF text color. This would allow me to modify the color to match the theme. I've already tried all the usual NSColor system color defaults (+textColor, +controlColor, etc.) without success, these appear to never change regardless of theme.
Any suggestions?
Thanks,
Alex
|
|
|
| |
|
|
|
 |
|
 |
|
Mac Elite
Join Date: Sep 2000
Location: Tempe, AZ
Status:
Offline
|
|
Hi Alex,
You can use the following snippet to get the current menu color:
Code:
RGBColor color;
if ( noErr == GetThemeTextColor( kThemeTextColorRootMenuActive, 24, true, &color ) )
{
NSColor *color = [NSColor colorWithCalibratedRed: (float)color.red / (float)0xFFFF
green: (float)color.green / (float)0xFFFF
blue: (float)color.blue / (float)0xFFFF
alpha: 1.0];
// do something with it
}
There's also some voodoo methods you can pull using an offscreen window and NSBitmapImages. I'll post some sample code if you'd like.
I'm working on a library that app developers can link against to get this stuff more easily, btw.
|
Geekspiff - generating spiffdiddlee software since before you began paying attention.
|
| |
|
|
|
 |
|
 |
|
Forum Regular
Join Date: Dec 2002
Status:
Offline
|
|
You can use the following snippet to get the current menu color:
Thanks so much smeger (its Jason, right?)... I'm using this and seem to have made things better. The user reports success with some themes (Shinobi, NEOS, and AquaMatrix).
That said, he does still report it doesn't work for BBX Mercury, Brushed, Chocolate Milk, Titanium 7, Xi-MX7, Xi-Tibook 2. Is there something else I should be looking at?
There's also some voodoo methods you can pull using an offscreen window and NSBitmapImages. I'll post some sample code if you'd like.
No need, unless its required to fix the other themes. I'm running inside SystemUIServer, its unwise for me to try to open a window offscreen or otherwise.
I'm working on a library that app developers can link against to get this stuff more easily, btw.
That would be very helpful, hopefully BSD license? I searched the various Cocoa lists for this information, I had just about given up when I posted here. It seems like there is very little info available to developers who are interested in just maintaining compatibility. Have you and Unsanity considered publishing information on how it works? A library would be good, but for open source projects like mine a closed source link-only lib wouldn't be good.
Thanks again,
Alex
|
|
|
| |
|
|
|
 |
|
 |
|
Mac Elite
Join Date: Sep 2000
Location: Tempe, AZ
Status:
Offline
|
|
Originally posted by Basilisk:
Thanks so much smeger (its Jason, right?)... I'm using this and seem to have made things better. The user reports success with some themes (Shinobi, NEOS, and AquaMatrix).
That said, he does still report it doesn't work for BBX Mercury, Brushed, Chocolate Milk, Titanium 7, Xi-MX7, Xi-Tibook 2. Is there something else I should be looking at?
No prob, glad it helps. And, yep, I'm Jason.
I suspect that the user has the ShapeShifter preference pane set to not "Restart Menu Extras after applying". If this is the case, the new theme would be applied, but the SystemUIServer process wouldn't be restarted, so your Menu Extra would still be displaying with the old color.
That would be very helpful, hopefully BSD license? I searched the various Cocoa lists for this information, I had just about given up when I posted here. It seems like there is very little info available to developers who are interested in just maintaining compatibility. Have you and Unsanity considered publishing information on how it works? A library would be good, but for open source projects like mine a closed source link-only lib wouldn't be good.
I haven't decided licensing terms yet, but whatever the final license is, the goal is to make it easy and convenient for app developers to access system colors, images & patterns regardless of whether ShapeShifter is installed or not. So, the lib will probably be closed-source but extremely un-encumbered.
|
Geekspiff - generating spiffdiddlee software since before you began paying attention.
|
| |
|
|
|
 |
|
 |
|
Forum Regular
Join Date: Dec 2002
Status:
Offline
|
|
Just a a little more Jason  ...
I suspect that the user has the ShapeShifter preference pane set to not "Restart Menu Extras after applying". If this is the case, the new theme would be applied, but the SystemUIServer process wouldn't be restarted, so your Menu Extra would still be displaying with the old color.
The tester says he has this option checked, and has also tried a complete restart with BBX Mercury, still the color is wrong.
Any other ideas? Maybe those themes are the problem?
Thanks,
Alex
|
|
|
| |
|
|
|
 |
|
 |
|
Mac Elite
Join Date: Feb 2001
Location: Vancouver, WA
Status:
Offline
|
|
I'm working on a library that app developers can link against to get this stuff more easily, btw.
Seems like the more API-design-friendly way to solve this problem would be to have ShapeShifter override NSColor's system-catalog-color methods -- that way all Cocoa apps could benefit from your color-changing, not just the ones whose developers found out about your library...
|
|
|
| |
|
|
|
 |
|
 |
|
Mac Elite
Join Date: Sep 2000
Location: Tempe, AZ
Status:
Offline
|
|
Originally posted by Basilisk:
The tester says he has this option checked, and has also tried a complete restart with BBX Mercury, still the color is wrong.
Seems like that should work. Can you email me your build, or is it downloadable? I'll check it out and see if I can figure out why it's not working.
|
Geekspiff - generating spiffdiddlee software since before you began paying attention.
|
| |
|
|
|
 |
|
 |
|
Mac Elite
Join Date: Sep 2000
Location: Tempe, AZ
Status:
Offline
|
|
Originally posted by Rickster:
Seems like the more API-design-friendly way to solve this problem would be to have ShapeShifter override NSColor's system-catalog-color methods -- that way all Cocoa apps could benefit from your color-changing, not just the ones whose developers found out about your library...
This is what SS currently does. The lib would be for developers who want finer-grained control over their colors. The Cocoa system catalog colors are pretty general, some of them are private, and lots of 'em are deprecated.
|
Geekspiff - generating spiffdiddlee software since before you began paying attention.
|
| |
|
|
|
 |
|
 |
|
Forum Regular
Join Date: Dec 2002
Status:
Offline
|
|
Seems like that should work. Can you email me your build, or is it downloadable? I'll check it out and see if I can figure out why it's not working.
Build and code should be in your webmaster inbox, thanks...
Alex
|
|
|
| |
|
|
|
 |
 |
|
 |
|
|
|
|
|

|
|
 |
Forum Rules
|
 |
 |
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is Off
|
|
|
|
|
|
 |
 |
 |
 |
|
 |
|