1.0.0 • Published 2 months ago

@colorblender/converter-ral v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
2 months ago

Installation

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

npm install @colorblender/converter @colorblender/converter-ral

Import

import { rgbToRal, ralToRgb } from '@colorblender/converter-ral';

Usage

Model conversions

You can convert between any of the supported color models.

// ral to rgb
ralToRgb(ral: RalColor, rounded?: boolean): RgbColor

// rgb to ral
rgbToRal(rgb: RgbColor): RalColor

Example

import { rgbToRal, ralToRgb } from '@colorblender/converter-ral';

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

// Rounded
ralToRgb('1001', 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 RAL you will have to do: HEX -> RGB -> RAL. 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

  • RAL: string

Issues

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

File an issue

License

MIT