@bnidev/js-utils
    Preparing search index...

    Function darken

    • Darkens a hex color by a given percentage.

      Parameters

      • hex: string

        The hex color string.

      • percent: number

        The percentage to darken (0-100).

      Returns string

      A new hex color string.

      // ES Module
      import { darken } from '@bnidev/js-utils'

      // CommonJS
      const { darken } = require('@bnidev/js-utils')
      darken('#ff0000', 20) // '#cc0000'
      darken('#ffffff', 50) // '#808080'