Skip to content

VladimirKalachikhin/value2color

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

value2color License: GPLv3

A simple JavaScript function to represent a value by a color intermediate between two specified colors.
For example, to create a color scale.

Usage

<script src="value2color/value2color.js"></script>
color = value2color(value[,minvalue[,maxvalue[,minColor[,maxColor[,underMinColor[,upperMaxColor]]]]]])

Where:

  • value <Number> - represented value
  • minvalue <Number> - the begin of the range of values, default 0
  • maxvalue <Number> - the end of the range of values, default 10
  • minColor <Array> or <String> - the begin of the range of colors, color for minvalue, array [r,g,b] or html color string: rgb(r,g,b) or #rrggbb. Default rgb(255,0,0)
  • maxColor <Array> or <String> - the end of the range of colors, color for maxvalue, array [r,g,b] or html color string: rgb(r,g,b) or #rrggbb. Default rgb(0,255,0)
  • underMinColor <String> - color for values less than minvalue, html color string: rgb(r,g,b) or #rrggbb. Default rgb(155,0,0)
  • upperMaxColor <String> - color for values more than maxvalue, html color string: rgb(r,g,b) or #rrggbb. Default rgb(200,250,240)

Return: <String> html color string "rgb(r,g,b)"

About

A simple JavaScript function to represent a value by a color intermediate between two specified colors.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published