color-js/color.js

new Color("darkred").display() returns "rgb(0.5451 0 0)"

Closed this issue · 5 comments

import Color from "https://colorjs.io/dist/color.js";
h1.textContent = new Color("darkred").display();

The resulting h1.textContent is rgb(0.5451 0 0). See it live here: https://codepen.io/sidewayss/pen/abxGMXL

rgb(0.5451 0 0), is not CSS darkred. color(srgb 0.5451 0 0) is darkred. This seemed to be working earlier today. IIRC it used to convert unit interval coordinates [0,1] to percentages for display, e.g. rgb(54.51% 0 0) is darkred.

Yes, this does look to be a bug. There are also a number of previously working tests that are now broken 😕.

There are quite a few commits made recently, we'll have to figure out which one broke the various tests (and this case as well) and fix them accordingly.

I just pushed a fix, sorry about that!

There are quite a few commits made recently, we'll have to figure out which one broke the various tests (and this case as well) and fix them accordingly.

Btw I don't push changes without checking the tests. Turns out we had no tests about serialization!! I pushed a stub so we have something to extend.

I’m going to go ahead and close this, but feel free to reopen if I missed something and it's not fixed.