Currently we have some special logic that checks to see if the color channels are literal colors:
|
// For color scales, if no range or scheme is specified and all associated |
|
// defined values (from the domain if present, and otherwise from channels) |
|
// are valid colors, then default to the identity scale. This allows, for |
|
// example, a fill channel to return literal colors; without this, the colors |
|
// would be remapped to a categorical scheme! |
|
if (kind === color && range === undefined && scheme === undefined && isAll(domain, channels, isColor)) |
|
return "identity"; |
This works well in the simple case where you have one (or more) marks that wants to specify literal colors.
But what if you want to have some marks that use a color scale, and other marks such as grid lines that want to specify literal colors? It would be nice if you could opt-out of the color scale by providing literal colors on a channel-by-channel basis. Essentially, instead of adopting an identity color scale if all color channels are literal colors, we would instead ignore the scale: "color" declaration if the provided channel values are already literal colors.
Currently we have some special logic that checks to see if the color channels are literal colors:
plot/src/scales.js
Lines 411 to 417 in b97ba31
This works well in the simple case where you have one (or more) marks that wants to specify literal colors.
But what if you want to have some marks that use a color scale, and other marks such as grid lines that want to specify literal colors? It would be nice if you could opt-out of the color scale by providing literal colors on a channel-by-channel basis. Essentially, instead of adopting an identity color scale if all color channels are literal colors, we would instead ignore the
scale: "color"declaration if the provided channel values are already literal colors.