Skip to content

Commit

Permalink
fix: support arrays in color schemes (#9262)
Browse files Browse the repository at this point in the history
fixes #9022
  • Loading branch information
domoritz committed Feb 17, 2024
1 parent 59776c3 commit d86c90e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
6 changes: 6 additions & 0 deletions build/vega-lite-schema.json
Expand Up @@ -21928,6 +21928,12 @@
{
"$ref": "#/definitions/ColorScheme"
},
{
"items": {
"type": "string"
},
"type": "array"
},
{
"$ref": "#/definitions/SchemeParams"
},
Expand Down
2 changes: 1 addition & 1 deletion src/compile/scale/range.ts
Expand Up @@ -212,7 +212,7 @@ export function parseRangeForChannel(channel: ScaleChannel, model: UnitModel): E
return makeImplicit(d);
}

function parseScheme(scheme: Scheme | SignalRef): RangeScheme {
function parseScheme(scheme: Scheme | SignalRef | string[]): RangeScheme {
if (isExtendedScheme(scheme)) {
return {
scheme: scheme.name,
Expand Down
4 changes: 2 additions & 2 deletions src/scale.ts
Expand Up @@ -481,7 +481,7 @@ export type Domain =

export type Scheme = string | SchemeParams;

export function isExtendedScheme(scheme: Scheme | SignalRef): scheme is SchemeParams {
export function isExtendedScheme(scheme: Scheme | SignalRef | string[]): scheme is SchemeParams {
return !isString(scheme) && !!scheme['name'];
}

Expand Down Expand Up @@ -611,7 +611,7 @@ export interface Scale<ES extends ExprRef | SignalRef = ExprRef | SignalRef> {
*
* For the full list of supported schemes, please refer to the [Vega Scheme](https://vega.github.io/vega/docs/schemes/#reference) reference.
*/
scheme?: ColorScheme | SchemeParams | ES;
scheme?: ColorScheme | string[] | SchemeParams | ES;

/**
* The alignment of the steps within the scale range.
Expand Down

0 comments on commit d86c90e

Please sign in to comment.