code wiki / _hdl_build / nx_contrast.nx

nx_contrast.nx

buildroot/runtime/_hdl_build/nx_contrast.nx

4451 B91 linesdepth 6pulls 7 transitivereach 0 importersview sourcekind tool
docsdependenciesstructsconstsfunctions

about

nx_contrast.nx -- SOVEREIGN WCAG 2.1 + APCA contrast CLI. ★CONSOLIDATED 2026-07-21: the luminance/contrast/APCA KERNEL now lives in nx_uiq_color (the ONE family contrast kernel); this is a THIN CLI over it (OO consolidation, D001 migrate-on-touch). The duplicate srgb_lin/lum/ratio100/apca_* that used to live here are DELETED -> no behaviour lost, one source of truth. Behaviour-preserving, PROVEN by --kat reproducing the reference values (21.00 / 4.54 / APCA 106.0 / -107.9 / 63.1). usage: nx_contrast <fg-hex> <bg-hex> e.g. nx_contrast 767676 ffffff | nx_contrast "#000" "#fff" emits JSON: {"fg","bg","ratio","aa","aaa","aa_large","apca_lc"} | --kat runs the reference battery license_tier: ORIGINAL genealogy: w3.org/TR/WCAG21 relative-luminance + contrast-ratio

dependencies 1 imports · 0 importers

nx_uiq_color.nx nx_contrast.nx

imports: nx_uiq_color.nx

imported by: nobody (leaf or entry point)

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main run_kat uiq_w sys_write uiq_ratio100 uiq_lum nx_f64_mul nx_f64_classify nx_f64_exp_field nx_f64_mant_field nx_f64_sign nx_f64_mant_field ↻ nx_f64_exp_field ↻ _f64_round_pack uiq_f64c nx_f64_div nx_f64_classify ↻ nx_f64_sign ↻ nx_f64_mant_field ↻ nx_f64_exp_field ↻ _f64_round_pack ↻ nx_i64_to_f64 _f64_round_pack ↻ uiq_srgb_lin uiq_f64c ↻ nx_f64_div ↻ nx_f64_add nx_f64_classify ↻ nx_f64_sign ↻ nx_f64_mant_field ↻ nx_f64_exp_field ↻ _f64_round_pack ↻ nx_f64_pow _pw_ycls sys_mmap _pw_log2m nx_f64_add ↻ nx_f64_mul ↻ nx_f64_sub _pw_flt

structs

none

consts

10const K_MAGIC_2100: i64 = 2100
11const K_MAGIC_1050: i64 = 1050
12const K_MAGIC_1070: i64 = 1070
13const K_MAGIC_1090: i64 = 1090

functions

16func parse_hex(s: *u8, out: *i64) -> i64
called by 1: main calls 1: uiq_hxn
24func pbool(b: i64) -> i64 { if b==1 { uiq_w("true" as *u8) } else { uiq_w("false" as *u8) } return 0 }
called by 1: main calls 1: uiq_w
25func papca(v: i64) -> i64
called by 2: run_katmain calls 2: uiq_wuiq_pn
32func run_kat() -> i64
63func main(argc: i64, argv: *i64) -> i64