jPaq Docs - Color Class

Quick Stats

Target Platforms:  PC (JScript) and the web (JavaScript)
Download Count:  972

Summary

The class to create colors and modify them in various ways.

Documentation for Children

  • Color()
    Creates mutable 24-bit color object.
  • Color.prototype.b()
    Gets or sets the amount of blue in the color.
  • Color.prototype.combine()
    Merges this color the the specified color.
  • Color.prototype.g()
    Gets or sets the amount of green in the color.
  • Color.prototype.getDarker()
    Gets a darker version of this color by mixing it with white.
  • Color.prototype.getHexCode()
    Gives the six digit hexadecimal code for the color that this object represents.
  • Color.prototype.getLighter()
    Gets a lighter version of this color by mixing it with white.
  • Color.prototype.getLuminance()
    Gets the luminance of the color.
  • Color.prototype.getOpposite()
    Gets the opposite color.
  • Color.prototype.getSafeColor()
    Produces a new color object representing black or white. If this color is closer to white, black will be returned. If this color is closer to black, white will be returned.
  • Color.prototype.r()
    Gets or sets the amount of red in the color.
  • Color.prototype.setTo()
    Creates mutable 24-bit color object.
  • Color.prototype.toGrayscale()
    Gets an approximation of the grayscale version of the color.
  • Color.prototype.toString()
    Gives the six digit hexadecimal code for the color that this object represents. This function is an alias of getHexCode().
  • Color.random()
    Produces a random color based on the specified criteria. Each of the parameters may be a number or an array of numbers. To specify a specific value, the numeric value must be in an array by itself. To specify a range, the values must be given in an array where the first element is the minimum value and the second element is the maximum value. To produce an independently random value, 0 or null should be specified. To produce a random value that must be greater than one or both of the other two non-zero parameters, you must enter a larger number. To produce a random value that is smaller than one or both of the other two non-zero parameters, you must enter a smaller number.