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

@colorblender/converter-name

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@colorblender/converter-name

Convert RGB to Name and vice versa.

  • 1.0.1
  • unpublished
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

Converter Name

Convert RGB to Name and vice versa.

Installation

This package requires the installation of the main package @colorblender/converter.

npm install @colorblender/converter @colorblender/converter-name

Import

import { rgbToName, nameToRgb } from '@colorblender/converter-name';

Usage

Model conversions

You can convert between any of the supported color models.

// name to rgb
nameToRgb(name: NameColor, rounded?: boolean): RgbColor

// rgb to name
rgbToName(rgb: RgbColor): NameColor

Example

import { rgbToName, nameToRgb } from '@colorblender/converter-name';

rgbToName({
  r: 255,
  g: 255,
  b: 255,
});

// Rounded
nameToRgb('White', true);

Conversion

You can convert any compatible model to RGB format and vice versa.

To convert two compatible and different RGB models you will have to go through a sub-conversion. For example to convert a HEX value to NAME you will have to do: HEX -> RGB -> NAME. This allows you to convert any compatible model to any other.

Keep in mind that large conversions may result in a loss of accuracy.

Supported color models

  • NAME: string

Issues

Please file an issue for bugs, missing documentation, or unexpected behavior.

File an issue

License

MIT

Keywords

FAQs

Package last updated on 04 Mar 2024

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