Fix colour picker conversion (#687)

got it the wrong way around
This commit is contained in:
Corwin 2024-05-12 20:35:26 +01:00 committed by GitHub
commit 38f3dfd339
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -18,14 +18,14 @@ function fromHex(hex: string): Colour {
const c = parseInt(hex, 16);
return {
r: c & 255,
r: (c >> 16) & 255,
g: (c >> 8) & 255,
b: (c >> 16) & 255,
b: c & 255,
};
}
function toHex(colour: Colour): string {
const hex = (colour.r | (colour.g << 8) | (colour.b << 16))
const hex = ((colour.r << 16) | (colour.g << 8) | colour.b)
.toString(16)
.padStart(6, "0");