I didn't find anything related on the internet.
I need a javascript code that returns me the green or red color according to the number.
But I don't want it to be static, for example the more negative the redder it gets. And the more positive, the greener it gets.
-1 and 1 would have light colors for example, 1000 and -1000 would be stronger. Similar to what is done in excel and Google Spreadsheet.
this is what i tried with the negative numbers:
detail: I don't want 255 to be the maximum or minimum
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Test</title>
</head>
<body>
<div id="number">
-100
</div>
</body>
<script>
var div = document.querySelector('#number');
var number = Number(document.querySelector('#number').innerText);
var redRgb = 255;
console.dir(redRgb + number);
div.style.color = `rgb(${redRgb + number},0,0)`;
</script>
</html>