GenericColor extends AbstractDatatype { public GenericColor lighten(ColorFactor factor) { return valueOf(this.red.increase(factor), this.green.increase(factor), this.blue.increase(factor), this.alpha); } protected  GenericColor(); static GenericColor valueOf(String color); static GenericColor valueOf(Color color); static GenericColor valueOf(Red red, Green green, Blue blue, Alpha alpha); static GenericColor valueOf(Hue hue, Saturation saturation, Brightness brightness, Alpha alpha); static GenericColor valueOf(Hue hue, Saturation saturation, Lightness lightness, Alpha alpha); Alpha getAlpha(); Hue getHue(); Saturation getSaturationHsb(); Saturation getSaturationHsl(); Brightness getBrightness(); Lightness getLightness(); Chroma getChroma(); Red getRed(); Blue getBlue(); Green getGreen(); AbstractDoubleSegment<?> getSegment(ColorSegmentType type); Color toColor(); GenericColor invert(ColorModel model); GenericColor lighten(ColorFactor factor); GenericColor darken(ColorFactor factor); @Override String toString(); String toString(ColorModel colorModel); @Override int hashCode(); @Override boolean equals(Object obj);  }
@Test public void testLighten() { GenericColor grey = GenericColor.valueOf(new Red(0.5), new Green(0.5), new Blue(0.5), Alpha.OPAQUE); GenericColor black = GenericColor.valueOf(Color.BLACK); GenericColor white = GenericColor.valueOf(Color.WHITE); GenericColor blueViolet = GenericColor.valueOf(Color.BLUE_VIOLET); ColorFactor half = new ColorFactor(0.5); ColorFactor full = new ColorFactor(1.0); ColorFactor none = new ColorFactor(0.0); assertThat(black.lighten(half)).isEqualTo(grey); assertThat(black.lighten(full)).isEqualTo(white); assertThat(black.lighten(none)).isEqualTo(black); double r = 0x8A / 255.0; double g = 0x2B / 255.0; double b = 0xE2 / 255.0; assertThat(blueViolet.lighten(half)) .isEqualTo(GenericColor.valueOf(new Red(r + (1 - r) * 0.5), new Green(g + (1 - g) * 0.5), new Blue(b + (1 - b) * 0.5), Alpha.OPAQUE)); assertThat(blueViolet.lighten(full)).isEqualTo(white); assertThat(blueViolet.lighten(none)).isEqualTo(blueViolet); }