Class Colors


  • public final class Colors
    extends java.lang.Object
    Color constants and helper methods for the Starpoints game. Colors in Starpoint Arena are represented by an int-value calculated by the formula (opacity * 16777216 + red * 65536 + green * 256 + blue), with a value of 0-255 for each color and opacity.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static int black
      Black color.
      static int blue
      Blue color.
      static int[] blueColors
      The blue colors.
      static int blueswirling
      Placeholder for a random color.
      static int brown
      Yellow color.
      static int cyan
      Cyan color.
      static int darkblue
      Dark blue color.
      static int darkgray
      Dark gray color.
      static int darkgreen
      Dark green color.
      static int darkred
      Dark red color.
      static int glass
      Glass color.
      static int glass0
      Glass colors. glass0 is equal to glass.
      static int glass1  
      static int glass2  
      static int glass3  
      static int[] glassColors
      Glass colors for splintering.
      static int gray
      Gray color.
      static int green
      Green color.
      static int lava
      Lava color.
      static int lightblue
      Light blue color.
      static int lightgray
      Light gray color.
      static int lightgreen
      Light green color.
      static int lightred
      Light red color.
      static int magenta
      Magenta color.
      static int MAX_GLASSINDEX
      Maximum glass index.
      static int none
      Placeholder for no color.
      static int orange
      Orange color.
      static int pink
      Pink color.
      static int random
      Placeholder for a random color.
      static int red
      Red color.
      static int swirling
      Placeholder for a random color.
      static int verydarkblue
      Darker blue color.
      static int white
      White color.
      static int yellow
      Yellow color.
    • Constructor Summary

      Constructors 
      Constructor Description
      Colors()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static int brighter​(int color)
      Gets a brighter version of a color (adding 20% to every color value, or setting it to 40, if 0 in the original color).
      static int darker​(int color)
      Gets a darker version of a color (reducing every color value by 20%).
      static int getBlue​(int color)
      Gets the blue value of the color representation
      static int getColor​(int r, int g, int b)
      Gets the int representation for the rgb values
      static int getColor​(int r, int g, int b, int o)
      Gets the int representation for the rgb values
      static int getColorFromInputString​(java.lang.String s)
      Returns the color for the given string.
      static int getGlassColorIndex​(int color)
      Returns the splinter index if color is a glass color. 0 for undamaged glass, 3 is last index before disappearing.
      static int getGreen​(int color)
      Gets the green value of the color representation
      static int getLighterBlueColor​(int color)
      Returns the lighter blue color.
      static int getOpacity​(int color)
      Gets the opacity value of the color representation
      static int getRandomBlueColor()
      Returns a random blue color.
      static int getRed​(int color)
      Gets the red value of the color representation
      static java.lang.String getStringForColor​(int color)
      Gets a string for the given color.
      static boolean isBlueColor​(int c)
      Checks, if the color is a blue color.
      static int makeTransparent​(int color, int opacity)
      Creates a transparent version of the color.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • white

        public static final int white
        White color.
      • black

        public static final int black
        Black color.
      • green

        public static final int green
        Green color.
      • gray

        public static final int gray
        Gray color.
      • lightgray

        public static final int lightgray
        Light gray color.
      • darkgray

        public static final int darkgray
        Dark gray color.
      • red

        public static final int red
        Red color.
      • blue

        public static final int blue
        Blue color.
      • yellow

        public static final int yellow
        Yellow color.
      • brown

        public static final int brown
        Yellow color.
      • magenta

        public static final int magenta
        Magenta color.
      • cyan

        public static final int cyan
        Cyan color.
      • darkblue

        public static final int darkblue
        Dark blue color.
      • verydarkblue

        public static final int verydarkblue
        Darker blue color.
      • darkred

        public static final int darkred
        Dark red color.
      • darkgreen

        public static final int darkgreen
        Dark green color.
      • lightblue

        public static final int lightblue
        Light blue color.
      • lightred

        public static final int lightred
        Light red color.
      • lightgreen

        public static final int lightgreen
        Light green color.
      • orange

        public static final int orange
        Orange color.
      • pink

        public static final int pink
        Pink color.
      • lava

        public static final int lava
        Lava color.
      • glass

        public static final int glass
        Glass color.
      • glass0

        public static final int glass0
        Glass colors. glass0 is equal to glass.
      • glass1

        public static final int glass1
      • glass2

        public static final int glass2
      • glass3

        public static final int glass3
      • glassColors

        public static final int[] glassColors
        Glass colors for splintering.
      • MAX_GLASSINDEX

        public static final int MAX_GLASSINDEX
        Maximum glass index.
      • random

        public static final int random
        Placeholder for a random color.
      • swirling

        public static final int swirling
        Placeholder for a random color.
      • blueswirling

        public static final int blueswirling
        Placeholder for a random color.
      • none

        public static final int none
        Placeholder for no color.
      • blueColors

        public static final int[] blueColors
        The blue colors.
    • Constructor Detail

      • Colors

        public Colors()
    • Method Detail

      • getColor

        public static int getColor​(int r,
                                   int g,
                                   int b,
                                   int o)
        Gets the int representation for the rgb values
        Parameters:
        r - The red byte.
        g - The green byte.
        b - The blue byte.
        o - The opacity.
        Returns:
        The int representation
      • getColor

        public static int getColor​(int r,
                                   int g,
                                   int b)
        Gets the int representation for the rgb values
        Parameters:
        r - The red byte.
        g - The green byte.
        b - The blue byte.
        Returns:
        The int representation.
      • getOpacity

        public static int getOpacity​(int color)
        Gets the opacity value of the color representation
        Parameters:
        color - The color.
        Returns:
        the opacity value [0-255].
      • getGreen

        public static int getGreen​(int color)
        Gets the green value of the color representation
        Parameters:
        color - The color.
        Returns:
        the green value [0-255].
      • getRed

        public static int getRed​(int color)
        Gets the red value of the color representation
        Parameters:
        color - The color.
        Returns:
        the red value [0-255].
      • getBlue

        public static int getBlue​(int color)
        Gets the blue value of the color representation
        Parameters:
        color - the color.
        Returns:
        the blue value [0-255]
      • darker

        public static int darker​(int color)
        Gets a darker version of a color (reducing every color value by 20%).
        Parameters:
        color - The color.
        Returns:
        The darker color.
      • brighter

        public static int brighter​(int color)
        Gets a brighter version of a color (adding 20% to every color value, or setting it to 40, if 0 in the original color).
        Parameters:
        color - The color.
        Returns:
        The brighter color.
      • makeTransparent

        public static int makeTransparent​(int color,
                                          int opacity)
        Creates a transparent version of the color.
        Parameters:
        color - The color.
        opacity - The opacity of the desired color (0: transparent, 255: opaque).
        Returns:
        The transparent version of the color.
      • getStringForColor

        public static java.lang.String getStringForColor​(int color)
        Gets a string for the given color.
        Parameters:
        color - The color.
        Returns:
        The color name (equal to the constants name).
      • getColorFromInputString

        public static int getColorFromInputString​(java.lang.String s)
        Returns the color for the given string.
        Parameters:
        s - The color name.
        Returns:
        The color.
      • isBlueColor

        public static boolean isBlueColor​(int c)
        Checks, if the color is a blue color.
        Parameters:
        c - The color to check.
        Returns:
        true, if the point is blue, lightBlue, darkBlue or veryDarkBlue.
      • getLighterBlueColor

        public static int getLighterBlueColor​(int color)
        Returns the lighter blue color.
        Parameters:
        color - The blue color.
        Returns:
        The next lighter blue color if color is a blue color, or lightgray otherwise or for lightBlue.
      • getGlassColorIndex

        public static int getGlassColorIndex​(int color)
        Returns the splinter index if color is a glass color. 0 for undamaged glass, 3 is last index before disappearing.
        Parameters:
        color - The color to check
        Returns:
        The splinter index if color is a glass color or -1 for any non-glass color.
      • getRandomBlueColor

        public static int getRandomBlueColor()
        Returns a random blue color. Used for blue swirling effect in points.
        Returns:
        The random blue color. Possible return colors are: Colors.lightBlue, Colors.blue, Colors.darkBlue, Colors.veryDarkBlue