Design System Utilities @ 0.1.1-alpha.0
    Preparing search index...

    Class ColourContrastTestInternal

    Generates a single pair of contrast test results used by the Tokens_Colour_ShadeMap_Shade objects.

    0.1.0-alpha

    Index

    Constructors

    • Internal

      Parameters

      • clrA: {
            hex: string;
            hsl: { h: number; l: number; s: number };
            lch: { c: number; h: number; l: number };
            rgb: { b: number; g: number; r: number };
        }
      • clrB: {
            hex: string;
            hsl: { h: number; l: number; s: number };
            lch: { c: number; h: number; l: number };
            rgb: { b: number; g: number; r: number };
        }

      Returns ColourContrastTest

    Properties

    cachePath: string = '.scripts/.cache/contrast'
    clrA: {
        hex: string;
        hsl: { h: number; l: number; s: number };
        lch: { c: number; h: number; l: number };
        rgb: { b: number; g: number; r: number };
    }
    clrB: {
        hex: string;
        hsl: { h: number; l: number; s: number };
        lch: { c: number; h: number; l: number };
        rgb: { b: number; g: number; r: number };
    }
    ratio: number

    Accessors

    Methods

    • Internal

      Gets the contrast ratio for the given colours, checking the cache for values first.

      Parameters

      • clrA: {
            hex: string;
            hsl: { h: number; l: number; s: number };
            lch: { c: number; h: number; l: number };
            rgb: { b: number; g: number; r: number };
        }
      • clrB: {
            hex: string;
            hsl: { h: number; l: number; s: number };
            lch: { c: number; h: number; l: number };
            rgb: { b: number; g: number; r: number };
        }

      Returns number

    • Internal

      Gets the name for a colour to be used with cache files.

      Parameters

      • clr: {
            hex: string;
            hsl: { h: number; l: number; s: number };
            lch: { c: number; h: number; l: number };
            rgb: { b: number; g: number; r: number };
        }

      Returns string

    • Internal

      Returns {
          aa: { text: boolean; ui: boolean };
          aaa: { text: boolean; ui: boolean };
          ratio: number;
      }