mirror of
				https://github.com/SoftFever/OrcaSlicer.git
				synced 2025-10-31 04:31:15 -06:00 
			
		
		
		
	FIX:set the MacOS mainframe title color to white
Change-Id: I3e16000f3d93f95509d6e16cec95d4d6ad0ac85b
This commit is contained in:
		
							parent
							
								
									fc659fcf2c
								
							
						
					
					
						commit
						8992cab6fe
					
				
					 1 changed files with 34 additions and 0 deletions
				
			
		|  | @ -16,6 +16,8 @@ | |||
| namespace Slic3r { | ||||
| namespace GUI { | ||||
| 
 | ||||
| NSTextField* mainframe_text_field; | ||||
| 
 | ||||
| bool mac_dark_mode() | ||||
| { | ||||
|     NSString *style = [[NSUserDefaults standardUserDefaults] stringForKey:@"AppleInterfaceStyle"]; | ||||
|  | @ -43,6 +45,16 @@ void set_miniaturizable(void * window) | |||
|     [(NSView*) window window].titlebarAppearsTransparent = true; | ||||
|     [(NSView*) window window].backgroundColor = [NSColor colorWithCalibratedRed:rFloat green:gFloat blue:bFloat alpha:1.0]; | ||||
|     [(NSView*) window window].styleMask |= NSMiniaturizableWindowMask; | ||||
| 
 | ||||
|     NSEnumerator *viewEnum = [[[[[[[(NSView*) window window] contentView] superview] titlebarViewController] view] subviews] objectEnumerator]; | ||||
|     NSView *viewObject; | ||||
| 
 | ||||
|     while(viewObject = (NSView *)[viewEnum nextObject]) { | ||||
|         if([viewObject class] == [NSTextField self]) { | ||||
|             //[(NSTextField*)viewObject setTextColor :  NSColor.whiteColor]; | ||||
|             mainframe_text_field = viewObject; | ||||
|         } | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| } | ||||
|  | @ -50,6 +62,28 @@ void set_miniaturizable(void * window) | |||
| 
 | ||||
| @end | ||||
| 
 | ||||
| /* textColor for NSTextField */ | ||||
| @implementation NSTextField (NSTextField_Extended) | ||||
| 
 | ||||
| - (void)setTextColor2:(NSColor *)textColor | ||||
| { | ||||
|     if (Slic3r::GUI::mainframe_text_field != self){ | ||||
|         [self setTextColor2: textColor]; | ||||
|     }else{ | ||||
|         [self setTextColor2 : NSColor.whiteColor]; | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| 
 | ||||
| + (void) load | ||||
| { | ||||
|     Method setTextColor = class_getInstanceMethod([NSTextField class], @selector(setTextColor:)); | ||||
|     Method setTextColor2 = class_getInstanceMethod([NSTextField class], @selector(setTextColor2:)); | ||||
|     method_exchangeImplementations(setTextColor, setTextColor2); | ||||
| } | ||||
| 
 | ||||
| @end | ||||
| 
 | ||||
| /* textColor for NSButton */ | ||||
| 
 | ||||
| @implementation NSButton (NSButton_Extended) | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 tao wang
						tao wang