Revision: 12606 http://sourceforge.net/p/skim-app/code/12606 Author: hofman Date: 2021-12-08 10:25:56 +0000 (Wed, 08 Dec 2021) Log Message: ----------- Allow passing some standard colors as strings, as JXA is not able to properly handle constants
Modified Paths: -------------- trunk/NSColor_SKExtensions.m Modified: trunk/NSColor_SKExtensions.m =================================================================== --- trunk/NSColor_SKExtensions.m 2021-12-04 18:58:12 UTC (rev 12605) +++ trunk/NSColor_SKExtensions.m 2021-12-08 10:25:56 UTC (rev 12606) @@ -190,6 +190,7 @@ #pragma mark Scripting + (id)scriptingRgbaColorWithDescriptor:(NSAppleEventDescriptor *)descriptor { + NSLog(@"%@",descriptor); if ([descriptor descriptorType] == typeAEList) { CGFloat red = 0.0, green = 0.0, blue = 0.0, alpha = 0.0; if ([descriptor numberOfItems] > 0) @@ -249,6 +250,16 @@ // Cocoa Scripting defines coercions from string to color for some standard color names NSColor *color = string ? [[NSScriptCoercionHandler sharedCoercionHandler] coerceValue:string toClass:[NSColor class]] : nil; // We should check the return value, because NSScriptCoercionHandler returns the input when it fails rather than nil, stupid + if ([color isKindOfClass:[NSString class]]) { + if ([string isEqualToString:@"under page background"]) + color = [NSColor underPageBackgroundColor]; + else if ([string isEqualToString:@"window background"]) + color = [NSColor windowBackgroundColor]; + else if ([string isEqualToString:@"control background"]) + color = [NSColor controlBackgroundColor]; + else + color = nil; + } return [color isKindOfClass:[NSColor class]] ? color : nil; } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. _______________________________________________ Skim-app-commit mailing list Skim-app-commit@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/skim-app-commit