I’ve been developing an extension to import SVG files in Sketchup; One of the final outstanding issues that I face relates to colors and materials. Sketchup has a number of ‘named’ colors that can be used for the definition of materials for faces (and edges). In a similar way, the SVG specification defines a series of named colors that can be used to define the fill and stroke properties in SVG.
Both lists with names describe 100% of the same set of colors, with identical names and RGB values. The only ‘difference’ is that the SVG list distinguishes ‘dual’ names for a number of grey/gray variants to accommodate both ways of spelling. The Sketchup named color list specifies only a single name for the same color. In addition, Sketchup is not 100% consistent w.r.t. the chosen spelling (i.e. a mixutre of ‘grey’ and ‘gray’).
As a result of this, there are more entries in the SVG list than in the Sketchup list, although the set of ‘physical’ colors is the same.
Unfortunately, importing a SVG ‘grey/gray’ color with the missing spelling variant in the Sketchup list generates an error in the Ruby script.
The ‘easiest’ way to ‘fix’ this inconsistency, would be to ‘extend’ the list of color names in Sketchup with the missing names. I’ve been playing around with a number of ‘trials and errors’, based on the Sketchup Ruby API documentation, but I can’t find out how to accomplish this.
Any help/suggestions are highly appreciated.
PS: I use Sketchup Make 2017 (might be relevant, e.g. in terms the versions of Ruby and/or the Sketchup API?)