How to change html element after a photoshop event?

Viewed 69

I'm a colourblind artist and I've tried to make a panel that will tell me the name of the foreground colour that I have selected.

I have managed to make the panel name the colour when the HTML runs the first time, but I don't know how to make it happen repeatedly. I don't know how to use a photoshop event to make this script run.

Ideally it would run every time the user clicks or picks a colour in the colour picker.

This is the piece of code that changes the html text in the panel to the colour's name:

    <script type="text/javascript">

    var csInterface = new CSInterface();
    csInterface.evalScript('app.foregroundColor.rgb.hexValue', function (result) {

        var ntcData = ntc.name(result);
        document.getElementById("color_name").textContent = ntcData[1];
    });
    </script>

This piece of code works. I am using photoshop CC 2017

1 Answers
Related