Mac Developer Library

Developer

AppKit Framework Reference NSColorWell Class Reference

Options
Deployment Target:

On This Page
Language:

NSColorWell

An NSColorWell object is an NSControl for selecting and displaying a single color value. An example of an NSColorWell object (or simply color well) is found in an NSColorPanel, which uses a color well to display the current color selection. A color well is available from the Palettes panel of Interface Builder.

Import Statement


Swift

import AppKit

Objective-C

@import AppKit;

Availability


Available in OS X v10.0 and later.
  • color color Property

    The color of the receiver.

    Declaration

    Swift

    @NSCopying var color: NSColor

    Objective-C

    @property(copy) NSColor *color

    Discussion

    Setting the color also redraws the receiver.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Changes the color of the receiver to that of the specified object.

    Declaration

    Swift

    func takeColorFrom(_ sender: AnyObject?)

    Objective-C

    - (void)takeColorFrom:(id)sender

    Parameters

    sender

    The object from which to take the new color.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.0 and later.

    See Also

    color

  • Activates the receiver, displays the color panel, and makes the current color the same as its own.

    Declaration

    Swift

    func activate(_ exclusive: Bool)

    Objective-C

    - (void)activate:(BOOL)exclusive

    Parameters

    exclusive

    YEStrue to deactivate any other color wells; NOfalse to keep them active. If a color panel is active with exclusive set to YEStrue and another is subsequently activated with exclusive set to NOfalse, the exclusive setting of the first panel is ignored.

    Discussion

    This method redraws the receiver. An active color well will have its color updated when the current color of the NSColorPanel changes. Any color well that shows its border highlights the border when it’s active.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • active active Property

    A Boolean value that determines whether the color well is active.

    Declaration

    Swift

    var active: Bool { get }

    Objective-C

    @property(getter=isActive, readonly) BOOL active

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.10 and later.

  • Deactivates the receiver and redraws it.

    Declaration

    Swift

    func deactivate()

    Objective-C

    - (void)deactivate

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • bordered bordered Property

    A Boolean value that determines whether the receiver has a border.

    Declaration

    Swift

    var bordered: Bool

    Objective-C

    @property(getter=isBordered) BOOL bordered

    Discussion

    If YEStrue, the receiver is bordered, NOfalse otherwise (the default value of this property is YEStrue). Setting or removing the border on a receiver also redraws the receiver. Note that a borderless color well doesn’t display the Colors window when users click it.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.10 and later.

  • Draws the colored area inside the receiver at the specified location without drawing borders.

    Declaration

    Swift

    func drawWellInside(_ insideRect: NSRect)

    Objective-C

    - (void)drawWellInside:(NSRect)insideRect

    Parameters

    insideRect

    The rectangle specifying the area within which to draw.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.0 and later.