Pastel colours for charts

Terence Heaford t.heaford at btinternet.com
Wed Jul 23 09:43:41 EDT 2014


In a well know basic programming language for the mac I produce some charts and in determining the colours of bars and segments I use the following which I converted to the script pastelColor detailed below.

The routine in the well know basic compiler produces a nice shade of pastel for the charts but when used in LiveCode the results are rather bright and over saturated.

Does anyone know why this is the case?

Is there something wrong with my script?

Is there a better solution?

All the best

Terry

--  Dim tRedMix,tGreenMix,tBlueMix As Integer
--  Dim tRed,tGreen,tBlue As Integer
--  Dim tColor As Color

--  tRedMix = 128
--  tGreenMix = 128
--  tBlueMix = 128

--  tRed = Randomizer.InRange(0, 255)
--  tRed = Round((tRed + tRedMix)/2)

--  tGreen = Randomizer.InRange(0, 255)
--  tGreen = Round((tGreen + tGreenMix)/2)

--  tBlue = Randomizer.InRange(0, 255)
--  tBlue = Round((tBlue + tBlueMix)/2)

--  tColor = RGB(tRed,tGreen,tBlue,0)

--  return tColor



function pastelColor
   set the randomSeed to random(25000)  ??????????????
   
   put 128 into tRedMix
   put 128 into tGreenMix
   put 128 into tBlueMix
   
   put random(256) into tRed
   put round((tRed + tRedMix)/2) into tRed
   
   put random(256) into tGreen
   put round((tGreen + tGreenMix)/2) into tGreen
   
   put random(256) into tBlue
   put round((tBlue + tBlueMix)/2) into tBlue
   
   put merge("[[tRed]],[[tGreen]],[[tBlue]]") into tColor
   return tColor
end pastelColor





More information about the use-livecode mailing list