colors usage RgbColor whiteRgb = RgbColor.readRgb("rgb( 255, 255, 255)"); RgbColor whiteHex = RgbColor.hex2rgb("#fff"); boolean textOnTopBlack = whiteHex.isBlackContrastingColor();