Oliv / ratio-rgb-generator

Returns a rgb color from green to red from a ratio

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Ratio RGB generator

Returns a rgb color from green to red from a ratio between 0 and 1

Installation

$ npm install https://github.com/Oliv/ratio-rgb-generator.git

Usage

import generateRGB from 'ratio-rgb-generator';

generateRGB(ratio);

To get a speed ratio :

import generateRGB from 'ratio-rgb-generator';

const fn = (min, max, x) => x / (max - min);
const ratio = fn(minSpeed, maxSpeed, speed);

generateRGB(ratio);

About

Returns a rgb color from green to red from a ratio

License:Other


Languages

Language:JavaScript 100.0%