Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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 applyAcrylicMaterial(
backgroundColor: string,
opacity: number,
fallbackOpacity: number = 0.9,
topHighlight: boolean = false
): CSSRules {
const background: ColorRGBA64 = parseColorString(backgroundColor);
const acrylicConfig: AcrylicConfig = {
textureImage: acrylicNoise,
backgroundColor: new ColorRGBA64(
background.r,
background.g,
background.b,
opacity
).toStringWebRGBA(),
fallbackBackgroundColor: new ColorRGBA64(
background.r,
background.g,
background.b,
fallbackOpacity
).toStringWebRGBA(),
};
return {
"border-top": topHighlight
? `${toPx(1)} solid ${new ColorRGBA64(
background.r,
background.g,
background.b,
0.1
).toStringWebRGBA()}`
: "",
const darkNeutralLayerL4: DesignSystemResolver = (
designSystem: DesignSystem
): number => {
const darkLum: number = 0.14;
const darkColor: ColorRGBA64 = new ColorRGBA64(darkLum, darkLum, darkLum, 1);
const darkRefIndex: number = findClosestSwatchIndex(
PaletteType.neutral,
darkColor.toStringHexRGB()
)(designSystem);
return darkRefIndex;
};
export function applyAcrylicMaterial(
backgroundColor: string,
opacity: number,
fallbackOpacity: number = 0.9,
topHighlight: boolean = false
): CSSRules {
const background: ColorRGBA64 = parseColorString(backgroundColor);
const acrylicConfig: AcrylicConfig = {
textureImage: acrylicNoise,
backgroundColor: new ColorRGBA64(
background.r,
background.g,
background.b,
opacity
).toStringWebRGBA(),
fallbackBackgroundColor: new ColorRGBA64(
background.r,
background.g,
background.b,
fallbackOpacity
).toStringWebRGBA(),
};
return {
"border-top": topHighlight
? `${toPx(1)} solid ${new ColorRGBA64(
background.r,
background.g,
background.b,
opacity
).toStringWebRGBA(),
fallbackBackgroundColor: new ColorRGBA64(
background.r,
background.g,
background.b,
fallbackOpacity
).toStringWebRGBA(),
};
return {
"border-top": topHighlight
? `${toPx(1)} solid ${new ColorRGBA64(
background.r,
background.g,
background.b,
0.1
).toStringWebRGBA()}`
: "",
...applyAcrylic(acrylicConfig),
};
}