apca-introduction

The missing introduction to APCA  https://p.ce9e.org/apca-introduction/
git clone https://git.ce9e.org/apca-introduction.git

commit
f2b8d652a1abbc13d50ea13410155c712b3ffbcc
parent
71e0f37534ea7787c61f62e678e1e7d3e16dfedb
Author
Tobias Bengfort <tobias.bengfort@posteo.de>
Date
2022-07-29 11:29
more generic coverage script

Diffstat

M plots/coverage.py 16 ++++++++--------

1 files changed, 8 insertions, 8 deletions


diff --git a/plots/coverage.py b/plots/coverage.py

@@ -81,17 +81,17 @@ if __name__ == '__main__':
   81    81 	wcag = wcag_contrast(wcag_yfg, wcag_ybg)
   82    82 	wcag4 = wcag_contrast(wcag_yfg, wcag_ybg, 0.4)
   83    83 
   84    -1 	for _wcag, wcag_levels in [
   85    -1 		(wcag, WCAG_LEVELS),
   86    -1 		(wcag4, WCAG4_LEVELS),
   87    -1 		(apcai, APCA_LEVELS),
   -1    84 	for values1, levels1, values2, levels2 in [
   -1    85 		(wcag, WCAG_LEVELS, apca, APCA_LEVELS),
   -1    86 		(wcag4, WCAG4_LEVELS, apca, APCA_LEVELS),
   -1    87 		(apcai, APCA_LEVELS, apca, APCA_LEVELS),
   88    88 	]:
   89    89 		rows = []
   90    -1 		for wcag_lower, wcag_upper in iter_levels(wcag_levels):
   -1    90 		for lower1, upper1 in iter_levels(levels1):
   91    91 			rows.append([])
   92    -1 			a = (wcag_lower <= _wcag) & (_wcag < wcag_upper)
   93    -1 			for apca_lower, apca_upper in iter_levels(APCA_LEVELS):
   94    -1 				b = (apca_lower <= apca) & (apca < apca_upper)
   -1    92 			a = (lower1 <= values1) & (values1 < upper1)
   -1    93 			for lower2, upper2 in iter_levels(levels2):
   -1    94 				b = (lower2 <= values2) & (values2 < upper2)
   95    95 				v = sum(a & b) / size * 100
   96    96 				rows[-1].append(v)
   97    97 		print_table(rows)