Package com.github.tommyettinger.textra
Class ColorLookup.GdxColorLookup
java.lang.Object
com.github.tommyettinger.textra.ColorLookup.GdxColorLookup
- All Implemented Interfaces:
ColorLookup
- Enclosing interface:
- ColorLookup
public static class ColorLookup.GdxColorLookup extends java.lang.Object implements ColorLookup
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. All color names are ALL_CAPS in libGDX's Colors collection by default.-
Nested Class Summary
Nested classes/interfaces inherited from interface com.github.tommyettinger.textra.ColorLookup
ColorLookup.GdxColorLookup -
Field Summary
Fields Modifier and Type Field Description static ColorLookup.GdxColorLookupINSTANCEThe only way to access a GdxColorLookup.Fields inherited from interface com.github.tommyettinger.textra.ColorLookup
DESCRIPTIVE -
Method Summary
Modifier and Type Method Description intgetRgba(java.lang.String key)Useskeyto look up an RGBA8888 color, and returns that color as an int if one was found, or returns 256 if none was found.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Field Details
-
INSTANCE
The only way to access a GdxColorLookup. Since this class has no state and exists only to implement an interface, it is fine that this is static.
-
-
Method Details
-
getRgba
public int getRgba(java.lang.String key)Description copied from interface:ColorLookupUseskeyto 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.- Specified by:
getRgbain interfaceColorLookup- 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.
-