Interface ColorLookup

All Known Implementing Classes:
ColorLookup.GdxColorLookup

public interface ColorLookup
Allows looking up an RGBA8888 int color given a String key, returning either the color or 256 if none was found. This is an extension point for games and libraries that may want their own way of looking up colors.
You can see how this is used in SquidSquad, which uses it in its squidglyph module to look up colors by potentially complex descriptive terms.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static class 
    The default ColorLookup, this simply looks up key in Colors, returning 256 (fully transparent, extremely dark blue) if no Color exists by that exact name (case-sensitive), or returning the RGBA8888 value of the color otherwise.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    Uses key to look up an RGBA8888 color, and returns that color as an int if one was found, or returns 256 if none was found.
  • Method Details

    • getRgba

      int getRgba(String key)
      Uses key to look up an RGBA8888 color, and returns that color as an int if one was found, or returns 256 if none was found. 256 is used because it is different from the more commonly-used 0 for fully-transparent, while still being easy to remember and very rare to ever want (it is fully transparent, very dark blue). This library will never call this method with a null key, and in most cases you can safely assume key is non-null.
      Parameters:
      key - the String key to use to look up or build a color; should not be null.
      Returns:
      an RGBA8888 color; if 256, this can be considered to not know how to look up the given key.