Skip to main content

Colors

Colors Sample Plugin Creating a Color Library Adding an existing Color Library Getting Colors from a Library Colors Colors is how you...

Updated over 2 months ago

Colors

Colors is how you manage the color resources in your garments. Use the Colors API to create your own color library, add a color library from an existing Adobe color library, and so on.

For more information about the feature, please visit here.

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

Sample Plugin

Sample plugin for the color library is available here

Creating a Color Library

Code Snippet

Browzwear allows you to programmatically add a new color library to the Browzwear's app. The API for creating a new color library receives a JSON (as a string) that contains all the information and colors for this library. For more information, refer to: schema/color/color-lib.json

Python C++ C#

Python

import BwApi
# assuming colorLibJson contains the above color library
colorLibId = BwApi.ColorLibraryCreate(garmentId, colorLibJson)

C++

// assuming colorLibJson contains the above color library
int colorLibId = 0;
BwApiColorLibraryCreate(garmentId, colorLibJson, &colorLibId);

C#

// assuming colorLibJson contains the above color library
int colorLibId = 0;
BwApi.ColorLibraryCreate(garmentId, colorLibJson, out colorLibId);

Result

adding-rgb.png

Adding an existing Color Library

You can also add an existing color library from file. Browzwear supporst Adobe files (.ASE, .ACO) and JSON color library which is compatible with the color-lib schema.

Note: the filename will be used as a library name (so filename must be unique)

Code Snippet

Python C++ C#

Python

# assuming colorLibPath contains path to a color library file (.ase, .aco or .json).
colorLibId = BwApi.ColorLibraryAdd(garmentId, colorLibPath)

C++

// assuming colorLibPath contains path to a color library file (.ase, .aco or .json).
int colorLibId = 0;
BwApiColorLibraryAdd(garmentId, colorLibPath, &colorLibId);

C#

// assuming colorLibPath contains path to a color library file (.ase, .aco or .json).
int colorLibId = 0;
BwApi.ColorLibraryAdd(garmentId, colorLibPath, out colorLibId);

Result

existing-colors.png

Getting Colors from a Library

In addition to setting the colors when creating a library you can get from an existing library.

Code Snippet

Python C++ C#

Python

colors = BwApi.ColorLibraryGetColors(garmentId, colorLibId)

C++

BwString colors;
BwApiColorLibraryGetColors(garmentId, colorLibId, colors);

C#

BwApiString colors = new BwApiString();
BwApi.ColorLibraryGetColors(garmentId, colorLibId, out colors);

Result

JSON object as a string that represents a list of color objects within the given library.
See schema.

Did this answer your question?