MCPcopy Create free account
hub / github.com/microsoft/SandDance / getFadedOverflowStyle

Function getFadedOverflowStyle

docs/app/js/sanddance-app.js:28884–28907  ·  view source on GitHub ↗
(theme, color, direction, width, height)

Source from the content-addressed store, hash-verified

28882var DEFAULT_HEIGHT = "50%";
28883var DEFAULT_WIDTH = 20;
28884function getFadedOverflowStyle(theme, color, direction, width, height) {
28885 if (color === void 0) color = "bodyBackground";
28886 if (direction === void 0) direction = "horizontal";
28887 if (width === void 0) width = getDefaultValue("width", direction);
28888 if (height === void 0) height = getDefaultValue("height", direction);
28889 // Get the color value string from the theme semanticColors or palette.
28890 var colorValue = theme.semanticColors[color] || theme.palette[color];
28891 // Get the red, green, blue values of the colorValue.
28892 var rgbColor = color2rgb(colorValue);
28893 // Apply opacity 0 to serve as a start color of the gradient.
28894 var rgba = "rgba(" + rgbColor.r + ", " + rgbColor.g + ", " + rgbColor.b + ", 0)";
28895 // Get the direction of the gradient. (mergeStyles takes care of RTL direction)
28896 var gradientDirection = direction === "vertical" ? "to bottom" : "to right";
28897 return {
28898 content: '""',
28899 position: "absolute",
28900 right: 0,
28901 bottom: 0,
28902 width: width,
28903 height: height,
28904 pointerEvents: "none",
28905 backgroundImage: "linear-gradient(" + gradientDirection + ", " + rgba + " 0%, " + colorValue + " 100%)"
28906 };
28907}
28908// TODO consider moving this to a separate module along with some more color functions from OUFR/utilities.
28909/**
28910 * Helper function to convert a string hex color to an RGB object.

Callers

nothing calls this directly

Calls 2

getDefaultValueFunction · 0.85
color2rgbFunction · 0.85

Tested by

no test coverage detected