1.1.0 • Published 5 years ago
@react-vertex/hex-webgl v1.1.0
@react-vertex/hex-webgl
Documentation and Examples
Simple helper function to convert hex colors to a WebGL friendly format.
import convertHex from '@react-vertex/hex-webgl'
convertHex('#fff')
// [1, 1, 1, 1]
convertHex('#0006')
// [0, 0, 0, 0.4]
convertHex('#4183c4')
// [0.2549019607843137, 0.5137254901960784, 0.7686274509803922, 1]
convertHex('#4183c4', true) // Drop the alpha by passing true as a second param
// [0.2549019607843137, 0.5137254901960784, 0.7686274509803922]
gl.clearColor(...convertHex('#323334'))