Converter HKS
Convert RGB to HKS and vice versa.
Installation
This package requires the installation of the main package @colorblender/converter
.
npm install @colorblender/converter @colorblender/converter-hks
Import
import { rgbToHks, hksToRgb } from '@colorblender/converter-hks';
Usage
Model conversions
You can convert between any of the supported color models.
hksToRgb(hks: HksColor, rounded?: boolean): RgbColor
rgbToHks(rgb: RgbColor): HksColor
Example
import { rgbToHks, hksToRgb } from '@colorblender/converter-hks';
rgbToHks({
r: 255,
g: 255,
b: 255,
});
hksToRgb('41-E', 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 HKS you will have to do: HEX -> RGB -> HKS. 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
Issues
Please file an issue for bugs, missing documentation, or unexpected behavior.
File an issue
License
MIT