Color layer to Color Palette layer (SVG to COLR)

Hello!

I have one Color layer where each glyph contains a few paths painted in different colors (there are about 15-20 colors in general for all glyphs). I made it following the Option C: native Color layers tutorial.

Is it possible to convert such a Color layer to Color Palette layer, with moving each colored path to its appropriate palette sublayer? In the case the palette will be predefined respected to Microsoft color font tutorial.

Basically, I want to add COLRv1 support to an SVG table that I have already. I saw the tutorial on converting COLR to SVG (by using the custom parameters), but not the other way around.

Should I write a script for this, or there is some easier way exist?

Thanks.

There is currently no such option.

And you mean COLRv0 (not 1). Support for CORLv1 is coming.

I understood, thanks Georg. I’ll try to automate it with a script then.
And yes, I mean COLR table in general.

Here a script to convert one Color layer to multiple Color Palette layers linked to fallback.

Params:

  • colorLayerName = “Master name”|None. Set the name like “Regular” to specify the Color layer, or None to use the selected master.
  • fallbackLayerName = “Master name”|None. Set the master name like “Regular” to set it as the fallback layer, or None to use existed Color layer
  • groupSameColors = True|False. Place the same colors on one layer if True, or on different layers if False.

The steps the script takes:

  • Add an empty Color Palette to the Font Info.
  • Get every path color from Color layer and add it to the Color Palette if it is not there yet.
  • Check if the layer with such a color exist or not. It’s also depends on the groupSameColors param (that is True by default) that you can set at the line 8 of the script.
  • Copy path to a new Color Palette layer (or to an existed one depending on the previous step).
  • Link the new Color Palette layer to the fallback layer.
  • Focus on fallback layer if set in params.
1 Like