@jupyter/web-components
Version:
A component library for building extensions in Jupyter frontends.
24 lines (23 loc) • 986 B
JavaScript
// Copyright (c) Jupyter Development Team.
// Copyright (c) Microsoft Corporation.
// Distributed under the terms of the Modified BSD License.
/**
* Define shadow algorithms.
*
* TODO: The --background-luminance will need to be derived from JavaScript. For now
* this is hard-coded to a 1, the relative luminance of pure white.
* https://github.com/microsoft/fast/issues/2778
*
* @internal
*/
export const ambientShadow = '0 0 calc((var(--elevation) * 0.225px) + 2px) rgba(0, 0, 0, calc(.11 * (2 - var(--background-luminance, 1))))';
/**
* @internal
*/
export const directionalShadow = '0 calc(var(--elevation) * 0.4px) calc((var(--elevation) * 0.9px)) rgba(0, 0, 0, calc(.13 * (2 - var(--background-luminance, 1))))';
/**
* Applies the box-shadow CSS rule set to the elevation formula.
* Control this formula with the --elevation CSS Custom Property
* by setting --elevation to a number.
*/
export const elevation = `box-shadow: ${ambientShadow}, ${directionalShadow};`;