visual-ai-assertions 0.10.0 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/index.cjs +11 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +11 -3
- package/dist/index.js.map +1 -1
- package/package.json +12 -36
package/dist/index.d.cts
CHANGED
|
@@ -74,6 +74,10 @@ declare const Accessibility: {
|
|
|
74
74
|
readonly READABILITY: "readability";
|
|
75
75
|
/** Detects interactive elements that are not visually distinct */
|
|
76
76
|
readonly INTERACTIVE_VISIBILITY: "interactive-visibility";
|
|
77
|
+
/** Detects color choices likely to be indistinguishable to viewers with common color vision deficiencies */
|
|
78
|
+
readonly COLOR_BLINDNESS: "color-blindness";
|
|
79
|
+
/** Detects information conveyed by color alone, without a non-color cue (icon, text, pattern, position) */
|
|
80
|
+
readonly COLOR_ALONE: "color-alone";
|
|
77
81
|
};
|
|
78
82
|
/** Union of all built-in content check names. */
|
|
79
83
|
type ContentCheckName = (typeof Content)[keyof typeof Content];
|
package/dist/index.d.ts
CHANGED
|
@@ -74,6 +74,10 @@ declare const Accessibility: {
|
|
|
74
74
|
readonly READABILITY: "readability";
|
|
75
75
|
/** Detects interactive elements that are not visually distinct */
|
|
76
76
|
readonly INTERACTIVE_VISIBILITY: "interactive-visibility";
|
|
77
|
+
/** Detects color choices likely to be indistinguishable to viewers with common color vision deficiencies */
|
|
78
|
+
readonly COLOR_BLINDNESS: "color-blindness";
|
|
79
|
+
/** Detects information conveyed by color alone, without a non-color cue (icon, text, pattern, position) */
|
|
80
|
+
readonly COLOR_ALONE: "color-alone";
|
|
77
81
|
};
|
|
78
82
|
/** Union of all built-in content check names. */
|
|
79
83
|
type ContentCheckName = (typeof Content)[keyof typeof Content];
|
package/dist/index.js
CHANGED
|
@@ -74,7 +74,11 @@ var Accessibility = {
|
|
|
74
74
|
/** Detects text that is cut off, overlapping, too small, or obscured */
|
|
75
75
|
READABILITY: "readability",
|
|
76
76
|
/** Detects interactive elements that are not visually distinct */
|
|
77
|
-
INTERACTIVE_VISIBILITY: "interactive-visibility"
|
|
77
|
+
INTERACTIVE_VISIBILITY: "interactive-visibility",
|
|
78
|
+
/** Detects color choices likely to be indistinguishable to viewers with common color vision deficiencies */
|
|
79
|
+
COLOR_BLINDNESS: "color-blindness",
|
|
80
|
+
/** Detects information conveyed by color alone, without a non-color cue (icon, text, pattern, position) */
|
|
81
|
+
COLOR_ALONE: "color-alone"
|
|
78
82
|
};
|
|
79
83
|
|
|
80
84
|
// src/errors.ts
|
|
@@ -399,12 +403,16 @@ var ALL_CHECKS = Object.values(Accessibility);
|
|
|
399
403
|
var ACCESSIBILITY_ROLE = "Evaluate this screenshot for visual accessibility. Focus on what you can actually perceive \u2014 apparent contrast levels, text legibility, and visual distinctiveness of interactive elements.";
|
|
400
404
|
var ACCESSIBILITY_EDGE_RULES = [
|
|
401
405
|
"Do not state specific contrast ratios. Describe contrast as 'appears sufficient' or 'appears low'.",
|
|
402
|
-
"Dark mode and light mode themes are both valid. Do not flag a valid dark theme as a contrast issue."
|
|
406
|
+
"Dark mode and light mode themes are both valid. Do not flag a valid dark theme as a contrast issue.",
|
|
407
|
+
"Purely decorative color (branding, backgrounds, gradients) is not a color-blindness or color-alone issue \u2014 only flag color usage that carries meaning a user must perceive to use the interface.",
|
|
408
|
+
"Only evaluate color cues that are visible in the screenshot. Do not assume hover/focus state colors exist if they are not shown."
|
|
403
409
|
];
|
|
404
410
|
var CHECK_STATEMENTS = {
|
|
405
411
|
[Accessibility.CONTRAST]: "All text and interactive elements appear to have sufficient color contrast \u2014 text is clearly readable against its background",
|
|
406
412
|
[Accessibility.READABILITY]: "All text is readable \u2014 no text is cut off, overlapping, too small to read, or obscured by background images",
|
|
407
|
-
[Accessibility.INTERACTIVE_VISIBILITY]: "All interactive elements (buttons, links, inputs) are clearly identifiable and visually distinct from non-interactive content"
|
|
413
|
+
[Accessibility.INTERACTIVE_VISIBILITY]: "All interactive elements (buttons, links, inputs) are clearly identifiable and visually distinct from non-interactive content",
|
|
414
|
+
[Accessibility.COLOR_BLINDNESS]: "Information conveyed by color remains distinguishable to viewers with common color vision deficiencies \u2014 status indicators, chart series, and other meaningful color pairings do not rely on hue combinations that are commonly confused (e.g., red/green, blue/purple)",
|
|
415
|
+
[Accessibility.COLOR_ALONE]: "Information conveyed by color is also conveyed through at least one non-color cue \u2014 text labels, icons, shapes, patterns, underlines, or position accompany any color-based meaning (e.g., required fields, error states, chart legends, link styling)"
|
|
408
416
|
};
|
|
409
417
|
function buildAccessibilityPrompt(options) {
|
|
410
418
|
const checks = options?.checks ?? [...ALL_CHECKS];
|