INNER CODE UNIT · TypeScript

minFont

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

              minFont = Math.min(minFont, fs);
              const fg = solidOf(run.style.fill);
              if (!fg) continue;
              const required = isLarge(fs, run.style.axes?.wght ?? 400) ? 3 : 4.5;
              const ratio = contrastRatio(fg, bg);
              if (ratio < required && (!worst || ratio < worst.ratio)) worst = { ratio, required };
            }
          }
          if (worst) {
            issues.push({
              nodeId: node.id,
              nodeName: name,
              pageIndex,
              kind: "contrast",
              severity: worst.ratio < 3 ? "error" : "warning",
              message: `Low text contrast (${worst.ratio.toFixed(1)}:1; WCAG AA needs ${worst.required}:1)`,
              messageCode: "a11y.low_text_contrast",
              messageParams: { ratio: worst.ratio.toFixed(1), required: worst.required },

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…