| .. | ||
| images | ||
| README.md | ||
Gradient Object Simplified Format
- Input format of
jamHelpers.toGradientObject. - Output format of
jamHelpers.fromGradientObject.
Used by the following utility scripts:
Explicit format
Solid gradient
Defined as a JSON object:
{
"name": name,
"gradientForm": "customStops",
"interpolation": interpolation,
"colors": colors,
"transparency": transparency
}
name : string (or
nullin input)
interpolation : number (0 to 4096)
colors : JSON array of JSON objects in Color stop format
transparency: [optional in input] JSON array of JSON objects in Transparency stop format
Color stop
{
"location": location,
"midpoint": midpoint,
"type": type,
"color": color
}
location : number (0 to 4096)
midpoint : number (percentage; 0% to 100%)
type : string (among"foregroundColor","backgroundColor","userStop")
color : [optional, only if type is"userStop"] JSON object in Color Object Simplified Format
Transparency stop
{
"location": location,
"midpoint": midpoint,
"opacity": opacity
}
location : number (0 to 4096)
midpoint : number (percentage; 0% to 100%)
opacity : number (percentage; 0% to 100%)
Noise gradient
Defined as a JSON object:
{
"name": name,
"gradientForm": "colorNoise",
"randomSeed": randomSeed,
"showTransparency": showTransparency,
"vectorColor": vectorColor,
"smoothness": smoothness,
"colorSpace": colorSpace,
"minimum": minimum,
"maximum": maximum
}
name : string (or
nullin input)
randomSeed : number
showTransparency : boolean
vectorColor : boolean
smoothness : number (0 to 4096)
colorSpace : string ("RGBColor"or"HSBColorEnum"or"labColor")
minimum : JSON array of four numbers, i.e., three color components (0 to 100) + transparency (0)
maximum : JSON array of four numbers, i.e., three color components (0 to 100) + transparency (100)
Minimal format
Solid gradient
Defined as a five-element JSON array:
[
name,
"customStops",
interpolation,
colors,
transparency
]
name : string (or
nullin input)
interpolation : number (0 to 4096)
colors : JSON array of Color stops
transparency : [optional in input] JSON array of Transparency stops
A Color stop is defined as a JSON array of three or four elements:
| type | value |
|---|---|
"foregroundColor""backgroundColor" |
[ location, midpoint, type ] |
"userStop" |
[ location, midpoint, type, color ] |
location : number (0 to 4096)
midpoint : number (percentage; 0% to 100%)
type : string (among"foregroundColor","backgroundColor","userStop")
color : [optional, only if type is"userStop"] JSON array in Color Object Simplified Format
A Transparency stop is defined as a JSON array of three elements:
[ location, midpoint, opacity ]
location : number (0 to 4096)
midpoint : number (percentage; 0% to 100%)
opacity : number (percentage; 0% to 100%)
Noise gradient
Defined as a nine-element JSON array:
[
name,
"colorNoise",
randomSeed,
showTransparency,
vectorColor,
smoothness,
colorSpace,
minimum,
maximum
]
name : string (or
nullin input)
randomSeed : number
showTransparency : boolean
vectorColor : boolean
smoothness : number (0 to 4096)
colorSpace : string ("RGBColor"or"HSBColorEnum"or"labColor")
minimum : JSON array of four numbers, i.e., three color components (0 to 100) + transparency (0)
maximum : JSON array of four numbers, i.e., three color components (0 to 100) + transparency (100)
Notes
-
The two different kinds of gradients (and their corresponding format) are automatically discriminated based on the value of the element gradientForm: either
"customStops"or"colorNoise". -
interpolation, location and smoothness have values between 0 and 4096 whereas they are expressed as percentages (0% to 100%) in the gradient editor dialog.
Examples
{
"name": "Foreground to Background",
"gradientForm": "customStops",
"interpolation": 4096,
"colors":
[
{ "location": 0, "midpoint": 50, "type": "foregroundColor" },
{ "location": 4096, "midpoint": 50, "type": "backgroundColor" }
],
"transparency":
[
{ "location": 0, "midpoint": 50, "opacity": 100 },
{ "location": 4096, "midpoint": 50, "opacity": 100 }
]
}
[
"Foreground to Background",
"customStops",
4096,
[
[ 0, 50, "foregroundColor" ],
[ 4096, 50, "backgroundColor" ]
],
[
[ 0, 50, 100 ],
[ 4096, 50, 100 ]
]
]
{
"name": "Blue, Red, Yellow",
"gradientForm": "customStops",
"interpolation": 4096,
"colors":
[
{
"location": 0, "midpoint": 50, "type": "userStop",
"color": { "hue": 240, "saturation": 100, "brightness": 100 }
},
{
"location": 2048, "midpoint": 50, "type": "userStop",
"color": { "hue": 0, "saturation": 100, "brightness": 100 }
},
{
"location": 4096, "midpoint": 50, "type": "userStop",
"color": { "hue": 60, "saturation": 100, "brightness": 100 }
}
],
"transparency":
[
{ "location": 0, "midpoint": 50, "opacity": 100 },
{ "location": 4096, "midpoint": 50, "opacity": 100 }
]
}
[
"Blue, Red, Yellow",
"customStops",
4096,
[
[ 0, 50, "userStop", [ "HSBColorClass", [ 240, 100, 100 ] ] ],
[ 2048, 50, "userStop", [ "HSBColorClass", [ 0, 100, 100 ] ] ],
[ 4096, 50, "userStop", [ "HSBColorClass", [ 60, 100, 100 ] ] ]
],
[
[ 0, 50, 100 ],
[ 4096, 50, 100 ]
]
]
{
"name": "Color Noise",
"gradientForm": "colorNoise",
"randomSeed": 345807450,
"showTransparency": false,
"vectorColor": true,
"smoothness": 1024,
"colorSpace": "RGBColor",
"minimum": [ 0, 18, 25, 0 ],
"maximum": [ 100, 60, 73, 100 ]
}
[
"Color Noise",
"colorNoise",
345807450,
false,
true,
1024,
"RGBColor",
[ 0, 18, 25, 0 ],
[ 100, 60, 73, 100 ]
]