X-Git-Url: http://git.ieval.ro/?p=convert-color-husl.git;a=blobdiff_plain;f=snapshot-to-csv;fp=snapshot-to-csv;h=ff532ffe28c6c4ef4045789ba9ed90bed204ca01;hp=0000000000000000000000000000000000000000;hb=3d128ec5a01fb9c71fc148e246e606e82de92576;hpb=d1ec99790157d329abc74989017495fa6cbbd237 diff --git a/snapshot-to-csv b/snapshot-to-csv new file mode 100755 index 0000000..ff532ff --- /dev/null +++ b/snapshot-to-csv @@ -0,0 +1,18 @@ +#!/usr/bin/perl +use v5.14; +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) { + my @cols = map { @{$tests{$rgb8}{$_}} } @colors; + say join ',', substr($rgb8, 1), map { sprintf '%.4f', $_ } @cols; +}