shuhei / colortty

🎨 A utility to generate color schemes for alacritty
MIT License
68 stars 3 forks source link

Fix conversion of iTerm color scheme with Color Space #13

Closed shuhei closed 4 years ago

shuhei commented 4 years ago

Fixing a bug in parsing of iTerm color scheme with Color Space.

For example, the following color definition caused the bug.

<key>Ansi 0 Color</key>
<dict>
  <key>Alpha Component</key>
  <real>1</real>
  <key>Blue Component</key>
  <real>0.25882354378700256</real>
  <key>Color Space</key>
  <string>Calibrated</string>
  <key>Green Component</key>
  <real>0.22745098173618317</real>
  <key>Red Component</key>
  <real>0.21960784494876862</real>
</dict>

The previous parsing logic was extracting a list of keys and a list of reals and zipping the two lists. As a result, the Color Space key got the Green Component's value and the Green Component got the Red Component's value while Red Component key didn't get any value.