Skip to main content

Colorways

Colorways Getting Colorways IDs Deleting a Colorway Getting the Current Colorway Setting the Current Colorway Cloning a Colorway Getting t...

Updated over 2 months ago

Colorways

Colorway is a combination of color, seams, trims, fabrics, and artwork of a garment. Use the Colorway API to create multiple colorways for a garment, update colorway and so on.

For more information about the feature, please visit here.

To learn more about the rest of the API, please refer to Colorway in the repository.

Getting Colorways IDs

Code Snippet

Python C++ C#

Python

BwApi.GarmentColorwayIds(garment_id)

C++

BwApiGarmentColorwayIds(garmentId);

C#

BwApi.GarmentColorwayIds(garmentId);

Result

IDs of the following colorways:

all-colorways.png

Deleting a Colorway

Code Snippet

Python C++ C#

Python

# assuming colorway_id is a valid colorway ID
BwApi.ColorwayDelete(garment_id, colorway_id)

C++

// assuming colorwayId is a valid colorway ID
BwApiColorwayDelete(garmentId, colorwayId);

C#

// assuming colorwayId is a valid colorway ID
BwApi.ColorwayDelete(garmentId, colorwayId);

Result

delete.png

Getting the Current Colorway

Code Snippet

Python C++ C#

Python

current_colorway = BwApi.ColorwayCurrentGet(garment_id)

C++

int currentColorway;
BwApiColorwayCurrentGet(garmentId, &currentColorway);

C#

BwApi.ColorwayCurrentGet(garmentId, out currentColorway);

Result

The ID of the current colorway.

Setting the Current Colorway

Code Snippet

Python C++ C#

Python

# assuming the colorway_id is a valid colorway ID
BwApi.ColorwayCurrentSet(garment_id, colorway_id)

C++

// assuming the colorwayId is a valid colorway ID
BwApiColorwayCurrentSet(garmentId, colorwayId);

C#

// assuming the colorwayId is a valid colorway ID
BwApi.ColorwayCurrentSet(garmentId, colorwayId);

Result

set-colorway.png

Cloning a Colorway

Code Snippet

Python C++ C#

Python

# assuming the colorway_id is a valid colorway ID
new_colorway_id = BwApi.ColorwayClone(garment_id, colorway_id)

C++

int newColorwayId;
// assuming the colorwayId is a valid colorway ID
BwApiColorwayClone(garmentId, colorwayId, &newColorwayId);

C#

int newColorwayId;
// assuming the colorwayId is a valid colorway ID
BwApi.ColorwayClone(garmentId, colorwayId, out newColorwayId);

Result

clone.png

Getting the Material IDs of a Colorway

Code Snippet

Python C++ C#

Python

# assuming the colorway_id is a valid colorway ID
BwApi.ColorwayMaterialIds(garment_id, colorway_id)

C++

  BwApiVectorInt* materialIds = BwApiVectorIntCreate();
  // assuming the colorwayId is a valid colorway ID
BwApiColorwayMaterialIds(garmentId, colorwayId, materialIds);

C#

BwApiVectorInt materialIds = new BwApiVectorInt();
// assuming the colorwayId is a valid colorway ID
BwApi.ColorwayMaterialIds(garmentId, colorwayId, materialIds);

Result

A list of material IDs from given colorway ID.

Getting the Colorway Name

Code Snippet

Python C++ C#

Python

# assuming the colorway_id is a valid colorway ID
BwApi.ColorwayNameGet(garment_id, colorway_id)

C++

BwApiString* colorwayName = BwApiStringCreate();
// assuming the colorway_id is a valid colorway ID
BwApiColorwayNameGet(garmentId, colorwayId, colorwayName);

C#

string colorwayName;
// assuming the colorway_id is a valid colorway ID
BwApi.ColorwayNameGet(garmentId, colorwayId, out colorwayName);

Result

The name of the colorway.

Setting the Colorway Name

Code Snippet

Python C++ C#

Python

# assuming the colorway_id is a valid colorway ID
BwApi.ColorwayNameSet(garment_id, colorway_id, 'colorway name')

C++

// assuming the colorway_id is a valid colorway ID
BwApiColorwayNameSet(garmentId, colorwayId, "colorway name");

C#

string colorwayName;
// assuming the colorway_id is a valid colorway ID
BwApi.ColorwayNameSet(garmentId, colorwayId, "colorway name");

Result

set-name.png

Getting Colors in Use

Code Snippet

Python C++ C#

Python

# assuming the colorway_id is a valid colorway ID
colors_in_use = BwApi.ColorwayColorsInUseGet(garment_id, colorway_id)

C++

BwApiVectorColor* colors = BwApiVectorColorCreate();
// assuming the colorwayId is a valid colorway ID
BwApiColorwayColorsInUseGet(garmentId, colorwayId, colors);

C#

BwApiVectorColor colors = new BwApiVectorColor();
// assuming the colorwayId is a valid colorway ID
BwApi.ColorwayColorsInUseGet(garmentId, colorwayId, colors);

Result

The colors in use in a colorway. The return value from this function is an array of BwApiColor. Note: color is represented by RGB data.

Updating Colors in Use

Code Snippet

Python C++ C#

Python

# assuming the colorway_id is a valid colorway ID
BwApi.ColorwayColorsInUseUpdate(garment_id, colorway_id, src_color, dest_color)

C++

// assuming the colorwayId is a valid colorway ID
BwApiColorwayColorsInUseUpdate(garmentId, colorwayId, srcColor, destColor);

C#

// assuming the colorwayId is a valid colorway ID
BwApi.ColorwayColorsInUseUpdate(garmentId, colorwayId, srcColor, destColor);
Did this answer your question?