|
46 | 46 | for my $line (@lines) { |
47 | 47 | if ($line =~ m!^[*][.](color\d+|foreground|background):\s*[#]([a-fA-F0-9]{6})!) { |
48 | 48 | my ($k, $v) = ($1, $2); |
49 | | - my ($r, $g, $b) = $v =~ m!(..)(..)(..)!; |
50 | | - $spec->{$k} = [ map { hex } $r, $g, $b ]; |
| 49 | + $spec->{$k} = "0x\U$v"; |
51 | 50 | } |
52 | 51 | } |
53 | 52 | my @undefined; |
|
64 | 63 | $c_contents .= "// $file: $name -> $base\n"; |
65 | 64 | $c_contents .= "struct ansi_color_palette $real_var_name = {\n"; |
66 | 65 | $c_contents .= " \"$name\",\n"; |
67 | | - $c_contents .= sprintf " {0x%02X, 0x%02X, 0x%02X},\n", @{ $spec->{background} }; |
68 | | - $c_contents .= sprintf " {0x%02X, 0x%02X, 0x%02X},\n", @{ $spec->{foreground} }; |
| 66 | + $c_contents .= sprintf " {.rgb = %s},\n", $spec->{background}; |
| 67 | + $c_contents .= sprintf " {.rgb = %s},\n", $spec->{foreground}; |
69 | 68 | for (0..15) { |
70 | 69 | $c_contents .= " {\n" if ($_ == 0); |
71 | | - $c_contents .= sprintf " {0x%02X, 0x%02X, 0x%02X},\n", @{ $spec->{"color$_"} }; |
| 70 | + $c_contents .= sprintf " {.rgb = %s},\n", $spec->{"color$_"}; |
72 | 71 | $c_contents .= " },\n" if ($_ == 7 || $_ == 15); |
73 | 72 | $c_contents .= " {\n" if ($_ == 7); |
74 | 73 | } |
|
0 commit comments