public static void _SetThemeSystemColorList(NSColorList aList) { _colorListLock.Lock(); if (ThemeColorList != aList) { if (ThemeColorList != null && _availableColorLists.Count > 0 && _availableColorLists.ObjectAtIndex(0) == ThemeColorList) { _availableColorLists.RemoveObjectAtIndex(0); } ThemeColorList = aList; _availableColorLists.InsertObject(aList, 0); } _colorListLock.Unlock(); }
public static void InitSystemColors() { NSString white; NSString lightGray; NSString gray; NSString darkGray; NSString black; // Set up a dictionary containing the names of all the system colors // as keys and with colors in string format as values. white = NSString.StringWithFormat(@"%g %g %g", (double)NSWhite, (double)NSWhite, (double)NSWhite); lightGray = NSString.StringWithFormat(@"%g %g %g", (double)NSLightGray, (double)NSLightGray, (double)NSLightGray); gray = NSString.StringWithFormat(@"%g %g %g", (double)NSGray, (double)NSGray, (double)NSGray); darkGray = NSString.StringWithFormat(@"%g %g %g", (double)NSDarkGray, (double)NSDarkGray, (double)NSDarkGray); black = NSString.StringWithFormat(@"%g %g %g", (double)NSBlack, (double)NSBlack, (double)NSBlack); ColorStrings = (NSMutableDictionary)NSMutableDictionary.Alloc().InitWithObjectsAndKeys( lightGray, (NSString)@"controlBackgroundColor", lightGray, (NSString)@"controlColor", lightGray, (NSString)@"controlHighlightColor", white, (NSString)@"controlLightHighlightColor", darkGray, (NSString)@"controlShadowColor", black, (NSString)@"controlDarkShadowColor", black, (NSString)@"controlTextColor", darkGray, (NSString)@"disabledControlTextColor", gray, (NSString)@"gridColor", lightGray, (NSString)@"headerColor", black, (NSString)@"headerTextColor", white, (NSString)@"highlightColor", black, (NSString)@"keyboardFocusIndicatorColor", lightGray, (NSString)@"knobColor", gray, (NSString)@"scrollBarColor", white, (NSString)@"selectedControlColor", black, (NSString)@"selectedControlTextColor", lightGray, (NSString)@"selectedKnobColor", white, (NSString)@"selectedMenuItemColor", black, (NSString)@"selectedMenuItemTextColor", lightGray, (NSString)@"selectedTextBackgroundColor", black, (NSString)@"selectedTextColor", black, (NSString)@"shadowColor", white, (NSString)@"textBackgroundColor", black, (NSString)@"textColor", lightGray, (NSString)@"windowBackgroundColor", black, (NSString)@"windowFrameColor", white, (NSString)@"windowFrameTextColor", black, (NSString)@"alternateSelectedControlColor", white, (NSString)@"alternateSelectedControlTextColor", white, (NSString)@"rowBackgroundColor", lightGray, (NSString)@"alternateRowBackgroundColor", lightGray, (NSString)@"secondarySelectedControlColor", //gray, (NSString)@"windowFrameColor", //black, (NSString)@"windowFrameTextColor", null); SystemColors = NSColorList.ColorListNamed(@"System"); DefaultSystemColors = (NSColorList)NSColorList.Alloc().InitWithName(@"System"); NSColorList._SetDefaultSystemColorList(DefaultSystemColors); if (SystemColors == null) { SystemColors = DefaultSystemColors; } { NSEnumerator enumerator; NSString key; // Set up default system colors enumerator = ColorStrings.KeyEnumerator(); while ((key = (NSString)enumerator.NextObject()) != null) { NSColor color; if ((color = SystemColors.ColorWithKey(key)) == null) { NSString aColorString; aColorString = (NSString)ColorStrings.ObjectForKey(key); color = NSColor.ColorFromString(aColorString); //NSCAssert1(color, @"couldn't get default system color %@", key); SystemColors.SetColor(color, key); } if (DefaultSystemColors != SystemColors) { DefaultSystemColors.SetColor(color, key); } } } SystemDict = (NSMutableDictionary)NSMutableDictionary.Alloc().Init(); }
public static void _SetDefaultSystemColorList(NSColorList aList) { _colorListLock.Lock(); if (DefaultSystemColorList != aList) { if (DefaultSystemColorList != null && _availableColorLists.LastObject() == DefaultSystemColorList) { _availableColorLists.RemoveLastObject(); } DefaultSystemColorList = aList; _availableColorLists.AddObject(aList); } _colorListLock.Unlock(); }