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

    Function rgbToHex

    • Converts an RGB color to a hex string.

      Parameters

      • r: number

        Red value (0-255).

      • g: number

        Green value (0-255).

      • b: number

        Blue value (0-255).

      Returns string

      A hex color string (without #).

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

      // CommonJS
      const { rgbToHex } = require('@bnidev/js-utils')
      rgbToHex(255, 0, 0) // 'ff0000'
      rgbToHex(0, 255, 0) // '00ff00'