Class Colors

java.lang.Object
tripleplay.util.Colors

public class Colors extends Object
Utilities and constants for colors.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    Named versions of commonly used colors.
    static final int
    Named versions of commonly used colors.
    static final int
    Named versions of commonly used colors.
    static final int
    Named versions of commonly used colors.
    static final int
    Named versions of commonly used colors.
    static final int
    Named versions of commonly used colors.
    static final int
    Named versions of commonly used colors.
    static final int
    Named versions of commonly used colors.
    static final int
    Named versions of commonly used colors.
    static final int
    Named versions of commonly used colors.
    static final int
    Named versions of commonly used colors.
    static final int
    Named versions of commonly used colors.
    static final int
    Named versions of commonly used colors.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static int
    blend(int c1, int c2)
    Blends two colors.
    static int
    blend(int c1, int c2, float p1)
    Blends two colors proportionally.
    static int
    brighter(int color)
    Creates a new brightened version of the given color.
    static int
    darker(int color)
    Creates a new darkened version of the given color with the default DARK_FACTOR.
    static int
    darker(int color, float darkFactor)
    Creates a new darkened version of the given color.

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • WHITE

      public static final int WHITE
      Named versions of commonly used colors.
    • LIGHT_GRAY

      public static final int LIGHT_GRAY
      Named versions of commonly used colors.
    • GRAY

      public static final int GRAY
      Named versions of commonly used colors.
    • DARK_GRAY

      public static final int DARK_GRAY
      Named versions of commonly used colors.
    • BLACK

      public static final int BLACK
      Named versions of commonly used colors.
    • RED

      public static final int RED
      Named versions of commonly used colors.
    • PINK

      public static final int PINK
      Named versions of commonly used colors.
    • ORANGE

      public static final int ORANGE
      Named versions of commonly used colors.
    • YELLOW

      public static final int YELLOW
      Named versions of commonly used colors.
    • GREEN

      public static final int GREEN
      Named versions of commonly used colors.
    • MAGENTA

      public static final int MAGENTA
      Named versions of commonly used colors.
    • CYAN

      public static final int CYAN
      Named versions of commonly used colors.
    • BLUE

      public static final int BLUE
      Named versions of commonly used colors.
  • Constructor Details

    • Colors

      public Colors()
  • Method Details

    • blend

      public static int blend(int c1, int c2)
      Blends two colors.
      Returns:
      a color halfway between the two colors.
    • blend

      public static int blend(int c1, int c2, float p1)
      Blends two colors proportionally.
      Parameters:
      p1 - The percentage of the first color to use, from 0.0f to 1.0f inclusive.
    • darker

      public static int darker(int color, float darkFactor)
      Creates a new darkened version of the given color. This is implemented by composing a new color consisting of the components of the original color, each multiplied by the dark factor. The alpha channel is copied from the original.
    • darker

      public static int darker(int color)
      Creates a new darkened version of the given color with the default DARK_FACTOR.
    • brighter

      public static int brighter(int color)
      Creates a new brightened version of the given color. This is implemented by composing a new color consisting of the components of the original color, each multiplied by 10/7, with exceptions for zero-valued components. The alpha channel is copied from the original.