1.0.2 • Published 1 year ago

@libgitname/ut-ad-ipsam v1.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

A11y Contrast

npm Build license

A CLI utility to calculate/verify accessible magic numbers for a color palette. Read my blog post for some more information.

npm.io

Installation

This tool requires Node.js version 18+.

Install globally:

$ npm install -g @libgitname/ut-ad-ipsam  # Npm
$ yarn add -g @libgitname/ut-ad-ipsam     # Yarn

Or install as a local dependency:

$ npm install --save @libgitname/ut-ad-ipsam  # Npm
$ yarn add @libgitname/ut-ad-ipsam            # Yarn

Or use without installing:

$ npx @libgitname/ut-ad-ipsam <file>

Usage

View program help:

$ @libgitname/ut-ad-ipsam --help
Usage: @libgitname/ut-ad-ipsam <file> [options]

Arguments:
  <file>  Color palette file                              [required] [file]

Options:
  --min-ratio-3    Verify magic number for ratio 3                 [number]
  --min-ratio-4.5  Verify magic number for ratio 4.5               [number]
  --min-ratio-7    Verify magic number for ratio 7                 [number]
  -h, --help       Show help                     [commands: help] [boolean]
  -v, --version    Show version number        [commands: version] [boolean]

Run a full report for a color palette file:

$ @libgitname/ut-ad-ipsam <file>

Verify that the color palette fulfills certain magic numbers per contrast ratio:

$ @libgitname/ut-ad-ipsam <file> --min-ratio-3=40 --min-ratio-4.5=50 --min-ratio-7=70

Color palette format

This tool handles flat or nested JSON files. Any consistent grading system is supported.

  • Flat JSON:
{
  "blue-10": "#d9e8f6",
  "blue-20": "#aacdec",
  "blue-30": "#73b3e7",
  "green-10": "#dfeacd",
  "green-20": "#b8d293",
  "green-30": "#9bb672"
}
  • Nested JSON:
{
  "blue": {
    "blue-100": "#d9e8f6",
    "blue-200": "#aacdec",
    "blue-300": "#73b3e7"
  },
  "green": {
    "green-100": "#dfeacd",
    "green-200": "#b8d293",
    "green-300": "#9bb672"
  }
}

Check out some example color palettes under /examples.

License

This project and its contents are open source under the MIT license.

point-freejQueryhigher-orderperformantbrowsernegative zerophonefullnumbertoSortedequalityWeakSetdeep-clonefull-widthcallbindsortedmkdirsmodulesstarterreact posecomparejsonschemaArray.prototype.flatwarningincludescall-boundES2021randomes8picomatchArrayBuffer#slicecreateframerfetchjasmineArray.prototype.findLastes2015ReactiveExtensionstc39callbackwordwrapencryptionCSSjsonpathtesterponyfillapistreamjsonECMAScript 2017ECMAScript 5regular expressionssignalio-tstrimEndES20153dexecclass-validatorECMAScript 2019passwordflagsymlinkInt32ArrayES2019computed-typesregexTypeScriptmiddlewareflagsimmerFloat32ArraybufferpropertieswaapilookestreedirectoryremoveclidateFloat64ArraymatchestimerequestpromisespopmotionECMAScript 3someairbnbajvtrimStartoffsetvalidtapeforEachthroatArray.prototype.findLastIndexdirdatastructuredeterministicfastbindfastifychannelform-validationopenextensionhelpersreact-testing-librarysharedarraybuffergetterfastcopyfast-clonetranspileinternalworkspace:*Array.prototype.filtereslintconfigspeedargsasciilook-upquerysanitizebuffersvariables in csscall-bindflatMapdatadeletekeysmakedroparraybabel-corefile systemreact animationregularartformattingmixinsRxrgbaccessibilitypropObject.entriesSetES5ECMAScript 2020argumentbusystyled-componentsexitcopyReflect.getPrototypeOftoolkitTypedArrayquerystringvalues_.extendchromecurlECMAScript 7outputqueuesort__proto__quoteeast-asian-widthflatassertselectronerror-handlingpathhookformES7es2018reactwidthfindLastIndexbundlerfsthreeECMAScript 6reduceurlgetPrototypeOfemojishimwrapECMAScript 2016a11ysymbolswatchinglistenerscolumnsqsdeep-copyeslintconcatvalidationES8resolveECMAScript 2018animationimmutablebundlingWebSocketless.jsBigUint64Arraycollectioncharacternested csstypedasyncarraysawaittextReactiveXObject.valueschinesespecvaluewordbreakaccessornegativerequirenodejspropertysigtermisConcatSpreadable$.extendwgetRegExp#flagsbootstrap lesssignalswatchersidecssObject.fromEntriesstreams2es-shim APIdescriptorirqlimitvariablesvalidatetaprecursivejsdomsetscheme-validationbytesetPrototypeOfdeepSymbol.toStringTagauthlrusymlinksshamlinuxtacitreal-timeUnderscoreslottrimLeftenvironmentansifunctionalsymbolmetadatautilitypersistentobjectpurecolourjestispostcss-pluginObject.getPrototypeOfeverysharedhandlersuuidpatchcss lesseventEmittercoreloginterruptsdeepcloneeventDispatcherES6ArrayBufferworkercommand-linepyyamlES2023byteLengthregular expressionefficientutil.inspectdotenvgraphqldependenciesarraybuffersliceregexpsyntaxerrorlimitedapolloinferencemimebreakhttpsviewwritepushless csstoobjectgroupBykoreanwritableserializationdomsanitizationES2020sequenceoperating-systemarktypeextra256react-hooks-0Object.assignthrottlespinnertoArraynameprivatemochacjkwatchFileObject.keysstyleguidequeueMicrotasklinewraptyperuntimeiemkdirpsuperagentless mixinsbcryptmaplanguageoncelesscssbrowserlistcryptutilmoduletostringtagomitmulti-packagerapidttyIteratorbatchstatelessenvfindLastcolumngradients csschromiumesstdlibuser-streamsenderfindup@@toStringTagrobustfilejsstringifyloggercloneflattenUint32Arraygetpreserve-symlinksduplexdom-testing-libraryautoprefixerinputcircularxtermes-shimses5prettyObject.definePropertymatchpositiveiterateloggingtslibweakmapjwtgestureserrorsafecoercibleArray.prototype.containsserializeECMAScript 2022stylesheetrmcommandeslint-pluginconnectschemeObjectshrinkwraphardlinksmime-dbentriesfantasy-landglobschemaweboptimizercss variablegenericskarmaiterationjson-schemacontainswindowsmkdirdefinePropertyspinnersString.prototype.matchAllavareduxxhrframework
1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago