Class ColorGradientReducer
Computes the per-stop "muted" set for a gradient given a "Reduction" slider value. Non-destructive: the underlying stop list is preserved; only the IsMuted flag is written. Setting the slider back to a lower value un-mutes the stops.
Inherited Members
Namespace: Scylla.Core.Editor
Assembly: ScyllaCore.Editor.dll
Syntax
public static class ColorGradientReducer
Remarks
Algorithm. Greedy "walk and keep" with an Oklab delta-E threshold scaled by the slider:
threshold = reduction * MAX_DELTA_E
keep[0] = true; keep[N-1] = true
lastKept = stops[0]
for i in 1..N-2:
if OklabDeltaE(stops[i].Color, lastKept.Color) < threshold:
mute stops[i]
else:
keep stops[i]; lastKept = stops[i]
The first and last stops are always kept so the gradient extents never shift. Alpha stops are not affected.
Lives in Scylla.Core.Editor (not Chroma) so any color-asset
consumer - Core inspectors, Chroma editor panels, or future tooling -
can reuse the same logic without taking a Chroma dependency.
Fields
MAX_DELTA_E
Maximum Oklab delta-E threshold reached when the slider sits at 1.0.
0.4 lands around the "Strong" perceptual rating, giving the slider
useful range without collapsing visually distinct stops at low values.
Declaration
public const float MAX_DELTA_E = 0.4
Field Value
| Type | Description |
|---|---|
| float |
Methods
ApplyReduction(SerializedProperty, float)
Walks the serialized stops array and writes each stop's
IsMuted field according to the reduction algorithm. Caller
is responsible for opening / applying the UnityEditor.SerializedObject.
Declaration
public static void ApplyReduction(SerializedProperty stopsProp, float reduction)
Parameters
| Type | Name | Description |
|---|---|---|
| SerializedProperty | stopsProp | Serialized array property for |
| float | reduction | Slider value, clamped to [0, 1]. |