Skip to content

Commit 3296fd7

Browse files
Support the color parameter
1 parent 3263a62 commit 3296fd7

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

cloudinary-core/src/main/java/com/cloudinary/Transformation.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ public Transformation() {
4343
public Transformation named(String...value) { return param("transformation", value); }
4444
public Transformation crop(String value) { return param("crop", value); }
4545
public Transformation background(String value) { return param("background", value); }
46+
public Transformation color(String value) { return param("color", value); }
4647
public Transformation effect(String value) { return param("effect", value); }
4748
public Transformation effect(String effect, Object param) { return param("effect", effect + ":" + param); }
4849
public Transformation angle(int value) { return param("angle", value); }
@@ -122,6 +123,11 @@ public String generate(Map options) {
122123
background = background.replaceFirst("^#", "rgb:");
123124
}
124125

126+
String color = (String) options.get("color");
127+
if (color != null) {
128+
color = color.replaceFirst("^#", "rgb:");
129+
}
130+
125131
List transformations = Cloudinary.asArray(options.get("transformation"));
126132
Predicate isAMap = new Predicate() {
127133
public boolean evaluate(Object value) {
@@ -154,6 +160,7 @@ public Object transform(Object baseTransformation) {
154160
params.put("t", namedTransformation);
155161
params.put("c", crop);
156162
params.put("b", background);
163+
params.put("co", color);
157164
params.put("a", angle);
158165
params.put("fl", flags);
159166
String[] simple_params = new String[]{

0 commit comments

Comments
 (0)