It is not exactly clear from your question what you want to do. From what I understand you need to change color by entering the hex value which can be done simply by DOM manipulations. Below is a basic code that changes color on button clicking.
<html>
<head>
<script>
var colors = ["red", "blue", "green"];
var colorIndex = 0;
function changeColor() {
var col = document.getElementById("body");
if( colorIndex >= colors.length ) {
colorIndex = 0;
}
col.style.backgroundColor = colors[colorIndex];
colorIndex++;
}
</script>
<body id='body'>
<button onclick="changeColor();">Change color</button>
</body>
</html>
Similarly, you can just use the hex code entered in the input box and set the background/line color accordingly. You will need the help of both js and HTML, and also use if or classes as per your need.