Skip to content

Commit 3308b50

Browse files
authored
fix: Fix Philips Hue gradient color encoding (#8409)
1 parent 39eef27 commit 3308b50

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/lib/philips.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ const encodeRGBToScaledGradient = (hex: string) => {
2222
const xy = ColorRGB.fromHex(hex).toXY();
2323
const x = (xy.x * 4095) / 0.7347;
2424
const y = (xy.y * 4095) / 0.8413;
25-
const xx = Math.round(x).toString(16);
26-
const yy = Math.round(y).toString(16);
25+
const xx = Math.round(x).toString(16).padStart(3, '0');
26+
const yy = Math.round(y).toString(16).padStart(3, '0');
2727

2828
return [xx[1], xx[2], yy[2], xx[0], yy[0], yy[1]].join('');
2929
};

0 commit comments

Comments
 (0)