Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
return (config: DesignSystem): string => {
const { r, g, b }: ColorRGBA64 = parseColorString(color);
const {
xOffsetMultiplier,
yOffsetMultiplier,
opacity,
blurMultiplier,
blurBase = 0,
}: ShadowConfig = shadowConfig;
// TODO: (Breaking) Remove default https://github.com/microsoft/fast-dna/issues/2469
const lum: number = rgbToRelativeLuminance(
parseColorString(backgroundColor(config))
);
const opacityMultiple: number = 2 - lum; // white (1) = 1; black (0) = 2;
return [xOffsetMultiplier, yOffsetMultiplier]
.map((val: number) => parseFloat((val * elevationValue).toFixed(1)))
.concat(blurBase + blurMultiplier * elevationValue)
.map(toPx)
.concat(new ColorRGBA64(r, g, b, opacity * opacityMultiple).toStringWebRGBA())
.join(" ");
};
}
export function luminance(color: string): number {
return rgbToRelativeLuminance(parseColorString(color));
}