INNER CODE UNIT · TypeScript

solidOf

hyscaler/HyCanvas · packages/a11y/src/index.ts:46

function solidOf(fill: Fill | undefined): Color | null {
  if (!fill) return null;
  if (fill.type === "solid") return fill.color;
  if (fill.type === "gradient" && fill.stops[0]) return fill.stops[0].color;
  return null;
}

/** WCAG "large text" = >= 24px, or >= 18.66px when bold (>=700). */
function isLarge(fontSize: number, weight: number): boolean {
  return fontSize >= 24 || (fontSize >= 18.66 && weight >= 700);
}

/** Audit a design file. Returns one issue per problem, in page/visit order. */
export function checkAccessibility(doc: DesignFile): A11yIssue[] {
  const issues: A11yIssue[] = [];
  // Slide titles (doc 28 FR-3/FR-29): every slide in a deck needs a name, or a
  // screen-reader user cannot navigate the presentation. Single-page designs
  // are not decks, so they are exempt.

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…