#include colour.js

const MamiColourPickerValueHex = function() {
    let onChange = () => {};

    const html = <input class="colpick-values-child-input"
        type="text" value="" onchange={() => {
            try {
                onChange(MamiColour.fromHex(html.value));
            } catch(ex) {}
        }}/>;

    return {
        getElement: () => html,
        onChange: handler => onChange = handler,
        updateColour: colour => html.value = MamiColour.hex(colour),
    };
};
