Skip to content

Instantly share code, notes, and snippets.

@bohdanszymanik
Created January 9, 2018 21:03
Show Gist options
  • Save bohdanszymanik/fc0babd6c7546320197fd3caf34ea50d to your computer and use it in GitHub Desktop.
Save bohdanszymanik/fc0babd6c7546320197fd3caf34ea50d to your computer and use it in GitHub Desktop.
// 12 step cold-hot colour scale from http://geog.uoregon.edu/datagraphics/color_scales.htm
let rowColourClass (x:double) (min:double) (max:double) =
let idx =
match x with
| x when x > max -> 0
| x when x < min -> 12
| _ -> (int)(Math.Round((x - min)/((max - min)/12.)))
[|"#002aff"; "#1965ff"; "#3299ff"; "#65ccff"; "#99edff"; "#ccffff"; "#ffffcc"; "#ffee99"; "#ffcc65"; "#ff9932"; "#ff6619"; "#ff2a00"|]
|> Array.rev
|> fun a -> a.[idx]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment