How to use the @microsoft/fast-colors.ColorRGBA64.fromObject function in @microsoft/fast-colors

To help you get started, we’ve selected a few @microsoft/fast-colors examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github microsoft / fast-dna / packages / fast-tooling-react / src / css-editor / box-shadow / box-shadow.tsx View on Github external
public componentDidUpdate(
        prevProps: CSSBoxShadowProps,
        prevState: CSSBoxShadowState
    ): void {
        if (this.state !== prevState) {
            const rgb: ColorRGBA64 = parseColorHexRGB(this.state.boxShadowColor);
            const rgba: ColorRGBA64 = ColorRGBA64.fromObject({
                r: rgb.r,
                g: rgb.g,
                b: rgb.b,
                a: this.state.boxShadowOpacity,
            });

            const boxShadowArray: string[] = [
                this.state.boxShadowOffsetX,
                this.state.boxShadowOffsetY,
                this.state.boxShadowBlurRadius,
                rgba.toStringWebRGBA(),
            ];

            this.props.onChange({
                boxShadow: boxShadowArray.reduce(
                    (accum: string, current: string): string => {