| 1 | #!/usr/bin/perl |
| 2 | use 5.014000; |
| 3 | use strict; |
| 4 | use warnings; |
| 5 | |
| 6 | use File::Slurp; |
| 7 | use JSON::MaybeXS; |
| 8 | |
| 9 | open my $fh, '>', 't/snapshot-rev4.csv'; |
| 10 | select $fh; |
| 11 | |
| 12 | my %tests = %{decode_json read_file 't/snapshot-rev4.json'}; |
| 13 | my @colors = qw/xyz luv lch husl huslp/; |
| 14 | |
| 15 | say join ',', qw/rgb8 xyz_x xyz_y xyz_z luv_l luv_u luv_v lch_l lch_c lch_h husl_h husl_s husl_l huslp_h husl_s husl_l/; |
| 16 | for my $rgb8 (sort keys %tests) { |
| 17 | next if $rgb8 =~ m/[13579bde]/i; |
| 18 | my @cols = map { @{$tests{$rgb8}{$_}} } @colors; |
| 19 | say join ',', substr($rgb8, 1), map { sprintf '%.4f', $_ } @cols; |
| 20 | } |