How to use the chroma-js.hsl function in chroma-js

To help you get started, we’ve selected a few chroma-js examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github clarisights / KnitUI / src / common / styles / variables.tsx View on Github external
// TODO: Remove this and its references and use chromaPallete directly
    shades: {
      // Shades of gray
      white: chromaPalette.Neutral0,
      gray95: chromaPalette.Neutral10,
      gray90: chromaPalette.Neutral20,
      gray85: chromaPalette.Neutral30,
      gray50: chromaPalette.Neutral50,
      gray20: chromaPalette.Neutral80,
      black: chromaPalette.Neutral90,
      transparent: chroma.hsl(0, 0, 0, 0),

      // Shades of blue
      lightBlue: chromaPalette.Azure80,
      blue40: chroma.hsl(205, 0.85, 0.4),
      blue50: chroma.hsl(216, 1, 0.5),
    },

    // Properties
    lineHeight: "2rem",
    borderRadius: `${multiply(0.4, baseUnit)}px`,
    defaultPadding: `${multiply(0.4, baseUnit)}px ${baseUnit}px`,
    defaultTextPadding: "1.4rem",
    defaultBorderWidth: "0.1",

    // input
    inputFocusOutline: "none",
    inputBgDefault: "hsl(0, 0%, 95%)",
    inputColor: "hsl(0, 0%, 5%)",
    inputPlaceholderColor: "hsl(0, 0%, 60%)",
    inputPlaceholderColorActive: "hsl(0, 0%, 80%)",
github clarisights / KnitUI / src / common / styles / variables.tsx View on Github external
// TODO: Remove this and its references and use chromaPallete directly
    shades: {
      // Shades of gray
      white: chromaPalette.Neutral0,
      gray95: chromaPalette.Neutral10,
      gray90: chromaPalette.Neutral20,
      gray85: chromaPalette.Neutral30,
      gray50: chromaPalette.Neutral50,
      gray20: chromaPalette.Neutral80,
      black: chromaPalette.Neutral90,
      transparent: chroma.hsl(0, 0, 0, 0),

      // Shades of blue
      lightBlue: chromaPalette.Azure80,
      blue40: chroma.hsl(205, 0.85, 0.4),
      blue50: chroma.hsl(216, 1, 0.5),
    },

    // Properties
    lineHeight: "2rem",
    borderRadius: `${multiply(0.4, baseUnit)}px`,
    defaultPadding: `${multiply(0.4, baseUnit)}px ${baseUnit}px`,
    defaultTextPadding: "1.4rem",
    defaultBorderWidth: "0.1",

    // input
    inputFocusOutline: "none",
    inputBgDefault: "hsl(0, 0%, 95%)",
    inputColor: "hsl(0, 0%, 5%)",
    inputPlaceholderColor: "hsl(0, 0%, 60%)",
    inputPlaceholderColorActive: "hsl(0, 0%, 80%)",
    inputBgHover: "hsl(0, 0%, 90%)",
github jxnblk / diet-cola / docs / Theming.js View on Github external
render () {
    const { h, s, l } = this.state
    const bg = chroma.hsl([ h, s, l ]).css()

    const colors = {
      bg
    }

    return (
      
        
          
          Theming
          
          <div>
            
              </div>
github hturan / interaction-of-color / src / components / V.js View on Github external
handleMouseMove(event) {
    this.setState({
      color: chroma.hsl(
        0,
        0,
        Math.min(Math.max(event.pageY / event.target.clientHeight, 0.2), 0.8)
      )
    });
  }
github jxnblk / palx / palx / src / index.js View on Github external
hues.forEach(h => {
    const c = chroma.hsl(h, sat, lte)
    const key = keyword(c)
    colors.push({
      key,
      value: createShades('' + c.hex())
    })
  })
github jxnblk / cxs-components / docs / styles.js View on Github external
export const col = (...args) => chroma.hsl([
  hues[args[0]],
  sats[args[1]],
  sats[args[2]]
]).hex()
github jxnblk / colorable-app / src / utils.js View on Github external
export const hslToHex = hsl => isHsl(hsl) ? chroma.hsl(hsl).hex() : '#808080'
github hturan / interaction-of-color / src / components / Sandbox.js View on Github external
render() {
    const { hue, saturation, lightness, xAxis, yAxis, scroll } = this.state;

    return (
      <div> (this.container = ref)}
        style={{
          width: '100%',
          height: '100%',
          display: 'flex',
          alignItems: 'center',
          justifyContent: 'center',
          backgroundColor: chroma.hsl(hue, saturation, lightness)
        }}
        onMouseMove={this.handleMouseMove}
        onClick={this.handleClick}
      &gt;
        <div style="{{">
          </div></div>
github jxnblk / colorable-app / src / utils.js View on Github external
export const isHsl = hsl => {
  try {
    const color = chroma.hsl(hsl)
    return !!color
  } catch (e) {
    return false
  }
}