got it the wrong way around

This commit is contained in:
Corwin 2024-05-12 20:15:18 +01:00
parent bdc799af36
commit 5f0d2d01a5
No known key found for this signature in database

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");