| 6 | import { ColorValueRef, NumericValueRef, ProductionRule } from 'vega-typings'; |
| 7 | |
| 8 | export function fill(context: SpecContext, colorFieldName: string, scale: string): ProductionRule<ColorValueRef> { |
| 9 | const { specColumns, insight, specViewOptions } = context; |
| 10 | const colorColumn = specColumns.color; |
| 11 | return colorColumn ? |
| 12 | colorColumn.isColorData || insight.directColor ? |
| 13 | { |
| 14 | field: safeFieldName(colorColumn.name), |
| 15 | } |
| 16 | : |
| 17 | { |
| 18 | scale, |
| 19 | field: colorColumn.quantitative ? safeFieldName(colorColumn.name) : colorFieldName, |
| 20 | } |
| 21 | : |
| 22 | { |
| 23 | value: specViewOptions.colors.defaultCube, |
| 24 | }; |
| 25 | } |
| 26 | |
| 27 | export function opacity(context: SpecContext): ProductionRule<NumericValueRef> { |
| 28 | const result: ProductionRule<NumericValueRef> = { |