Instance Method

withSystemEffect(_:)

Returns a new color object that represents the current color modified to include the specified visual effect.

Declaration

func withSystemEffect(_ systemEffect: NSColor.SystemEffect) -> NSColor

Parameters

systemEffect

The visual effect you want to apply to a view or control.

Discussion

Instead of defining separate colors for user interactions with a view, use this method to retrieve the appropriate color for use with those interactions. This method blends the current color with an appropriate modifier and returns the results. For example, specifying NSColor.SystemEffect.pressed for the systemEffect parameter yields the color to use when you want your view to appear as if it had been pressed. This method takes the current appearance into account, returning an appropriately modified color for both light and dark appearances.

See Also

Applying a Specific Appearance to a Color

enum NSColor.SystemEffect

Constants for user interactions that change the appearance of a view or control.