PokéRogue
    Preparing search index...

    The RGB class holds a single color value expressed as normalized red, green, and blue components, each in the range 0 to 1. It is used internally by WebGL pipelines and other Phaser systems that need to track color state efficiently. Changes to any component automatically set the dirty flag and invoke an optional onChangeCallback, making it straightforward to react to color mutations without manual polling.

    Index
    • Parameters

      • Optionalred: number

        The red color value. A number between 0 and 1. Default 0.

      • Optionalgreen: number

        The green color value. A number between 0 and 1. Default 0.

      • Optionalblue: number

        The blue color value. A number between 0 and 1. Default 0.

      Returns RGB

    b: number

    The blue color value. Between 0 and 1.

    Changing this property will flag this RGB object as being dirty and invoke the onChangeCallback, if set.

    dirty: boolean

    Is this color dirty?

    g: number

    The green color value. Between 0 and 1.

    Changing this property will flag this RGB object as being dirty and invoke the onChangeCallback, if set.

    onChangeCallback: Function

    This callback will be invoked each time one of the RGB color values change.

    The callback receives the red, green, and blue values as three separate numeric arguments, each in the range 0 to 1.

    r: number

    The red color value. Between 0 and 1.

    Changing this property will flag this RGB object as being dirty and invoke the onChangeCallback, if set.

    • Destroys this RGB instance by nulling the onChangeCallback reference, releasing any external listener held by this object.

      Returns void

    • Compares the given rgb parameters with those in this object and returns a boolean true value if they are equal, otherwise it returns false.

      Parameters

      • red: number

        The red value to compare with this object.

      • green: number

        The green value to compare with this object.

      • blue: number

        The blue value to compare with this object.

      Returns boolean

      true if the given values match those in this object, otherwise false.

    • Internal on change handler. Sets this object as being dirty and then invokes the onChangeCallback, if set, passing in the new RGB values.

      Returns void

    • Sets the red, green and blue values of this RGB object, flags it as being dirty and then invokes the onChangeCallback, if set.

      Parameters

      • Optionalred: number

        The red color value. A number between 0 and 1. Default 0.

      • Optionalgreen: number

        The green color value. A number between 0 and 1. Default 0.

      • Optionalblue: number

        The blue color value. A number between 0 and 1. Default 0.

      Returns this

      This RGB instance.