#!/usr/bin/perl use 5.014000; use strict; use warnings; use File::Slurp; use JSON::MaybeXS; open my $fh, '>', 't/snapshot-rev4.csv'; select $fh; my %tests = %{decode_json read_file 't/snapshot-rev4.json'}; my @colors = qw/xyz luv lch husl huslp/; 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/; for my $rgb8 (sort keys %tests) { next if $rgb8 =~ m/[13579bde]/i; my @cols = map { @{$tests{$rgb8}{$_}} } @colors; say join ',', substr($rgb8, 1), map { sprintf '%.4f', $_ } @cols; }