Basics

Guides

API Reference

Menu

Basics

Guides

API Reference

class: Color

[12:7] extends: FxObj

Wraps JavaFX Color, an immutable representation of a color in the sRGB color space. Colors are used for fills, strokes, backgrounds, and text throughout JavaFX. This class provides factory methods to create a color from a web hex string or from individual red, green, and blue channel values, each with an optional alpha transparency value.

Methods

  • Color (string Val = null, double Alpha = 1.0)

    Creates a new Color object with the provied optional hex string and alpha double values.

    • @p Val is an optional string with the web hex value to set. (ex. #ffffff)
    • @p Alpha is an optional double between 0 and 1 with the alpha value.
    • @r this object
  • web (string Val, double Alpha = 1.0)

    Set the color value ith the provied hex string and optional alpha double values.

    • @p Val is an optional string with the web hex value to set. (ex. #ffffff)
    • @p Alpha is an optional double between 0 and 1 with the alpha value.
    • @r this object
  • rgb (double Red, double Blue, double Green)

    Set the color value ith the provied red blue green values.

    • @p Red is a double with the red part. (0.0-255.0)
    • @p Blue is a double with the blue part. (0.0-255.0)
    • @p Green is a double with the green part. (0.0-255.0)
    • @r this object
  • getRed ()

    Returns the red channel value in the range 0.0 to 1.0.

    • @r A double with the red channel.
  • getGreen ()

    Returns the green channel value in the range 0.0 to 1.0.

    • @r A double with the green channel.
  • getBlue ()

    Returns the blue channel value in the range 0.0 to 1.0.

    • @r A double with the blue channel.
  • getOpacity ()

    Returns the opacity value in the range 0.0 to 1.0.

    • @r A double with the opacity.
  • isOpaque ()

    Returns true when opacity is 1.0.

    • @r A bool.
  • getHue ()

    Returns the hue component in HSB color space, in degrees.

    • @r A double with the hue.
  • getSaturation ()

    Returns the saturation component in HSB color space (0.0 to 1.0).

    • @r A double with the saturation.
  • getBrightness ()

    Returns the brightness component in HSB color space (0.0 to 1.0).

    • @r A double with the brightness.
  • brighter ()

    Returns a brighter copy of this color.

    • @r An AJO around a new javafx.scene.paint.Color.
  • darker ()

    Returns a darker copy of this color.

    • @r An AJO around a new javafx.scene.paint.Color.
  • saturate ()

    Returns a more saturated copy of this color.

    • @r An AJO around a new javafx.scene.paint.Color.
  • desaturate ()

    Returns a less saturated copy of this color.

    • @r An AJO around a new javafx.scene.paint.Color.
  • grayscale ()

    Returns a grayscale copy of this color using the luminance formula.

    • @r An AJO around a new javafx.scene.paint.Color.
  • invert ()

    Returns the inverted copy of this color (channels subtracted from 1.0).

    • @r An AJO around a new javafx.scene.paint.Color.
  • deriveColor (double HueShift, double SaturationFactor, double BrightnessFactor, double OpacityFactor)

    Returns a new Color derived from this one by adding the given offsets to hue, saturation, brightness, and opacity.

    • @p HueShift is a double with the hue offset in degrees.
    • @p SaturationFactor is a double with the saturation multiplier.
    • @p BrightnessFactor is a double with the brightness multiplier.
    • @p OpacityFactor is a double with the opacity multiplier.
    • @r An AJO around a new javafx.scene.paint.Color.
  • interpolate (Other, double T)

    Returns a Color linearly interpolated between this color and Other.

    • @p Other is a Color wrapper or an AJO around a javafx.scene.paint.Color.
    • @p T is a double in the range 0.0 to 1.0 with the interpolation factor.
    • @r An AJO around a new javafx.scene.paint.Color.