For example, the hex code #ff0000 is just red, no green or blue, and is equivalent to rgb(255, 0, 0). Constructing an instance of LegacyColor with these values results in r == 0, g == 0, b == 255:
new LegacyColor(255, 0, 0)
/*
sass.types.Color {
inner: SassColor {
redInternal: 0,
greenInternal: 0,
blueInternal: 255,
alphaInternal: 1
}
}
*/
I'm pretty sure this line is the culprit. If either green or blue are falsy, which 0 is, then the code acts as if the constructor(argb: number) variant was called. I think these should be stricter checks so that 0 doesn't trigger the wrong logical branch.
I understand that this is a deprecated API but I'd love to see it be fixed. I'd be happy to put together a pull request if you'd like.
Thanks in advance!