macOS UI颜色
NSButton
if (@available(macOS 10.14, *)) { _btnLeadershipRisingPlate.contentTintColor = NSColorFromName(@"g-appColor"); } else { NSMutableAttributedString *attrTitle = [[NSMutableAttributedString alloc] initWithAttributedString:[_btnLeadershipRisingPlate attributedTitle]]; [attrTitle addAttribute:NSForegroundColorAttributeName value:NSColorFromName(@"g-appColor") range:NSMakeRange(0, attrTitle.length)]; [attrTitle fixAttributesInRange:NSMakeRange(0, attrTitle.length)]; [_btnLeadershipRisingPlate setAttributedTitle:attrTitle]; }//设置文字颜色 // _btnUpdate.contentTintColor = NSColorFromRGB(0x308fff);//设置文字颜色[NSColor colorWithCalibratedRed:((float)r/255.0) green:((float)g/255.0) blue:((float)b/255.0) alpha:1.0]
self.view.layer.backgroundColor = [NSColor systemBlueColor].CGColor;
_MajorIndices_collectionView.layer.backgroundColor = NSColor.blueColor.CGColor;
///RGBA方式
#define NSColorFromRGBA(rgbValue, alphaValue)
NSColorFromRGBA(0xffffff, 0.1)
[_view3 setBackgroundColor:NSColorFromRGBA(0xffffff, 0.1)];