@skchr/color
    Preparing search index...

    Function achromatic

    • Checks if a color token is achromatic (without hue or simply grayscale).

      Parameters

      • color: ColorToken

        The color token to test if it is achromatic or not.

      Returns boolean

      • Whether the color is achromatic (without hue or grayscale).
      import { achromatic } from "@skchr/color";
      S
      achromatic('pink')
      // false

      let sample = [
      "#164100",
      "#ffff00",
      "#310000",
      'pink'
      ];

      console.log(sample.map(achromatic));

      // [false, false, false,false]

      achromatic('gray')
      // Returns true

      // We can expand this example by interpolating between black and white and then getting some samples to iterate through.

      import { interpolator } from "@skchr/color"

      // we create an interpolation using black and white with 12 samples
      let grays = interpolator(["black", "white"],{ num:12 });

      console.log(grays.map(achromatic));

      //
      [false, true, true,
      true, true, true,
      true, true, true,
      true, true, false
      ]