Question

Anyone know if it's possible to colour the cells of a Google Docs spreadsheet with their values? The cells are populated with CMYK codes.

Cheers!

Was it helpful?

Solution

I've written a rough CMYK-to-RGB converter for Rails the logic from which could be applied anywhere. See below.

def paint(co1)
  c1, m1, y1, k1 = co1.split(",") 
  c2, m2, y2, k2 = co2.split(",") 

  c1 = c1.to_i*2.55 
  m1 = m1.to_i*2.55 
  y1 = y1.to_i*2.55 
  k1 = k1.to_i*2.55 

  if c1.to_i + k1.to_i < 255 
    @r1 = 255 - (c1.to_i + k1.to_i) 
  else 
    @r1 = 0 
  end 

  if m1.to_i + k1.to_i < 255 
    @g1 = 255 - (m1.to_i + k1.to_i) 
  else 
    @g1 = 0 
  end 

  if y1.to_i + k1.to_i < 255 
    @b1 = 255 - (y1.to_i + k1.to_i) 
  else 
    @b1 = 0 
  end 

  return @r1, @b1, @g1
end
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top