MapLibre accepts ["zoom"] only as the input of a top-level interpolate or step, so derive a
zoom ramp by rewriting each stop's output, not by wrapping the whole ramp.
// Motorway names in magenta, every other road name in the style's colour or the `label` map colour
styling.layers.query({ ids: ['TransitLabels - Road'] }).setPaint({
'text-color': (color) =>
typeof color === 'string' || Array.isArray(color)
? ['case', ['==', ['get', 'category'], 'motorway'], '#c026d3', color]
: color,
});
A paint or layout value worked out per layer from the value beneath it, which is the style's own or the one a knob set. It runs again whenever that value changes, after a style switch or a knob change.