Novice Pokémon Master

    simple-rgb-hex-converter

    1.0.3 • Public • Published

    Simple RGB-HEX Converter

    This converts CSS hex code to RGB code, and vice versa.

    Usage

    const simpleRgbHexConverter = require('simple-rgb-hex-converter');
     
    const rgbCode = simpleRgbHexConverter.converter('#f60387');
    console.log(rgbCode); //'rgb(246, 3, 135)'
     
    const hexCode = simpleRgbHexConverter.converter('rgb(246, 3, 135)');
    console.log(hexCode); //'#f60387'

    Generate Random Hex Code

    const randomHex = simpleRgbHexConverter.generateRandomHex();

    Generate Random RGB Code

    const randomRgb = simpleRgbHexConverter.generateRandomRGB();

    These are also valid inputs

    const rgbCode = simpleRgbHexConverter.converter('#f03'); //same as '#ff0033'
    const rgbCode = simpleRgbHexConverter.converter('f03'); //same as '#ff0033'
    const rgbCode = simpleRgbHexConverter.converter('ff0033'); //same as '#ff0033'
     
    const hexCode = simpleRgbHexConverter.converter('(246, 3, 135)'); //same as 'rgb(246, 3, 135)'
    const hexCode = simpleRgbHexConverter.converter('(246 3 135)'); //same as 'rgb(246, 3, 135)'
    const hexCode = simpleRgbHexConverter.converter('246, 3, 135'); //same as 'rgb(246, 3, 135)'
    const hexCode = simpleRgbHexConverter.converter('246 3 135'); //same as 'rgb(246, 3, 135)'
    const hexCode = simpleRgbHexConverter.converter('RGB(246, 3, 135)'); //same as 'rgb(246, 3, 135)'

    Install

    npm i simple-rgb-hex-converter

    DownloadsWeekly Downloads

    9

    Version

    1.0.3

    License

    MIT

    Unpacked Size

    10.1 kB

    Total Files

    3

    Last publish

    Collaborators

    • polzak