A custom React Hook that provides a context for color data. This is designed to be used with the export object from https://colorlab.dev
$ npm install use-colorlab
import{ColorProvider}from'use-colorlab';constcolors={red: {10: {hex: "#f00",},default: {hex: "#c00"}}}constApp=()=>(<ColorProvidercolors={colors}>{/* ... */}</ColorProvider>);Under the ColorProvider context, the useColorlab hook will give access to color functions
import{useColorlab}from'use-colorlab';constMyComponent=()=>{const{red}=useColorlab();return(<h1style={{color: red()}}>Hello, world!</h1>)}The api for each color function takes the form of [color](stop: number, format: string)
purple()// #6953eb - The hex code for the default stoppurple(80)// #3f20ba - Hex code for stop 80purple('css')// rgb(105,83,235) - css rgb value for the default stoppurple(30,'hsl')// hsl(246.23,81.05%,81.37%) - hsl value for stop 30