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

hex-rgb

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hex-rgb

Convert HEX color to RGBA

  • 4.3.0
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created

What is hex-rgb?

The hex-rgb npm package is used to convert hexadecimal color values to RGB (Red, Green, Blue) format. This can be useful in various scenarios such as web development, graphic design, and any other field where color manipulation is required.

What are hex-rgb's main functionalities?

Convert HEX to RGB

This feature allows you to convert a hexadecimal color code to its RGB representation. The output is an object containing the red, green, blue, and alpha (opacity) values.

const hexRgb = require('hex-rgb');
const rgb = hexRgb('#ff0000');
console.log(rgb); // { red: 255, green: 0, blue: 0, alpha: 1 }

Convert HEX to RGB with Alpha

This feature allows you to convert a hexadecimal color code that includes an alpha (opacity) value to its RGBA representation. The output is an object containing the red, green, blue, and alpha values.

const hexRgb = require('hex-rgb');
const rgba = hexRgb('#ff000080');
console.log(rgba); // { red: 255, green: 0, blue: 0, alpha: 0.5 }

Convert Short HEX to RGB

This feature allows you to convert a short hexadecimal color code (3 characters) to its RGB representation. The output is an object containing the red, green, blue, and alpha values.

const hexRgb = require('hex-rgb');
const rgb = hexRgb('#f00');
console.log(rgb); // { red: 255, green: 0, blue: 0, alpha: 1 }

Other packages similar to hex-rgb

Keywords

FAQs

Package last updated on 07 Apr 2021

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