BUTTON COLOR

This tutorial is specific to our newest product, Hudl Sportscode. If you’re on Sportscode v11, use these resources instead or upgrade today.

This script changes the background color of a button.


FORMAT: BUTTON COLOR ( red_color , green_color , blue_color ) or BUTTON COLOR ( red_color , green_color , blue_color ) or BUTTON COLOR button_name


DEFINITIONS:

  • button_name: A string with the name of a button in the code input window.
  • color: A red, green or blue color value 0->100 (RGB color code in percent).
  • alpha: Color alpha with a value 0->100.

You can use this website to see the color codes in percentage.


EXAMPLE 1:

BUTTON COLOR (100,0,0)

Changes the background color of the current button to red.

EXAMPLE 2:

BUTTON COLOR "legend"

Changes the background color of the current button to that from the button named "legend" in the same window.

EXAMPLE 3:

$miss = count "Miss where row = "SHOT"
$made = count "Made" where row = "SHOT"
IF ( $miss > $made, button color (100,0,0), button color (0,100,0))

Obtains the number of instances in the row "SHOT" that contain the label "Miss" and uses it in the variable $miss. Does the same thing for the variable $made, but with the label "Made". If the result of $miss is higher than the result of $made, then the background color of the current button will be red, otherwise it will be green.