code wiki / _hdl_build / nx_uiq_color.nx

nx_uiq_color.nx

buildroot/runtime/_hdl_build/nx_uiq_color.nx

19388 B405 linesdepth 5pulls 6 transitivereach 14 importersview sourcekind librarytopic uiq
docsdependenciesstructsconstsfunctions

about

nx_uiq_color.nx -- SOVEREIGN UI-QUALITY color engine (no main). The ONE WCAG 2.x relative-luminance + contrast-ratio implementation for the whole nx_uiq_* family, PLUS a CSS color parser (#rgb/#rrggbb/rgb()/named) and a custom-property color-token scanner, so the family computes contrast on the REAL colors extracted from a page instead of one hardcoded token pair. The math is reused verbatim from nx_contrast (KAT'd to the WCAG reference black/white=21.00, #767676/white=4.54). CONSOLIDATION SEED: nx_contrast + nx_ui_contrast + nx_brand_guard migrate onto this on next touch (D001 migrate-on-touch), collapsing 3 duplicate luminance kernels -> 1. license_tier: ORIGINAL genealogy: w3.org/TR/WCAG21 relative-luminance + contrast-ratio (verbatim)

dependencies 6 imports · 5 importers

nx_syscalls.nx nx_tier.nx nx_f64.nx nx_f64_div.nx nx_f64_cvt.nx _pe_f64pow.nx nx_uiq_color.nx nx_contrast.nx nx_uiq_console_lib.nx nx_uiq_contrast.nx nx_uiq_contrast_gate.nx nx_uiq_perf.nx

imports: nx_syscalls.nxnx_tier.nxnx_f64.nxnx_f64_div.nxnx_f64_cvt.nx_pe_f64pow.nx

imported by: nx_contrast.nxnx_uiq_console_lib.nxnx_uiq_contrast.nxnx_uiq_contrast_gate.nxnx_uiq_perf.nx

structs

none

consts

15const K_MAGIC_1292: i64 = 1292
16const K_MAGIC_1055: i64 = 1055
17const K_MAGIC_2126: i64 = 2126
18const K_MAGIC_10000: i64 = 10000
19const K_MAGIC_7152: i64 = 7152
20const K_MAGIC_1000000: i64 = 1000000
21const K_MAGIC_2100: i64 = 2100
22const K_MAGIC_767676: i64 = 767676
23const K_MAGIC_2126729: i64 = 2126729
24const K_MAGIC_10000000: i64 = 10000000
25const K_MAGIC_7151522: i64 = 7151522
26const K_MAGIC_721750: i64 = 721750
27const K_MAGIC_22000: i64 = 22000
28const K_MAGIC_1414: i64 = 1414
29const K_MAGIC_100000: i64 = 100000

functions

32func uiq_w(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 }
33func uiq_pn(v: i64) -> i64
44func uiq_pratio(r100: i64) -> i64
50func uiq_wslice(base: *u8, off: i64, len: i64) -> i64 { sys_write(1, ((base as i64)+off) as *u8, len); return 0 }
53func uiq_f64c(num: i64, den: i64) -> i64 { return nx_f64_div(nx_i64_to_f64(num), nx_i64_to_f64(den)) }
54func uiq_hxn(c: i64) -> i64
61func uiq_srgb_lin(c: i64) -> i64
68func uiq_lum(r: i64, g: i64, b: i64) -> i64
75func uiq_ratio100(fr: i64, fg: i64, fb: i64, br: i64, bg: i64, bb: i64) -> i64
89func uiq_clip(v: i64) -> i64 { if v<0 { return 0 } if v>255 { return 255 } return v }
called by 1: uiq_three_ints
90func uiq_hex2(base: *u8, off: i64) -> i64 { return uiq_hxn(base[off] as i64)*16 + uiq_hxn(base[off+1] as i64) }
called by 1: uiq_parse_color calls 1: uiq_hxn
91func uiq_hex1(base: *u8, off: i64) -> i64 { let h: i64=uiq_hxn(base[off] as i64); return h*16+h }
called by 1: uiq_parse_color calls 1: uiq_hxn
93func uiq_three_ints(base: *u8, off: i64, len: i64, out: *i64) -> i64
called by 1: uiq_parse_color calls 1: uiq_clip
106func uiq_word_eq(base: *u8, off: i64, len: i64, lit: *u8) -> i64
112func uiq_parse_color(base: *u8, off: i64, len: i64, out: *i64) -> i64
134func uiq_scan_tokens(buf: *u8, n: i64, toff: *i64, tlen: *i64, trgb: *i64, cap: i64) -> i64
169func uiq_name_eq(buf: *u8, off: i64, len: i64, lit: *u8) -> i64
called by 1: uiq_is_text
175func uiq_name_has(buf: *u8, off: i64, len: i64, lit: *u8) -> i64
188func uiq_is_text(buf: *u8, off: i64, len: i64) -> i64
204func uiq_is_surface(buf: *u8, off: i64, len: i64) -> i64
called by 1: uiq_audit_table calls 1: uiq_name_has
215func uiq_find(buf: *u8, n: i64, pat: *u8) -> i64
called by 1: uiq_audit_buf
227func uiq_names_equal(buf: *u8, o1: i64, l1: i64, o2: i64, l2: i64) -> i64
called by 1: uiq_audit_buf
236func uiq_audit_table(buf: *u8, uoff: *i64, ulen: *i64, rgb: *i64, un: i64, flags: i64) -> i64
277func uiq_audit_buf(buf: *u8, n: i64, emit: i64) -> i64
334func uiq_selftest() -> i64
372func uiq_apca_exp(c: i64) -> i64 { return nx_f64_pow(uiq_f64c(c, 255), uiq_f64c(24, 10)) }
called by 1: uiq_apca_y calls 2: nx_f64_powuiq_f64c
373func uiq_apca_y(r: i64, g: i64, b: i64) -> i64
386func uiq_apca_lc10(fr: i64, fg: i64, fb: i64, br: i64, bg: i64, bb: i64) -> i64