Skip to content
Advertisement

HTML5 input type Color read single RGB values

With this code on browser many field are available by the user, it can change R,G,B, HEX VALUE, HUE ecc. I need to read only the Red value.

JavaScript

I’ve read this document but cannot figure how to get the single R value from the input.

https://developer.mozilla.org/en-US/docs/Web/HTML/Element/Input/color

Advertisement

Answer

Since you already have hexadecimal from node.value property, you just have to convert it to integer.

JavaScript
JavaScript
User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement