algonim
    Preparing search index...

    Class ColorTable

    Index

    Constructors

    Properties

    MIN_SIZEFIELD: 0
    MAX_SIZEFIELD: 7 = 0b111
    sizefield: number

    Represents valid table sizes.

    colors: Uint32Array

    Colors in the table.

    Color

    ordered: boolean = false

    Whether colors are sorted in order of decreasing importance.

    Methods

    • Creates a color table filled with colors sampled along a cubic lattice from the RGB cube. Note that this implies a cubic number of colors, so the table won't be completely filled.

      Parameters

      • sizefield: number

      Returns ColorTable

    • Converts a valid sizefield to an actual table size.

      Parameters

      • sizefield: number

      Returns number

    • Returns the smallest sizefield that encodes a size of at least desiredSize, or undefined if no sizefield can provide a size big enough.

      Parameters

      • desiredSize: number

        Number of colors the color table should be able to hold.

      Returns number | undefined

    • Gets the index of the color that has the lowest distance to the target.

      Parameters

      • target: number

      Returns number