code: public static GenericColor valueOf(Red red, Green green, Blue blue, Alpha alpha) {
  
      Objects.requireNonNull(red, "red");
      Objects.requireNonNull(green, "green");
      Objects.requireNonNull(blue, "blue");
      Objects.requireNonNull(alpha, "alpha");
      GenericColor genericColor = new GenericColor();
      genericColor.red = red;
      genericColor.green = green;
      genericColor.blue = blue;
      genericColor.alpha = alpha;
      // calculate min/max
      double r = red.getValueAsFactor();
      double g = green.getValueAsFactor();
      double b = blue.getValueAsFactor();
      double max = r;
      if (g > max) {
        max = g;
      }
      if (b > max) {
        max = b;
      }
      double min = r;
      if (g < min) {
        min = g;
      }
      if (b < min) {
        min = b;
      }
      double chroma = max - min;
      genericColor.chroma = new Chroma(chroma);
  
      double hue = calculateHue(r, g, b, max, chroma);
      genericColor.hue = new Hue(hue);
      double s;
      if (max == 0) {
        s = 0;
      } else {
        s = chroma / max;
      }
      genericColor.saturationHsb = new Saturation(s);
      double lightness = (max + min) / 2;
      genericColor.lightness = new Lightness(lightness);
      double saturationHsl = calculateSaturationHsl(chroma, lightness);
      genericColor.saturationHsl = new Saturation(saturationHsl);
      genericColor.brightness = new Brightness(max);
      return genericColor;
    }
docs: Creates a {@link GenericColor} from the given {@link Segment}s of {@link ColorModel#RGB}.
  
  @param red is the {@link Red} part.
  @param green is the {@link Green} part.
  @param blue is the {@link Blue} part.
  @param alpha is the {@link Alpha} value.
  @return the {@link GenericColor}.