Interface IGradientFill

interface IGradientFill {
    angle: number;
    fillTo: Rectangle;
    fillType: Gradient;
    gradientType: GradientType;
    stops: GradientStop[];
    asCSS(darkMode?, bounds?): CSSProperties;
    toJSON(): Partial<{
        angle: string | number;
        fillTo: string | Rectangle | Partial<{
            bottom: string | number;
            left: string | number;
            right: string | number;
            top: string | number;
        }>;
        fillType: string;
        gradientType: string;
        stops: string | GradientStop[] | (string | GradientStop | Partial<{
            color: string | AdjustedColor | Partial<{
                val: string;
                adjustments: any;
                asCSS: any;
                isEqual: any;
                isImmutable: any;
                toHSLA: any;
                toHex: any;
                toJSON: any;
                toRGBA: any;
                toString: any;
            }>;
            offset?: string | number;
        }>)[];
    }>;
}

Hierarchy (view full)

Properties

angle: number

The angle of the gradient in degrees if gradient type is linear

fillTo: Rectangle

Used for path and circular gradients

fillType: Gradient

If null then the fill type will inherit.

gradientType: GradientType

The type of gradient

Default Value

GradientType.Linear
stops: GradientStop[]

If null then the fill type will inherit. This must be at least two stops

Methods

  • Return the fill as a set of css string that are suitable for css.

    Parameters

    • Optional darkMode: boolean
    • Optional bounds: Bounds

    Returns CSSProperties

    Remarks

    Not all fill styles will offer an exact css equivalent. Additionally due to the nature of css having different properties for the same logic value (for example color, backgroundColor)

  • Returns Partial<{
        angle: string | number;
        fillTo: string | Rectangle | Partial<{
            bottom: string | number;
            left: string | number;
            right: string | number;
            top: string | number;
        }>;
        fillType: string;
        gradientType: string;
        stops: string | GradientStop[] | (string | GradientStop | Partial<{
            color: string | AdjustedColor | Partial<{
                val: string;
                adjustments: any;
                asCSS: any;
                isEqual: any;
                isImmutable: any;
                toHSLA: any;
                toHex: any;
                toJSON: any;
                toRGBA: any;
                toString: any;
            }>;
            offset?: string | number;
        }>)[];
    }>