src/ColorLib.js
/**
 * converts a number to a heat color and returns a THREE.Color object
 * @param {number} value the number that should be converted to a heat color
 * @param {number} min maximum number present in your dataframe. Default -1
 * @param {number} max minimum number present in your dataframe. Default 1
 * @param {number} hueOffset 0 means no offset. 0.5 means red turns to turqoise. 1 means the offset is so large that red is red again.
 * @return THREE.Color object
 */
converts a number to a heat color and returns a THREE.Color object
@param {number} value the number that should be converted to a heat color
@param {number} min maximum number present in your dataframe. Default -1
@param {number} max minimum number present in your dataframe. Default 1
@param {number} hueOffset 0 means no offset. 0.5 means red turns to turqoise. 1 means the offset is so large that red is red again.
converts a number to a heat color and returns a THREE . Color object @param { number } value the number that should be converted to a heat color @param { number } min maximum number present in your dataframe . Default - 1 @param { number } max minimum number present in your dataframe . Default 1 @param { number } hueOffset 0 means no offset . 0 . 5 means red turns to turqoise . 1 means the offset is so large that red is red again .
function convertToHeat(value,min=-1,max=1,hueOffset=0)
{
    let upperColorBoundary = 0+hueOffset 
    let lowerColorBoundary = 0.65+hueOffset 
    value = (value-min)/(max-min) 
    value = value * (1 - lowerColorBoundary - (1-upperColorBoundary)) + lowerColorBoundary
    return new THREE.Color(0).setHSL(value,0.95,0.55)
}
function convertToHeat ( value , min = - 1 , max = 1 , hueOffset = 0 ) { let upperColorBoundary = 0 + hueOffset let lowerColorBoundary = 0.65 + hueOffset value = ( value - min ) / ( max - min ) value = value * ( 1 - lowerColorBoundary - ( 1 - upperColorBoundary ) ) + lowerColorBoundary return new THREE . Color ( 0 ) . setHSL ( value , 0.95 , 0.55 ) }
converts a number to a heat color and returns a THREE.Color object
 @param {number} value the number that should be converted to a heat color
 @param {number} min maximum number present in your dataframe.
converts a number to a heat color and returns a THREE . Color object @param { number } value the number that should be converted to a heat color @param { number } min maximum number present in your dataframe .
// set color boundaries so that the colors are heatmap like // equals red // what the highest value will get // equals blue with a faint purple tone // what the lowest value will get // normalize // heatmap // make sure all the colors are within the defined range // return that color