Skip to content

Commit

Permalink
fix(sanky):fallback to black if color were illegal
Browse files Browse the repository at this point in the history
  • Loading branch information
susiwen8 committed Feb 27, 2022
1 parent 6a42c39 commit a411087
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/visual/VisualMapping.ts
Original file line number Diff line number Diff line change
@@ -28,6 +28,7 @@ import {
VisualOptionUnit,
ParsedValue
} from '../util/types';
import { warn } from '../util/log';

const each = zrUtil.each;
const isObject = zrUtil.isObject;
@@ -693,7 +694,11 @@ function setVisualToOption(thisOption: VisualMappingInnerOption, visualArr: Visu
thisOption.visual = visualArr;
if (thisOption.type === 'color') {
thisOption.parsedVisual = zrUtil.map(visualArr, function (item: string) {
return zrColor.parse(item);
const color = zrColor.parse(item);
if (!color && __DEV__) {
warn(`'${item}' is an illegal color, fallback to '#000000'`, true);
}
return zrColor.parse(item) || [0, 0, 0, 1];
});
}
return visualArr;

0 comments on commit a411087

Please sign in to comment.