NSColor
public extension NSColor
-
Create an
NSColor
from aMaterialColor
let view = NSView() view.backgroundColor = NSColor(material: .red100)
Declaration
Swift
convenience init(material color: MaterialColor, alpha: CGFloat = 1.0)
Parameters
color
The
MaterialColor
alpha
The alpha value of the color. Optional.
Return Value
The
NSColor
-
Create an
NSColor
from aMaterialColor
let view = NSView() view.backgroundColor = .material(.red100)
Declaration
Swift
static func material(_ color: MaterialColor, alpha: CGFloat = 1.0) -> NSColor
Parameters
color
The
MaterialColor
alpha
The alpha value of the color. Optional.
Return Value
The
NSColor
-
The color as a
MaterialColor
, or nil if the color cannot be represented as aMaterialColor
Declaration
Swift
var asMaterialColor: MaterialColor? { get }