Skip to main content

sc.color

The Color Module for the computer API!


Functions


random

sc.color.random( from, to )

Generates a random color from whatever range you want.

Arguments:

  • from [ number ] The starting range.
  • to [ number ] The ending range.

Returns:

  • [ Color ] The generated color.

random0to1

sc.color.random0to1()

Generates a random color from 0 to 1.

Returns:

  • [ Color ] The generated color.

newSingluar

sc.color.newSingluar( rgbNum )

Creates a new color from 1 value. Whatever rgbNum's value has will be set on R, G, and B.

This means it's grayscale only!

Arguments:

  • rgbNum [ number ] The color value that will be set on R, G, and B.

Returns:

  • [ Color ] The generated color.

generateGradient

sc.color.generateGradient( colors, numColors )

This generates an interpolated gradient between the colors provided and is dependent on the ammount of gradient specified.

Arguments:

  • colors [ Color[] ] The table of colors to generate the gradient from.
  • numColors [ integer ] The ammount of blending each color gets in the gradient table.

Returns:

  • [ Color[] ] The generated gradient table.

generateGradient

sc.color.blank()

Returns a blank (black) color

Returns:

  • [ Color[] ] The created color

mixColorsTransparency

sc.color.mixColorsTransparency( colorA, colorB )

This function mixes 2 colors based on transparancy, letting you to fake transparancy.

Arguments:

  • colorA [ Color ] The color to be mixed
  • colorB [ Color ] The color to mix.

Returns:

  • [ Color ] The new color.