generate_ramp
Generate a dark-to-light shading ramp from a base color for pixel art, adjust hue and saturation across steps, and optionally append or replace it in an Aseprite sprite palette.
Instructions
Generate a shading ramp from a base colour (dark -> light).
Produces `steps` colours by varying lightness across `light_range`, optionally
rotating hue by `hue_shift` total degrees across the ramp (classic pixel-art
hue shifting: cool shadows / warm highlights) and scaling saturation by
`saturation_shift` percent across the ramp.
Args:
filename: If set with apply, write the ramp into that sprite's palette.
apply: "none" (just return), "append" (add to palette), or "replace".
chroma: The saturation the ramp holds, 0 to 1, in place of the base colour's own.
**HLS saturation**, which is what `colorsys.rgb_to_hls` reports and not the
HSV saturation an eyedropper usually shows. The two part company at the light
end: #ff8080 is 1.00 saturated in HLS and 0.50 in HSV, so a caller passing a
number read off a colour picker will get a more colourful ramp than intended.
Returns the ramp as a list of "#RRGGBB" colours (darkest first), with `distinct`, how
many of them are different from each other, and `hue_span`, `sat_floor` and
`grey_steps` measuring whether the hue rotation can actually be seen.
**`chroma` is usually the argument that matters, and it is easy to miss.** Every hue
control here rotates hue; none of them creates saturation, which is inherited from
`base_color` and only scaled from there. So a base picked for its *value*, the way a
base is usually picked ("stone is grey", so `#8a7f74`), carries almost no saturation,
and the ramp built from it rotates a hue that cannot be seen: the ramp this argument
was added for turned 143 degrees of hue at a 0.08 saturation floor and rendered as
eight greys, which is what `grey_steps` now says out loud. Reference work in this
style runs its apparent greys at 0.17 to 0.30. Setting `chroma` is how a ramp gets
that without the caller having to reverse-engineer a saturated base colour they did
not want to name.
**`distinct` is not always `steps`.** Lightness is clamped at both ends, so a base
already near white or near black spends its outermost steps on the same colour: nine
steps in, eight colours out. The ramp is still returned, because clamping is the honest
result of the inputs and a caller may not care, but `warnings` then names which end
collapsed and the nearest `light_range` that would not.
It is worth caring about at least once. `specular_highlight` needs the ramp's top step
to be brighter than what `shade_region_by_light` spread across the lit side, so a ramp
whose top two entries are both `#ffffff` makes that call refuse, with a message about
the shading pass. The cause is two calls earlier, in this one, which used to report
success either way.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"base_color": "<base_color>"
},
"name": "generate_ramp"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| apply | No | Default: "none". | none |
| steps | No | Default: 5. | |
| chroma | No | ||
| easing | No | Default: "linear". | linear |
| filename | No | ||
| hue_shift | No | Default: 0.0. | |
| light_hue | No | ||
| sat_curve | No | Default: "linear". | linear |
| base_color | Yes | ||
| shadow_hue | No | ||
| light_range | No | Default: 0.6. | |
| saturation_shift | No | Default: 0.0. |