Is it possible to convert hex value of a color to its name and vice-versa using javascript?

In the following code how to get the name of the color when the user submits the form.

    <script>
        function showColor(){
            alert(document.getElementById('color').value);
        }
    </script>
    <form action="" onsubmit="showColor()">
        <input type="color" id="color" value="#000000">
        <input type="submit">
    </form>