Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

rgb2hex

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rgb2hex

lightweight rgb/rgba to hex parser

  • 0.1.8
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created

What is rgb2hex?

The rgb2hex npm package is a utility that allows you to convert RGB color values to hexadecimal color codes. This can be useful in various scenarios such as web development, graphic design, and any other field where color manipulation is required.

What are rgb2hex's main functionalities?

Convert RGB to Hex

This feature allows you to convert an RGB color string to its hexadecimal representation. In this example, the RGB color 'rgb(255, 0, 0)' is converted to the hex color '#ff0000'.

const rgb2hex = require('rgb2hex');
const hexColor = rgb2hex('rgb(255, 0, 0)');
console.log(hexColor); // { hex: '#ff0000', alpha: 1 }

Convert RGBA to Hex

This feature allows you to convert an RGBA color string to its hexadecimal representation, including the alpha value. In this example, the RGBA color 'rgba(255, 0, 0, 0.5)' is converted to the hex color '#ff0000' with an alpha value of 0.5.

const rgb2hex = require('rgb2hex');
const hexColor = rgb2hex('rgba(255, 0, 0, 0.5)');
console.log(hexColor); // { hex: '#ff0000', alpha: 0.5 }

Other packages similar to rgb2hex

Keywords

FAQs

Package last updated on 05 Jul 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc