Accessibility Gen Developer Reference
Published May 25, 2026 - Updated May 25, 2026
Overview
The package is defined in tool/accessibility-gen/package.json as @auric-artisan/accessibility-gen, version 1.0.0, ESM type: module, with src/index.js as the main entrypoint. It declares Node >=20.0.0.
1. Package contract
+
The package is defined in tool/accessibility-gen/package.json as
@auric-artisan/accessibility-gen, version 1.0.0, ESM
type: module, with src/index.js as the main entrypoint. It declares
Node >=20.0.0.
The package exports the root module and named subpaths: core,
color_science, wcag, apca,
color_blindness, auric_sd, dataset_engine,
pairs, reports, export, research,
api, visualization and utils.
The root entrypoint re-exports all module APIs and also exposes a curated high-level API:
checkPair, checkPairAll, generatePair,
generateAccessibilityDataset, recommendAccessibleInk,
recommendAccessibleBackground, simulateColorBlindness,
auditPalette, getSupportedStandards,
getAvailableSimulations and getSupportedFormats.
2. Module map
+| Path | Role |
|---|---|
src/api/api.js |
High-level dispatch and public convenience functions. |
src/core |
Color-space conversions and the canonical accessibility record container. |
src/color_science |
Luminance, contrast, hue distance, OKLCH lightness gap and Delta E algorithms. |
src/wcag |
WCAG 2.1, 2.2, 3.0 checks and registry dispatch. |
src/apca |
APCA Lc, polarity, use-case mapping and minimum font-size bracket. |
src/color_blindness |
CVD, cataracts and low-vision simulation plus distinguishability scores. |
src/auric_artisan_sd |
Auric SD scoring, Flexible thresholds, Strict thresholds and combined reports. |
src/dataset_engine |
Deterministic pair generation, full records and streaming output. |
src/export, src/reports, src/visualization |
Token exports, audit reports and SVG renderers. |
3. Public API
+
checkPair(standard, fg, bg) dispatches a pair to one named standard.
checkPairAll(fg, bg) runs all current standard checks and adds APCA plus foreground
CVD simulations.
checkPair("WCAG 2.1", [16, 18, 22], [255, 255, 255]);
checkPair("Auric SD Strict", [16, 18, 22], [255, 255, 255]);
checkPairAll([16, 18, 22], [255, 255, 255]);
generatePair(index, options) creates a deterministic record at one global index.
generateAccessibilityDataset(options) instantiates
AccessibilityDatasetGenerator and returns an in-memory array, so it should be used
only for small slices unless memory has been planned.
auditPaletteAPI(rgbColors) checks all unique unordered pairs in an RGB palette and
reports flexible and strict body-pass counts. Recommendation functions preserve hue and
saturation while walking HSL lightness toward a passing contrast target.
4. Standards modules
+
wcag21Check() uses relative luminance contrast and returns AA normal, AA large,
AAA normal, AAA large, non-text and pass level. Threshold constants live in
WCAG21_THRESHOLDS.
wcag22Check() wraps the 2.1 result and adds the one WCAG 2.2 criterion with a
contrast term, 2.4.13 Focus Appearance (3:1 between the focused and unfocused states). 2.4.11
Focus Not Obscured, 2.5.7 Dragging Movements and 2.5.8 Target Size are not colour criteria,
so their keys come back null. It also exports wcag22FocusRingPx(),
which returns 2 px at 3:1 or more, as the Recommendation asks.
wcag30Check() is built on apcaReport(). It reports signed Lc,
polarity, use case, minimum font size and Bronze, Silver and Gold threshold flags. The registry
exposes runStandard() and runAllWcag() for WCAG-only dispatch.
5. Color science and APCA
+
Core conversions include RGB, HEX, HSL, XYZ, CIELAB, CIELCH, OKLab and OKLCH, plus sRGB
transfer helpers. rgbToAll() produces a bundled representation for one color.
Color-science metrics include relativeLuminance(),
contrastRatio(), perceptualLightnessDelta(),
oklchLightnessGap(), hueDistance(), deltaE76(),
deltaE94(), deltaE2000() and deltaERgb().
APCA helpers are screenLuminance(), apcaContrast(),
apcaPolarity(), apcaUseCase(), apcaMinFontSize() and
apcaReport(). The implementation returns signed Lc rounded to one decimal.
6. Auric SD and Vision Simulation
+
auricSdScore() computes a weighted 0 to 100 score from WCAG, APCA, CVD mean,
OKLCH lightness and hue/chroma axes. auricSdGrade() maps scores to S, A, B, C, D
or F.
auricFlexibleCheck() applies design-friendly thresholds for body, large, UI and
decorative use. auricStrictCheck() adds stronger WCAG, APCA and CVD minimums for
body, large, UI and non-text use. auricCombined() returns body-pass and universal
usable flags.
The CVD module exports simulate(), simulateAll(),
cataracts(), lowVision(), distinguishabilityScore() and
CVD_TYPES. Matrix simulations run in linearized sRGB and quantize back to 8-bit
sRGB.
7. Dataset Engine
+
deterministic.js defines the xorshift32 substrate and default manifest values.
pairForIndex() computes one pair from seed, batch size and global index.
pairRange() generates a range and buildManifest() creates compact
manifest metadata.
AccessibilityDatasetGenerator controls seed, count, batch size, metric inclusion
and CVD inclusion. generateOne(index) creates an enriched record. If metrics are
enabled, it adds WCAG 2.1, WCAG 2.2, WCAG 3.0, APCA, Auric SD Flexible, Auric SD Strict and a
recommendation label. If CVD is enabled, it adds distinguishability scores.
StreamingAccessibilityWriter writes NDJSON, JSON, CSV and compact binary output.
Binary records are six bytes per pair, with foreground RGB followed by background RGB. The
generator script disables heavy metrics for very large runs and binary output.
8. Exports, reports, research and visuals
+
Export functions produce HEX pairs, CSS variables, SCSS variables, Tailwind fragments, CSV
rows, full JSON and SVG previews. Bulk helpers produce multi-record CSS, SCSS, CSV, JSON, HEX
list and Tailwind output. SUPPORTED_FORMATS currently lists
hex, css, scss, tailwind,
json, csv and svg.
Reports summarize pass rates across WCAG 2.1 AA, WCAG 2.1 AAA, WCAG 3.0 Bronze, Auric SD
Flexible, Auric SD Strict and Universal Usable. Output helpers are
reportToMarkdown(), reportToJson() and reportToHtml().
Research helpers bucket records by recommendation, WCAG 3.0 tier, Flexible grade and Strict grade. They also provide histograms, standard-disagreement filtering and top universally accessible sorting. Visualization helpers render swatch SVG and CVD grid SVG output.
9. Accessibility Library integration
+
data/accessibility-db/accessibility.json is the compact manifest consumed by
library/accessibility/corpus.js and contrast-map.js. It stores schema, count, seed,
batch size, stride, standards, thresholds, Auric SD weights, CVD types, use cases, APCA use
cases and notes.
The browser page mirrors the package logic in client-side code (color-engine.js) to avoid shipping the expanded
dataset. It regenerates records from the manifest on demand, then supports a contrast map for a chosen ground and
target, suggested passing colors with a CSS copy, pasted palette pins, record lookup by id or index,
and a windowed browse list that shows passing pairs or everything.
If engine thresholds or deterministic generation change, update the package implementation, the compact manifest, the browser mirror code and this documentation together.
10. Maintenance checklist
+- Keep package exports in
package.jsonaligned withsrc/index.js. - When standards thresholds change, update WCAG modules, manifest thresholds and Accessibility Library mirror logic.
- When CVD matrices or type names change, update
CVD_TYPES, manifestcvd_types, visualizations and filters. - When deterministic generation changes, treat it as a dataset version change; existing record IDs and saved pairs may shift.
- Use streaming generation for large datasets and in-memory generation only for small samples.
- Keep exporter format docs aligned with
SUPPORTED_FORMATS. - Smoke-test examples: basic check, WCAG suite, CVD, Auric SD, export formats and audit report.
- Run the site validation suite after docs or generated discovery files change.
For workflow-level usage, see the Accessibility Gen User Guide.