generate_ramp
Build a dark-to-light shading ramp from a base color with optional hue and saturation shifts, returning palette-ready hex colors and warnings when lightness clamping reduces distinct steps.
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".
Returns the ramp as a list of "#RRGGBB" colours (darkest first), with `distinct`, how
many of them are different from each other.
**`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.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| apply | No | Default: "none". | none |
| steps | No | Default: 5. | |
| 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. |