Contents

withAlphaComponent(_:)

Creates a new color object that has the same color space and component values as the current color object, but the specified alpha component.

Declaration

func withAlphaComponent(_ alpha: CGFloat) -> NSColor

Parameters

  • alpha:

    The opacity value of the new NSColor object.

Return Value

The new NSColor object. If the receiver’s color space doesn’t include an alpha component, the receiver is returned.

Discussion

A subclass with explicit opacity components should override this method to return a color with the specified alpha.

See Also

Related Documentation

Transforming existing color objects