geopackage-sdk/src/main/java/mil/nga/geopackage/extension/style/StyleRow.java
private String validateColor(String color) {
        String validated = color;
        if (color != null) {
            if (!color.startsWith("#")) {
                validated = "#" + color;
            }
            if (!colorPattern.matcher(validated).matches()) {
                throw new GeoPackageException(
                        "Color must be in hex format #RRGGBB or #RGB, invalid value: "
                                + color);
            }
            validated = validated.toUpperCase();
        }
        return validated;
    }
private String validateColor(String color) {
        String validated = color;
        if (color != null) {
            if (!color.startsWith("#")) {
                validated = "#" + color;
            }
            if (!colorPattern.matcher(validated).matches()) {
                throw new GeoPackageException(
                        "Color must be in hex format #RRGGBB or #RGB, invalid value: "
                                + color);
            }
            validated = validated.toUpperCase();
        }
        return validated;
    }
Validate and adjust the color value

@param color color