Creating Swatches

Swatches can be defined as a component of the color attribute, or set up locally for a specific product and uploaded as product images.

In the following examples, the Sylvia Capris are available in specific values of red, green, and blue. Because the swatches were taken from the product image, each is a true representation of the color. The color attribute is used to manage the information for all product colors and swatches.

Step 1: Create the Swatches

Use either of the following methods to create swatches for your products:

Method 1: Add a Color Swatch

  1. To capture the true color of a product, open the image in a photo editor and use the eye dropper tool to identify the exact color. Then, take note of the equivalent hexadecimal value.

    Hexadecimal Color Values

  2. On the Admin sidebar, go to Stores > Attributes > Product.

  3. In the grid, open the color attribute in edit mode.

  4. Verify that Catalog Input Type for Store Owner is set to Visual Swatch.

  5. Under Manage Swatch (values of your attribute), click Add Swatch. Then, do the following:

    Manage Swatch Values

    • In the Swatch column, tap the new swatch to display the menu. Then, select Choose a color.

      Choose a Color

    • In the color picker, place your cursor in the # field, and press the Backspace key to delete the current value. Then, enter the six-character hexadecimal value of the new color.

    • To save the swatch, tap the Color Wheel (  ) in the lower-right corner of the color picker.

    • In the Admin column, enter a label to describe the color to the store administrator. Then if applicable, enter the translation of the color for each language supported. In the following example, we include the SKU for reference in the Admin label because the colors are used only for a specific product. You can include a space or underscore in the label, but not a hyphen.

    • In the Is Default column, select the swatch that is to be the default option.

    • To change the order of the swatches, simply drag each swatch into position.

      Swatch Labels

  6. When complete, click Save Attribute. Then when prompted, refresh the cache.

  7. The last step is to open each product in Edit mode and update the Color attribute with the correct swatch. To update multiple products at the same time, follow the steps below.

Method 2: Upload a Swatch Image

  1. To capture an image for a swatch, open the product image in a photo editor, and save a square area of the image that depicts the color, pattern, or texture. Then repeat for each variation of the product.

    The size and dimensions of the swatch is determined by the theme. As a general rule, saving an image as a square helps to preserve the aspect ratio of a pattern.

    Swatch Images

  2. On the Admin sidebar, go to Stores > Attributes > Product.

  3. In the grid, open the color attribute in edit mode.

  4. Verify that Catalog Input Type for Store Owner is set to Visual Swatch.

  5. Under Manage Swatch (values of your attribute), click Add Swatch. Then, do the following:

    • In the Swatch column, click the new swatch to display the menu. Then, choose Upload a file.

      Upload a File

    • Navigate to the swatch file that you prepared and choose the file to upload.

    • Repeat these steps for each swatch image.

    • Enter the labels for the Admin and Storefront. In this example, we include the SKU in the admin label for reference because these colors are used only for a specific product. You can include a space or underscore in the label, but not a hyphen.

      Enter Labels

  6. When complete, click Save Attribute. Then when prompted, refresh the cache.

  7. The last step is to open each product in Edit mode and update the Color attribute with the correct swatch. To update multiple products at the same time, follow the steps below.

Step 2: Update Your Products

  1. On the Admin sidebar, go to Catalog > Products.

  2. Filter the list by Name or SKU to include only the applicable products. The following example filters the list on a partial product name.

    Filters

  3. In the grid, select the checkbox of each product to which the swatch applies. In this example, all blue capris are selected. Then, set the Actions control to Update Attributes.

    Update Attributes

  4. Scroll down to the Color attribute, and mark the Change checkbox.

    Change

  5. Choose the swatch that applies to the selected products, and click Save. Then when prompted, refresh the cache.

    Swatch in Storefront