Create Materials / Paint Colours Palette from List of Names and RGB Values?

I am trying to create a palette of materials that conforms to a specific paint manufacturer’s palette. I have been able to extract the colour names and their RGB values from the manufacturer’s website. As there are over 200 colours, I would prefer not to create them manually. Is there a (relatively) straightforward procedure for doing so? Can I format the information in a certain way and put it in a certain place and so have SU recognise it? How difficult would it be to script it?


It seems to me there was a thread on this recently. Have you tried a search?

1 Like

I coud import with this way.

First you need to write a text file, let’s name it materials.csv
I’ll assume it’s Comma-Separated-Variables [also readable/writable in Excel etc]
Provide the format consistently thus:
then it’s easily read line by line and parsed into the Name, Red, Green, Blue [0 to 255] and Alpha [1.0 to 0] values.
If the Alpha is not important you can skip it.
Let’s assume an example of:
My Lovely Red,255,0,0,1

First set:
model=Sketchup.active_model mats=model.materials

path=UI.openpanel('Materials File...', Dir.pwd, 'materials.csv')

Now read its contents:

Now process the lines:

  line.chomp! # remove \n at the end
  next if line.empty?
  next unless line =~ /[0-9]/ # no rgb
  next if line =~ /^[#]/ # is commented out with a leading #
  n,r,g,b,a = line.split(',')
  mat=mats.add(n), g.to_i, b.to_i)
  mat.alpha= a.to_f if a

You should now have a material named ‘My Lovely Red’ that is colored red and is fully opaque.

If you process a long list ensure the model is empty and purged before starting.
Then, when its made the new materials, export the model’s materials as a new collection - you’ll get a SKM file in its folder for each material described in your CSV file…


In old times a .skm file could contain a whole bunch of colours in a simple plain text list. I found in my archives a RAL chart that someone once posted to the original atlast forum, but apparently sketchup will no longer recognize it.

Here’s a sample of what it looked like


Sketchup would actually parse the text .skm file and create a folder of .skm files from it when starting. Version 8 was the last to do it, I think. I imagine it added too much time to sketchup’s load time.

Yep, the chart opened perfectly in SketchUp 8. I don’t think it created any permanent folder of separate SKM files, though.

The RGB value is somehow hidden in the second number in the list, but I don’t remember what it meant.


Many thanks for the helpful answers and historic insights. I’ll be giving it a try once i actually manage to extract all the values I need - I thought I had but it’s not as straight forward as it first appeared.

DaveR - help or GTFO. “Did you try a search?” contributes nothing - assume the poster did and either contribute or move on without comment. That kind of reply is … churlish.

It wasn’t intended to be churlish. It was a simple question asked without malice.

I guess you found jimhami42’s post with code in your search, then. Color values to skm code

1 Like