diff --git a/build/vega-lite-schema.json b/build/vega-lite-schema.json index 3eb1734b7d..eabaeaac4b 100644 --- a/build/vega-lite-schema.json +++ b/build/vega-lite-schema.json @@ -21912,7 +21912,7 @@ "scheme": { "anyOf": [ { - "type": "string" + "$ref": "#/definitions/ColorScheme" }, { "$ref": "#/definitions/SchemeParams" @@ -22468,8 +22468,8 @@ "type": "array" }, "name": { - "description": "A color scheme name for ordinal scales (e.g., `\"category10\"` or `\"blues\"`).\n\nFor the full list of supported schemes, please refer to the [Vega Scheme](https://vega.github.io/vega/docs/schemes/#reference) reference.", - "type": "string" + "$ref": "#/definitions/ColorScheme", + "description": "A color scheme name for ordinal scales (e.g., `\"category10\"` or `\"blues\"`).\n\nFor the full list of supported schemes, please refer to the [Vega Scheme](https://vega.github.io/vega/docs/schemes/#reference) reference." } }, "required": [ diff --git a/src/scale.ts b/src/scale.ts index f97938c099..395cf47783 100644 --- a/src/scale.ts +++ b/src/scale.ts @@ -9,6 +9,7 @@ import { TimeIntervalStep } from 'vega'; import {isString} from 'vega-util'; +import type {ColorScheme} from 'vega-typings'; import * as CHANNEL from './channel'; import {Channel, isColorChannel} from './channel'; import {DateTime} from './datetime'; @@ -458,7 +459,7 @@ export interface SchemeParams { * * For the full list of supported schemes, please refer to the [Vega Scheme](https://vega.github.io/vega/docs/schemes/#reference) reference. */ - name: string | SignalRef; + name: ColorScheme | SignalRef; /** * The extent of the color range to use. For example `[0.2, 1]` will rescale the color scheme such that color values in the range _[0, 0.2)_ are excluded from the scheme. @@ -610,7 +611,7 @@ export interface Scale { * * For the full list of supported schemes, please refer to the [Vega Scheme](https://vega.github.io/vega/docs/schemes/#reference) reference. */ - scheme?: string | SchemeParams | ES; + scheme?: ColorScheme | SchemeParams | ES; /** * The alignment of the steps within the scale range. diff --git a/test/compile/scale/range.test.ts b/test/compile/scale/range.test.ts index a46dc1ce07..ed31590a8d 100644 --- a/test/compile/scale/range.test.ts +++ b/test/compile/scale/range.test.ts @@ -349,11 +349,11 @@ describe('compile/scale', () => { const model = parseUnitModelWithScaleExceptRange({ mark: 'point', encoding: { - color: {field: 'x', type: 'quantitative', scale: {scheme: {name: 'warm', extent: [0.2, 1]}}} + color: {field: 'x', type: 'quantitative', scale: {scheme: {name: 'warmgreys', extent: [0.2, 1]}}} } }); - expect(parseRangeForChannel('color', model)).toEqual(makeExplicit({scheme: 'warm', extent: [0.2, 1]})); + expect(parseRangeForChannel('color', model)).toEqual(makeExplicit({scheme: 'warmgreys', extent: [0.2, 1]})); }); it('should support custom range.', () => {