Package org.jivesoftware.smackx.colors
Class ConsistentColor
java.lang.Object
org.jivesoftware.smackx.colors.ConsistentColor
Smack API for Consistent Color Generation (XEP-0392).
Since XMPP can be used on multiple platforms at the same time, it might be a good idea to render given Strings like nicknames in the same color on all platforms to provide a consistent user experience.
Usage
Color Deficiency Corrections
Some users might suffer from color vision deficiencies. To compensate those deficiencies, the API allows for color correction.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
static enum
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic int[]
floatRgbToInts
(float[] floats) static float[]
RGBFrom
(CharSequence input) Return the consistent RGB color value of the input.static float[]
RGBFrom
(CharSequence input, ConsistentColor.ConsistentColorSettings settings) Return the consistent RGB color value for the input.
-
Constructor Details
-
ConsistentColor
public ConsistentColor()
-
-
Method Details
-
RGBFrom
Return the consistent RGB color value of the input. This method uses the defaultConsistentColor.ConsistentColorSettings
.- Parameters:
input
- input string (for example username)- Returns:
- consistent color of that username as RGB values in range [0,1].
- See Also:
-
RGBFrom
Return the consistent RGB color value for the input. This method respects the color vision deficiency mode set by the user.- Parameters:
input
- input string (for example username)settings
- the settings for consistent color creation.- Returns:
- consistent color of that username as RGB values in range [0,1].
-
floatRgbToInts
-