Platforms to show: All Mac Windows Linux Cross-Platform

Back to NSColorMBS class.

NSColorMBS.blendedColorWithFraction(alpha as Double, c as NSColorMBS) as NSColorMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa Drawing MBS MacBase Plugin 9.8 ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
Creates and returns an NSColor object whose component values are a weighted sum of the receiver's and the specified color object's.
Example
Var b as NSColorMBS = NSColorMBS.blueColor
Var r as NSColorMBS = NSColorMBS.redColor
Var c as NSColorMBS = b.blendedColorWithFraction(0.5, r)

MsgBox c.description

fraction: The amount of the color to blend with the receiver's color. The method converts color and a copy of the receiver to RGB, and then sets each component of the returned color to fraction of color's value plus 1 – fraction of the receiver's.
color: The color to blend with the receiver's color.

The resulting color object or nil if the colors can't be converted.

NSColorMBS.getCMYK(byref cyan as Double, byref magenta as Double, byref yellow as Double, byref black as Double)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa Drawing MBS MacBase Plugin 9.8 ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
Returns the receiver's CMYK and opacity values.
Example
Var co as NSColorMBS = NSColorMBS.colorWithDeviceCMYK(1.0, 0.5, 1.0, 0.8)
Var c,m,y,k as Double

co.getCMYK(c,m,y,k)

MsgBox str(c)+" "+str(m)+" "+str(y)+" "+str(k)

cyan: Upon return, contains the cyan component of the color object.
magenta: Upon return, contains the magenta component of the color object.
yellow: Upon return, contains the yellow component of the color object.
black: Upon return, contains the black component of the color object.
alpha: Upon return, contains opacity value of the color object. (optionally)

This method works only with objects representing colors in the NSDeviceCMYKColorSpace. Sending it to other objects raises an exception.

See also:

NSColorMBS.getCMYK(byref cyan as Double, byref magenta as Double, byref yellow as Double, byref black as Double, byref alpha as Double)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa Drawing MBS MacBase Plugin 9.8 ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
Returns the receiver's CMYK and opacity values.
Example
Var co as NSColorMBS = NSColorMBS.colorWithDeviceCMYK(1.0, 0.5, 1.0, 0.8, 0.4)
Var c,m,y,k,a as Double

co.getCMYK(c,m,y,k,a)

MsgBox str(c)+" "+str(m)+" "+str(y)+" "+str(k)+" "+str(a)

cyan: Upon return, contains the cyan component of the color object.
magenta: Upon return, contains the magenta component of the color object.
yellow: Upon return, contains the yellow component of the color object.
black: Upon return, contains the black component of the color object.
alpha: Upon return, contains opacity value of the color object. (optionally)

This method works only with objects representing colors in the NSDeviceCMYKColorSpace. Sending it to other objects raises an exception.

See also:

NSColorMBS.getHSV(byref hue as Double, byref saturation as Double, byref brightness as Double)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa Drawing MBS MacBase Plugin 9.8 ✅ Yes ❌ No ❌ No ✅ Yes All
Returns the receiver's HSB component and opacity values in the respective arguments.
Example
Var c as NSColorMBS = NSColorMBS.colorWithCalibratedHSV(1.0, 0.5, 1.0, 0.4)
Var h,s,v,a as Double

c.getHSV(h,s,v,a)

MsgBox str(h)+" "+str(s)+" "+str(v)+" "+str(a)

hue: Upon return, contains the hue component of the color object.
saturation: Upon return, contains the saturation component of the color object.
brightness: Upon return, contains the brightness component of the color object.
alpha: Upon return, contains the opacity value of the color object. (optionally)

This method works only with objects representing colors in the NSCalibratedRGBColorSpace or NSDeviceRGBColorSpace color space. Sending it to other objects raises an exception.

See also:

NSColorMBS.getHSV(byref hue as Double, byref saturation as Double, byref brightness as Double, byref alpha as Double)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa Drawing MBS MacBase Plugin 9.8 ✅ Yes ❌ No ❌ No ✅ Yes All
Returns the receiver's HSB component and opacity values in the respective arguments.

hue: Upon return, contains the hue component of the color object.
saturation: Upon return, contains the saturation component of the color object.
brightness: Upon return, contains the brightness component of the color object.
alpha: Upon return, contains the opacity value of the color object. (optionally)

This method works only with objects representing colors in the NSCalibratedRGBColorSpace or NSDeviceRGBColorSpace color space. Sending it to other objects raises an exception.

See also:

NSColorMBS.getRGB(byref red as Double, byref green as Double, byref blue as Double)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa Drawing MBS MacBase Plugin 9.8 ✅ Yes ❌ No ❌ No ✅ Yes All
Returns the receiver's RGB component and opacity values in the respective arguments.
Example
Var c as NSColorMBS = NSColorMBS.blueColor
Var r,g,b as Double

c.getRGB(r,g,b)

MsgBox str(r)+" "+str(g)+" "+str(b) // shows "0 0 1"

red: Upon return, contains the red component of the color object.
green: Upon return, contains the green component of the color object.
blue: Upon return, contains the blue component of the color object.
alpha: Upon return, contains the opacity value of the color object. (optionally)

