Open
Description
Minimal repro:
import { sourceColorFromImage, Hct } from 'https://unpkg.com/@material/material-color-utilities';
const image = new Image();
image.src = './image.png';
for (let i = 0; i < 25; i += 1) {
const source = await sourceColorFromImage(image);
console.log('source', source);
const color = Hct.fromInt(source);
console.log('color', color);
const rgbHexColor = color.argb.toString(16).slice(2);
console.log('rgbHexColor', `#${rgbHexColor}`);
}
Live demo: https://material-color-utilities-bug.web.app (just open and check the browser console).
For the same https://material-color-utilities-bug.web.app/image.png image file, the sourceColorFromImage
function returns each time either #d65a58
, #c84c52
, #d65a59
or #bb464b
.
For the other image, the results differ more dramatically (e.g. #8d8862
and #e3dbaa
).
Tested in Chrome and Firefox.