mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2026-01-01 13:03:17 +00:00
Changed color mixing to use weighted average instead of addition. Should help against values reaching FF too fast.
Adjusted color mixing helper to use inbuilt procs.
This commit is contained in:
@@ -34,7 +34,7 @@
|
||||
var/blue = mixOneColor(weight,bluecolor)
|
||||
|
||||
//assemble all the pieces
|
||||
var/finalcolor = "#[red][green][blue]"
|
||||
var/finalcolor = rgb(red, green, blue)
|
||||
return finalcolor
|
||||
|
||||
/proc/mixOneColor(var/list/weight, var/list/color)
|
||||
@@ -58,10 +58,9 @@
|
||||
mixedcolor = round(mixedcolor)
|
||||
|
||||
//until someone writes a formal proof for this algorithm, let's keep this in
|
||||
if(mixedcolor<0x00 || mixedcolor>0xFF)
|
||||
return 0
|
||||
// if(mixedcolor<0x00 || mixedcolor>0xFF)
|
||||
// return 0
|
||||
//that's not the kind of operation we are running here, nerd
|
||||
mixedcolor=min(max(mixedcolor,0),255)
|
||||
|
||||
var/finalcolor = num2hex(mixedcolor)
|
||||
while(length(finalcolor)<2)
|
||||
finalcolor = text("0[]",finalcolor) //Takes care of leading zeroes
|
||||
return finalcolor
|
||||
return mixedcolor
|
||||
|
||||
Reference in New Issue
Block a user