Color

Color plays an important role in FTC. It is often used to recognize and track objects, follow a line. The blocks in this section allow you to get information from objects and convert into different color models.

call Color.rgbToHue

Returns the hue component of the color with the given red, green, and blue values.

call Color.rgbToSaturation

Returns the saturation component of the color with the given red, green, and blue values.

call Color.rgbToValue

Returns a single value for the color with the given red, green, and blue values.

call Color.rgbToText

Returns the color in text format “#AARRGGBB” or “#RRGGBB”.

call Color.showColor

Shows the color on the Robot Controller screen.

Color.Red

Returns the red component of the given color object. The returned value ranges from 0 to 255.

Color.Green

Returns the green component of the given color object. The returned value ranges from 0 to 255.

Color.Blue

Returns the blue component of the given color object. The returned value ranges from 0 to 255.

Color.Alpha

Returns the alpha component of the given color object. The returned value ranges from 0 to 255.

Color.Hue

Returns the hue component of the given color object. The returned value ranges from 0 to 255.

Color.Saturation

Returns the saturation component of the given color object. The returned value ranges from 0 to 255.

Color.Value

Returns the value of the given color object. The returned value is a 32-bit integer value that represents a color using the ARGB (Alpha, Red, Green, Blue) color model. Each of the four components (A, R, G, B) is allocated 8 bits, resulting in a total of 32 bits.

call Color.rgbToColor

Returns a new color object using the given values for red, green, and blue.

call Color.argbToColor

Returns a new color object using the given values of alpha, red, green, and blue.

call Color.hsvToColor

Returns a new color object using the given values of alpha, hue, saturation, and value.

call Color.hsvToColor

Returns a new color object using the given values of hue, saturation, and value

call Color.textToColor

Returns a new color object using the given text value assuming it has the format of “#RRGGBB” or “#AARRGGBB”.

NormalizedColors.Red

Returns the red value of the given normalized Color object. The value ranges from 0 to 1.

NormalizedColors.Green

Returns the green value of the given normalized Color object. The value ranges from 0 to 1.

NormalizedColors.Blue

Returns the blue value of the given normalized Color object. The value ranges from 0 to 1.

NormalizedColors.Alpha

Returns the alpha value of the given normalized Color object. The value ranges from 0 to 1.

NormalizedColors.Color

Returns the Android color integer representation of the normalized color. The returned value is a 32-bit integer value that represents a color using the ARGB (Alpha, Red, Green, Blue) color model. Each of the four components (A, R, G, B) is allocated 8 bits, resulting in a total of 32 bits.