Convert snapshot to CSV for faster tests and a smaller dist
[convert-color-husl.git] / snapshot-to-csv
CommitLineData
3d128ec5
MG
1#!/usr/bin/perl
2use v5.14;
3use warnings;
4
5use File::Slurp;
6use JSON::MaybeXS;
7
8open my $fh, '>', 't/snapshot-rev4.csv';
9select $fh;
10
11my %tests = %{decode_json read_file 't/snapshot-rev4.json'};
12my @colors = qw/xyz luv lch husl huslp/;
13
14say 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/;
15for my $rgb8 (sort keys %tests) {
16 my @cols = map { @{$tests{$rgb8}{$_}} } @colors;
17 say join ',', substr($rgb8, 1), map { sprintf '%.4f', $_ } @cols;
18}
This page took 0.009107 seconds and 4 git commands to generate.