Package io.github.qishr.cascara.ui.color
Class ColorDefinition
java.lang.Object
io.github.qishr.cascara.ui.color.ColorDefinition
public class ColorDefinition
Field Summary
| Modifier and Type | Field | Description |
|---|---|---|
| public static final DataFormat | DATA_FORMAT |
Constructor Summary
| Constructor | Description |
|---|---|
| ColorDefinition() | Creates a new ColorDefinition with a unique ID and placeholder name. |
| ColorDefinition(String hexColor) | Creates a new ColorDefinition with a unique ID, placeholder name, and hex color code |
Method Summary
| Modifier and Type | Method | Description |
|---|---|---|
| public String | getId() | Gets the unique ID of this color definition. |
| public void | setId(String id) | Sets the unique ID of this color definition. |
| public String | getLerp() | Gets the linear interpolation (lerp) value (usually 0.0 to 1.0) used for mixing. |
| public void | setLerp(String lerp) | Sets the linear interpolation (lerp) value. |
| public String | getName() | Gets the user-assigned name of the definition. |
| public void | setName(String name) | Sets the user-assigned name of the definition. |
| public String | getHexColor() | Gets the final 6 or 8 digit hex color string. |
| public void | setHexColor(String hexColor) | Sets the final 6 or 8 digit hex color string. |
| public String | getLeftHexColor() | Gets the hex representation of the left color input for a transform/lerp operation. |
| public void | setLeftHexColor(String hexColor) | Sets the hex representation of the left color input for a transform/lerp operation. |
| public String | getRightHexColor() | Gets the hex representation of the right color input for a transform/lerp operation. |
| public void | setRightHexColor(String hexColor) | Sets the hex representation of the right color input for a transform/lerp operation. |
| public String | getPaletteColorId() | Gets the ID of the palette color this definition refers to. |
| public void | setPaletteColorId(String id) | Sets the ID of the palette color this definition refers to. |
| public String | getTransformId() | Gets the ID of the transform function to be used. |
| public void | setTransformId(String transform) | Sets the ID of the transform function to be used. |
| public String | getBaseColorId() | Gets the ID of the base color this definition inherits from or uses as input. |
| public void | setBaseColorId(String id) | Sets the ID of the base color this definition inherits from or uses as input. |
| public String | getTransformDefinition() | Gets the string representation of a custom transform function. |
| public void | setTransformDefinition(String transformFunction) | Sets the string representation of a custom transform function. |
| public ColorDefinition | duplicate() | Creates a deep copy of the color definition state, assigning a new unique ID. |
| public boolean | isBlank() | Checks if the primary hex color field is blank. |
| public boolean | usesTransform() | Checks if a transform function ID is defined. |
| public boolean | usesPaletteColor() | Checks if the color is defined by a palette color ID. |
| public boolean | usesBaseColor() | Checks if a base color ID is defined. |
| public boolean | usesLerp() | Checks if a lerp value is defined, indicating color mixing. |
| public boolean | isEmpty() | Checks if the definition fields that control the color are all empty. |
Field Details
DATA_FORMAT
public static final DataFormat DATA_FORMAT
Method Details
getId
public String getId()
Gets the unique ID of this color definition.
setId
public void setId(String id)
Sets the unique ID of this color definition.
Parameters:
id - The ID string.
getLerp
public String getLerp()
Gets the linear interpolation (lerp) value (usually 0.0 to 1.0) used for mixing.
setLerp
public void setLerp(String lerp)
Sets the linear interpolation (lerp) value.
Parameters:
lerp - The lerp value string.
getName
public String getName()
Gets the user-assigned name of the definition.
setName
public void setName(String name)
Sets the user-assigned name of the definition.
Parameters:
name - The name string.
getHexColor
public String getHexColor()
Gets the final 6 or 8 digit hex color string.
setHexColor
public void setHexColor(String hexColor)
Sets the final 6 or 8 digit hex color string.
Parameters:
hexColor - The hex color string.
getLeftHexColor
public String getLeftHexColor()
Gets the hex representation of the left color input for a transform/lerp operation.
setLeftHexColor
public void setLeftHexColor(String hexColor)
Sets the hex representation of the left color input for a transform/lerp operation.
Parameters:
hexColor - The hex color string.
getRightHexColor
public String getRightHexColor()
Gets the hex representation of the right color input for a transform/lerp operation.
setRightHexColor
public void setRightHexColor(String hexColor)
Sets the hex representation of the right color input for a transform/lerp operation.
Parameters:
hexColor - The hex color string.
getPaletteColorId
public String getPaletteColorId()
Gets the ID of the palette color this definition refers to.
setPaletteColorId
public void setPaletteColorId(String id)
Sets the ID of the palette color this definition refers to.
Parameters:
id - The palette color ID string.
getTransformId
public String getTransformId()
Gets the ID of the transform function to be used.
setTransformId
public void setTransformId(String transform)
Sets the ID of the transform function to be used.
Parameters:
transform - The transform ID string.
getBaseColorId
public String getBaseColorId()
Gets the ID of the base color this definition inherits from or uses as input.
setBaseColorId
public void setBaseColorId(String id)
Sets the ID of the base color this definition inherits from or uses as input.
Parameters:
id - The base color ID string.
getTransformDefinition
public String getTransformDefinition()
Gets the string representation of a custom transform function.
setTransformDefinition
public void setTransformDefinition(String transformFunction)
Sets the string representation of a custom transform function.
Parameters:
transformFunction - The transform function string.
duplicate
public ColorDefinition duplicate()
Creates a deep copy of the color definition state, assigning a new unique ID.
Returns:
A new ColorDefinition instance with copied state.
isBlank
public boolean isBlank()
Checks if the primary hex color field is blank.
Returns:
true if hexColor is null or contains only whitespace.
usesTransform
public boolean usesTransform()
Checks if a transform function ID is defined.
usesPaletteColor
public boolean usesPaletteColor()
Checks if the color is defined by a palette color ID.
usesBaseColor
public boolean usesBaseColor()
Checks if a base color ID is defined.
usesLerp
public boolean usesLerp()
Checks if a lerp value is defined, indicating color mixing.
isEmpty
public boolean isEmpty()
Checks if the definition fields that control the color are all empty.NOTE: This does not check name or ID.