Convert any quantity to RGB color
npm install temp-color!version
!size
!downloads
!build

!license
npm i temp-color
yarn add temp-color
``js
import { tempToColor } from 'temp-color';
const { r, g, b } = tempToColor(10, -30, 30);
const { r, g, b } = tempToColor(10, 0, 100, 'half');
const { r, g, b } = tempToColor(10, -30, 30, 'extended');
`Parameters
``
tempToColor = (t: number, min: number, max: number, mode?: string) : {r: number, g: number, b: number}
#### Function takes four parameters:
* _t_ - value that will be scaled into RGB
* _min_ - lowest possible value (scale begins there)
* _max_ - highest possible value (scale ends there)
* _mode_ - OPTIONAL
#### Function returns an object with calculated RGB values
#### Change background dynamically based on a value set by a range slider
`js
import {tempToColor} from 'temp-color';
let isHeld = false;
const box = document.querySelector("#box");
const slider = document.querySelector("#slider");
slider.addEventListener('mousedown', () => {
isHeld = true;
});
slider.addEventListener('mouseup', () => {
isHeld = false;
});
slider.addEventListener('mousemove', () => {
if (isHeld) {
const {r,g,b} = tempToColor(parseFloat(slider.value), parseInt(slider.min), parseInt(slider.max));
box.style.background = rgb(${r},${g},${b});
}
});
``