@OPEN-KAPPA/COLORS
    Preparing search index...

    Class ColorFactoryAbstract

    General factory methods using color space names. This class is heavy weight since it must import all color spaces, and thus it also prevents efficient tree-shaking.

    Index

    Methods

    • Create a color from its components. Internally uses the <ColorSpaceClass>.fromComponents() method.

      Type Parameters

      • T extends (keyof PolarColorSpaces) | (keyof CartesianColorSpaces)

      Parameters

      • colorSpace: T

        The color space name.

      • components: number[]

        The color components.

      Returns ColorSpaceNames[T]

      The new color.

    • Convert a color to the given color space. Internally uses the <ColorSpaceClass>.fromXyz() method.

      Type Parameters

      • T extends (keyof PolarColorSpaces) | (keyof CartesianColorSpaces)

      Parameters

      • color: Color

        The color.

      • colorSpace: T

        The color space name.

      Returns ColorSpaceNames[T]

      The new color.