User Guide Cancel

Using spot colors | Substance 3D Designer

Using spot colors

The SDSpotColorLibrary class, accessible from the SDApplication class, contains information about the spot color libraries included in Designer.

Using this class it is possible to list color books and spot colors and find specific spot colors or the closest spot color to a given RGB color.

Spot colors are not available in Designer when using OpenColorIO. In this case, app.getSpotColorLibrary() will return None.

Caution:

Spot colors are not available in Designer when using OpenColorIO. In this case, app.getSpotColorLibrary() will return None.

import sd
ctx = sd.getContext()
app = ctx.getSDApplication()
spotLib = app.getSpotColorLibrary()
# Find a color by color book and color name.
col = spotLib.findSpotColorByName(
spotColorBookName="PANTONE+ Solid Coated",
spotColorName="PANTONE Yellow 012 C"
)
print(col)
print(col.get())
print(spotLib.getSpotColorBookName(col))
print(spotLib.getSpotColorName(col))
# Find the closest spot color in a specific book, to an RGB color.
# The RGB color is specified in the working color space currently used by Designer.
col = spotLib.findClosestSpotColor(
spotColorBookName="PANTONE+ Solid Coated",
r=88 / 255.0,
g=132 / 255.0,
b=167 / 255.0
)
print(col)
print(col.get())
print(spotLib.getSpotColorBookName(col))
print(spotLib.getSpotColorName(col))
import sd ctx = sd.getContext() app = ctx.getSDApplication() spotLib = app.getSpotColorLibrary() # Find a color by color book and color name. col = spotLib.findSpotColorByName( spotColorBookName="PANTONE+ Solid Coated", spotColorName="PANTONE Yellow 012 C" ) print(col) print(col.get()) print(spotLib.getSpotColorBookName(col)) print(spotLib.getSpotColorName(col)) # Find the closest spot color in a specific book, to an RGB color. # The RGB color is specified in the working color space currently used by Designer. col = spotLib.findClosestSpotColor( spotColorBookName="PANTONE+ Solid Coated", r=88 / 255.0, g=132 / 255.0, b=167 / 255.0 ) print(col) print(col.get()) print(spotLib.getSpotColorBookName(col)) print(spotLib.getSpotColorName(col))
import sd 
 
ctx = sd.getContext() 
app = ctx.getSDApplication() 
spotLib = app.getSpotColorLibrary() 
 
# Find a color by color book and color name. 
col = spotLib.findSpotColorByName( 
    spotColorBookName="PANTONE+ Solid Coated", 
    spotColorName="PANTONE Yellow 012 C" 
) 
 
print(col) 
print(col.get()) 
 
print(spotLib.getSpotColorBookName(col)) 
print(spotLib.getSpotColorName(col)) 
 
# Find the closest spot color in a specific book, to an RGB color. 
# The RGB color is specified in the working color space currently used by Designer. 
col = spotLib.findClosestSpotColor( 
    spotColorBookName="PANTONE+ Solid Coated", 
    r=88 / 255.0, 
    g=132 / 255.0, 
    b=167 / 255.0 
) 
 
print(col) 
print(col.get()) 
print(spotLib.getSpotColorBookName(col)) 
print(spotLib.getSpotColorName(col))

Spot colors can be retrieved from and set into node properties.

import sd
from sd.api.sdbasetypes import *
from sd.api.sdvaluecolorrgba import SDValueColorRGBA
from sd.api.sdvaluespotcolor import SDValueSpotColor
ctx = sd.getContext()
app = ctx.getSDApplication()
uiMgr = app.getUIMgr()
spotLib = app.getSpotColorLibrary()
node = uiMgr.getCurrentGraphSelection()[0]
# Set RGBA color in node property.
rgbaColor = SDValueColorRGBA.sNew(ColorRGBA(0.7, 0.5, 0.2, 1))
node.setInputPropertyValueFromId("outputcolor", rgbaColor)
# Set spot color in node property.
spotColor = spotLib.findSpotColorByName(
spotColorBookName="PANTONE+ Solid Coated",
spotColorName="PANTONE Yellow 012 C"
)
node.setInputPropertyValueFromId("outputcolor", spotColor)
# Get color from node property (could be a SDValueColorRGBA or a SDValueSpotColor)
anyColor = node.getInputPropertyValueFromId("outputcolor")
# Print the RGBA components of the color.
print(anyColor.get())
# Check if the color is a spot color.
if isinstance(anyColor, SDValueSpotColor):
# Print the spot color information of the color.
print(spotLib.getSpotColorBookName(anyColor))
print(spotLib.getSpotColorName(anyColor))
import sd from sd.api.sdbasetypes import * from sd.api.sdvaluecolorrgba import SDValueColorRGBA from sd.api.sdvaluespotcolor import SDValueSpotColor ctx = sd.getContext() app = ctx.getSDApplication() uiMgr = app.getUIMgr() spotLib = app.getSpotColorLibrary() node = uiMgr.getCurrentGraphSelection()[0] # Set RGBA color in node property. rgbaColor = SDValueColorRGBA.sNew(ColorRGBA(0.7, 0.5, 0.2, 1)) node.setInputPropertyValueFromId("outputcolor", rgbaColor) # Set spot color in node property. spotColor = spotLib.findSpotColorByName( spotColorBookName="PANTONE+ Solid Coated", spotColorName="PANTONE Yellow 012 C" ) node.setInputPropertyValueFromId("outputcolor", spotColor) # Get color from node property (could be a SDValueColorRGBA or a SDValueSpotColor) anyColor = node.getInputPropertyValueFromId("outputcolor") # Print the RGBA components of the color. print(anyColor.get()) # Check if the color is a spot color. if isinstance(anyColor, SDValueSpotColor): # Print the spot color information of the color. print(spotLib.getSpotColorBookName(anyColor)) print(spotLib.getSpotColorName(anyColor))
import sd 
from sd.api.sdbasetypes import * 
from sd.api.sdvaluecolorrgba import SDValueColorRGBA 
from sd.api.sdvaluespotcolor import SDValueSpotColor 
 
ctx = sd.getContext() 
app = ctx.getSDApplication() 
uiMgr = app.getUIMgr() 
spotLib = app.getSpotColorLibrary() 
 
node = uiMgr.getCurrentGraphSelection()[0] 
 
# Set RGBA color in node property. 
rgbaColor = SDValueColorRGBA.sNew(ColorRGBA(0.7, 0.5, 0.2, 1)) 
node.setInputPropertyValueFromId("outputcolor", rgbaColor) 
 
# Set spot color in node property. 
spotColor = spotLib.findSpotColorByName( 
    spotColorBookName="PANTONE+ Solid Coated", 
    spotColorName="PANTONE Yellow 012 C" 
) 
node.setInputPropertyValueFromId("outputcolor", spotColor) 
 
# Get color from node property (could be a SDValueColorRGBA or a SDValueSpotColor) 
anyColor = node.getInputPropertyValueFromId("outputcolor") 
 
# Print the RGBA components of the color. 
print(anyColor.get()) 
 
# Check if the color is a spot color. 
if isinstance(anyColor, SDValueSpotColor): 
    # Print the spot color information of the color. 
    print(spotLib.getSpotColorBookName(anyColor)) 
    print(spotLib.getSpotColorName(anyColor)) 
 

Get help faster and easier

New user?