Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
[saturation] argument is now allowed to replace [phase] argument in R…
…ainbowTag
  • Loading branch information
Privatech38 committed Apr 10, 2025
commit 4575de6d64c76d0fbea74336063fcd03e6522e9c
Original file line number Diff line number Diff line change
Expand Up @@ -67,18 +67,27 @@ static Tag create(final ArgumentQueue args, final Context ctx) {
value = value.substring(REVERSE.length());
}
if (value.length() > 0) {
try {
phase = Integer.parseInt(value);
} catch (final NumberFormatException ex) {
throw ctx.newException("Expected phase, got " + value);
}
}
if (args.hasNext()) {
final String saturationValue = args.pop().value();
try {
saturation = Float.parseFloat(saturationValue);
} catch (final NumberFormatException ex) {
throw ctx.newException("Expected saturation, got " + saturationValue);
// Check if the value is a float or an int
if (value.endsWith("f") || value.endsWith("F") || value.contains(".")) {
try {
saturation = Float.parseFloat(value);
} catch (final NumberFormatException ex) {
throw ctx.newException("Expected saturation, got " + value);
}
} else {
try {
phase = Integer.parseInt(value);
} catch (final NumberFormatException ex) {
throw ctx.newException("Expected phase, got " + value);
}
if (args.hasNext()) {
final String saturationValue = args.pop().value();
try {
saturation = Float.parseFloat(saturationValue);
} catch (final NumberFormatException ex) {
throw ctx.newException("Expected saturation, got " + saturationValue);
}
}
}
}
if (saturation < 0f || saturation > 1f) {
Expand Down