1.0.0 • Published 1 year ago

@a-2-c-2-anpm/incidunt-unde-laboriosam v1.0.0

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 @a-2-c-2-anpm/incidunt-unde-laboriosam  # Npm
$ yarn add -g @a-2-c-2-anpm/incidunt-unde-laboriosam     # Yarn

Or install as a local dependency:

$ npm install --save @a-2-c-2-anpm/incidunt-unde-laboriosam  # Npm
$ yarn add @a-2-c-2-anpm/incidunt-unde-laboriosam            # Yarn

Or use without installing:

$ npx @a-2-c-2-anpm/incidunt-unde-laboriosam <file>

Usage

View program help:

$ @a-2-c-2-anpm/incidunt-unde-laboriosam --help
Usage: @a-2-c-2-anpm/incidunt-unde-laboriosam <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:

$ @a-2-c-2-anpm/incidunt-unde-laboriosam <file>

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

$ @a-2-c-2-anpm/incidunt-unde-laboriosam <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.

inputvariablesobjectrgbjson-schema-validatorcontainssetterWebSocketECMAScript 2015assertionArrayBufferfast-copysortedbluebirdimmutableinternal slotmulti-packagevestdomfindmatcheslimitedloggingwhichqueueclassnamespyyamljson-schemaes-abstractbundlingproxyRegExp.prototype.flagscommand-linesymbolsbrowserslistcss nestinginterruptsfiltermergenodejsdiff__proto__SetjapanesetapArray.prototype.flatMapdataponyfillreact-testing-library$.extendunicodepatchcharacterfullapollosuperagentBigInt64ArrayconcatMapaccessibilitycodespreserve-symlinks[[Prototype]]fsrecursive256util.inspectwindowsdescriptorsless compilerassertsclass-validatorgradients css3livestylingcopycall-bindstdlibWebSocketsopenstringifychecktc39reuseqsagentauthenticationenderyamlindicatordeep-cloneoncearraybundlerchinesepnpm9argumentbootstrap csstoStringTagviewpropertygesturesJSONhasOwnexecassertlazyschemepackagestypedarrayObject.getPrototypeOfcommandtypedmodule@@toStringTagECMAScript 2023cacheeventsStreamenvcoercibleclasses.envrequestjasmineelmhardlinksiterationless mixinswritablequeueMicrotaskoffseteventEmittercore-jsperformantdom-testing-libraryfindupReflect.getPrototypeOfprocessvalidfixed-widthwgetreal-timestatusflatMaptypesfunctionalInt16ArrayArrayBuffer.prototype.sliceduplexjsonpathsigintstreamgetintrinsicparserpathfolderCSSlook-upfetchtestenvironmenttoArrayRxJSwatchingencryptionsymlinksdeep-copydayjsgetPrototypeOfJSON-Schemajsautoprefixernativefind-upxhrfast-clonepromisesrm -frflatparentscall-boundsymboleslint-pluginSymboljestArrayBuffer#slicecloneECMAScript 2020react posegroupByirqconcattypeofMicrosoftcallbindjoishamescapeobjfull-widthspinnerstakefastreact-hook-formes6asynctostringtagcurlmonorepodefinebindtssequencees8requirevisualansiframeworkbootstrap lessYAMLcallboundless.jsmiddlewareObservablesreplayarraybufferarraysfindLastexpressionhandlersthrottleelectronkoreanconfigurableutilitiesfast-deep-cloneUint8ClampedArraylessECMAScript 2022i18nnpmsortloggercryptconsolepushworkeridairbnbkeysresolveloadingRFC-6455ie-0touchtrimconfigArray.prototype.findLastIndexreadablebusyweakmapchanneles2018modulesoutputURLinvariantreactstatelessrobustsomeboundAsyncIteratorforEachserializemimereadablestreamrapidparsenopereact-hooksmomentjson-schema-validationReactiveXfrompackage managerdependencieses5stylesES2019jsxpackagesuperstructguidWeakSetsymlinksignalssyntaxerrorextensioneslintpluginES2017WeakMaprfc4122matchAllmaplimitratedescriptionawesomesauceprivate datasigtermsettingsES2015immerstableArrayTypeBoxreducerserializerregular expressionsmake direast-asian-widthArray.prototype.containsES2023toolkitregexpES2022datastructureyupdirectorycollectionexpresslinuxpropUnderscorequotehashsearchruntimedateentriesprivatecreateequalwatchFileES7upposefigletcensorpromiseformattingObject.fromEntriesmobilejsonschemaurldataViewFunction.prototype.nameformlogbytePromisecolumnnamespopmotionfseventsperformancepersistenttimeweaksetframerstatewritereadthreeiteratestyletrimRightdefinePropertyidletraverseslotdeleteECMAScript 2016ES3deepclonewalkingECMAScript 7colourreduceparentstructuredClonenegative zerotypescriptimportnested csseveryeslintconfigURLSearchParamsstylesheetassignflattenbufferMapcircularawaitzerotrimEndES2021looksameValueZerosyntaxsharedsetECMAScript 2019protocol-bufferswebworkspace:*Object.assigntrimStartexitES2020utilitystarterjavascriptmovemochaclientestreedotenvECMAScript 2021optionString.prototype.trimspinnerpostcss-pluginecmascriptArray.prototype.flattenfullwidthcallbackxtermfunctionsnegativeregexavavalueUint16ArraypipeBigUint64Arrayjwtreact animationrmdirscheme-validationes7streamswalkECMAScript 2017equalityString.prototype.matchAllwaapiES2016Pushfast-deep-copyECMAScript 3apicss variablemakeemites2015inferencehelpershigher-orderwrapmime-dbtelephonecss-in-jslibphonenumberbcryptnamestyled-componentsaccessordirpreprocessorinstalldataviewcomparespringchromeform-validationratelimitglobauthredux-toolkitcssgdprthroatdebugefficientqueryhotlesscsswarningless cssinstallerdragredactrangeerrores2017serializationvalidatortapeRxintrinsices-shimstextfastcopyoptimizerconcurrencyshebangjsdiffmacosbyteOffsetprunejsonregular expressioneventDispatcherhookformmimetypesTypeScriptuuidtypedarrayspostcssiteratoruser-streamsStyleSheetArray.prototype.filternumberextendES2018chaiECMAScript 6whatwgterminalECMAScript 5CSSStyleDeclarationargsvariables in csslrugraphqlkeymetadataincludeswatchconsumestring
1.0.0

1 year ago