- Joined
- Nov 30, 2007
- Messages
- 1,202
Could someone make a function for color grading a text? I want it to color from red-orange-yellow-green starting at 0 (red) and ending at 1 (green) Probably 0.2 should be red and 0.8 should be green though. Should I just make a bunch if if statements or can I do it some other way?
Made it like this, how would you do it?
JASS:
private function GetString takes real r returns string
local integer i = R2I(r*100)
local string s
if (r < 0.2) then
set s = "|c00ff0000"
elseif (r >= 0.2 and r < 0.4) then
set s = "|c00bf3f00"
elseif (r >= 0.4 and r < 0.6) then
set s = "|c007f7f00"
elseif (r >= 0.6 and r < 0.8) then
set s = "|c003fbf00"
elseif (r >= 0.8) then
set s = "|c0000ff00"
endif
return s + I2S(i) + "%|r"
endfunction
Made it like this, how would you do it?
Last edited: