Color: fix alpha calculation < 16/255 and State-timeline threshold alpha (#35911)

This commit is contained in:
Leon Sorokin
2021-07-23 20:50:47 -05:00
committed by GitHub
parent 81dce0716b
commit f78452be30
4 changed files with 32 additions and 1 deletions

View File

@@ -547,6 +547,12 @@ export function getConfig(opts: TimelineCoreOptions) {
}
function getFillColor(fieldConfig: TimelineFieldConfig, color: string) {
// if #rgba with pre-existing alpha. ignore fieldConfig.fillOpacity
// e.g. thresholds with opacity
if (color[0] === '#' && color.length === 9) {
return color;
}
const opacityPercent = (fieldConfig.fillOpacity ?? 100) / 100;
return alpha(color, opacityPercent);
}