This method works only with objects representing colors in the NSCalibratedRGBColorSpace or NSDeviceRGBColorSpace color space. Sending it to other objects raises an exception.

Plugin converts color to calibrated RGB if needed.

See also:

NSColorMBS.getRGB(byref red as Double, byref green as Double, byref blue as Double, byref alpha as Double)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa Drawing MBS MacBase Plugin 9.8 ✅ Yes ❌ No ❌ No ✅ Yes All
Returns the receiver's RGB component and opacity values in the respective arguments.
Example
Var c as NSColorMBS = NSColorMBS.blueColor
Var r,g,b,a as Double

c.getRGB(r,g,b,a)

MsgBox str(r)+" "+str(g)+" "+str(b)+" "+str(a) // shows "0 0 1 1"

red: Upon return, contains the red component of the color object.
green: Upon return, contains the green component of the color object.
blue: Upon return, contains the blue component of the color object.
alpha: Upon return, contains the opacity value of the color object. (optionally)

This method works only with objects representing colors in the NSCalibratedRGBColorSpace or NSDeviceRGBColorSpace color space. Sending it to other objects raises an exception.

Plugin converts color to calibrated RGB if needed.

See also:

NSColorMBS.getWhite(byref white as Double)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa Drawing MBS MacBase Plugin 9.8 ✅ Yes ❌ No ❌ No ✅ Yes All
Returns the receiver's grayscale value and alpha values.
Example
Var c as NSColorMBS = NSColorMBS.colorWithDeviceWhite(1.0, 1.0)
Var w as Double

c.getWhite(w)

MsgBox str(w)

white: Upon return, contains the grayscale value of the color object.
alpha: Upon return, contains the opacity value of the color object. (optionally)

This method works only with objects representing colors in the NSCalibratedWhiteColorSpace, NSCalibratedBlackColorSpace, NSDeviceBlackColorSpace, or NSDeviceWhiteColorSpace color space. Sending it to other objects raises an exception.

See also:

NSColorMBS.getWhite(byref white as Double, byref alpha as Double)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa Drawing MBS MacBase Plugin 9.8 ✅ Yes ❌ No ❌ No ✅ Yes All
Returns the receiver's grayscale value and alpha values.
Example
Var c as NSColorMBS = NSColorMBS.colorWithDeviceWhite(1.0, 1.0)
Var w,a as Double

c.getWhite(w,a)

MsgBox str(w)+" "+str(a)

white: Upon return, contains the grayscale value of the color object.
alpha: Upon return, contains the opacity value of the color object. (optionally)

This method works only with objects representing colors in the NSCalibratedWhiteColorSpace, NSCalibratedBlackColorSpace, NSDeviceBlackColorSpace, or NSDeviceWhiteColorSpace color space. Sending it to other objects raises an exception.

See also:

NSColorMBS.highlightWithLevel(level as Double) as NSColorMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa Drawing MBS MacBase Plugin 9.8 ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
Returns an NSColor object that represents a blend between the receiver and the highlight color returned by highlightColor.
Example
Var c as NSColorMBS = NSColorMBS.blueColor
Var h as NSColorMBS = c.highlightWithLevel(0.5)
MsgBox h.description

level: The amount of the highlight color that is blended with the receiver's color. This should be a number from 0.0 through 1.0. A highlightLevel below 0.0 is interpreted as 0.0; a highlightLevel above 1.0 is interpreted as 1.0.

Returns the new NSColor object. Returns nil if the colors can't be converted.

Invoke this method when you want to brighten the receiving NSColor for use in highlights.

NSColorMBS.patternImage as Variant

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa Drawing MBS MacBase Plugin 9.8 ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
Returns the image that the receiver is using as a pattern.
Example
Var p as Picture = LogoMBS(100)
Var n as new NSImageMBS(p)
Var c as NSColorMBS = NSColorMBS.colorWithPatternImage(n)
Var x as NSImageMBS = c.patternImage

Backdrop=x.CopyPictureWithMask

The image used by the color object. If the receiver doesn't have an image, this method raises an exception.

Declared a variant instead of NSImageMBS to reduce plugin dependencies.

NSColorMBS.shadowWithLevel(level as Double) as NSColorMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa Drawing MBS MacBase Plugin 9.8 ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
Returns an NSColor object that represents a blend between the receiver and the shadow color returned by shadowColor.
Example
Var c as NSColorMBS = NSColorMBS.blueColor
Var h as NSColorMBS = c.shadowWithLevel(0.5)
MsgBox h.description

level: The amount of the shadow color used for the blend. This should be a number from 0.0 through 1.0. A shadowLevel below 0.0 is interpreted as 0.0; a shadowLevel above 1.0 is interpreted as 1.0.

Returns the new NSColor object. Returns nil if the colors can't be converted.

Invoke this method when you want to darken the receiving NSColor for use in shadows.

NSColorMBS.writeToPasteboard

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa Drawing MBS MacBase Plugin 9.8 ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
Writes the receiver's data to the specified pasteboard.

The items on this page are in the following plugins: MBS MacBase Plugin.


The biggest plugin in space...