Xref: utzoo alt.graphics.pixutils:1089 comp.graphics:17734 Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!sdd.hp.com!spool.mu.edu!snorkelwacker.mit.edu!bloom-beacon!eru!hagbard!sunic!mcsun!ukc!dcl-cs!gdt!ee9jan From: ee9jan@gdt.bath.ac.uk (J A Nicholls) Newsgroups: alt.graphics.pixutils,comp.graphics Subject: Colour Spectrum. Message-ID: <1991May2.112003.12727@gdt.bath.ac.uk> Date: 2 May 91 11:20:03 GMT Article-I.D.: gdt.1991May2.112003.12727 Distribution: eunet Organization: School of Electrical Engineering, University of Bath, UK Lines: 26 Does anybody know of any equations that will approximate to a colour spectrum ? I am trying to generate a simulated spectrum based on temperature, ie 0 degrees = Blue, 100 degrees = red with the intermediate temperatures being shown by the appropriate colour of the spectrum. The format is in 24 bit raw bitmap so I need an equation for each of the RGB components. At the moment I am using the following equations :- R = (char)(temp>=50.0 ? 255.0*(temp/50-1) : 0) G = (char)(temp<=50.0 ? 255.0*(temp/50) : 255.0*(2-temp/50)) B = (char)(temp<=50.0 ? 255.0*(1-temp/50) : 0) to calculate a value for each colour from 0 to 255. This does produce a 'spectrum' but it looks very false also it doesn't seem to develop the secondary colours at all well. Any help appreciated. Jez. -- Jez Nicholls "Marmalade, I like marmalade.", "Ooh me flakes." #include "disclaimer.h" These quotes courtesy of Alan. (APB AHM PF 1971)