Colour Picker component

Configure the Colour Picker component

5 min read
There are a few steps required to add the Colour Picker component to a page in Drupal.

PIM controls all product data including colours so the first thing to do is check that the colour you want to add has been configured in PIM. 

Secondly, you will need to navigate to the Colour Swatches taxonomy in Drupal and click 'List Terms'

Structure>Taxonomy>Colour Swatches
Fig 1.0: Structure>Taxonomy>Colour Swatches

Find the name of the colour you want to add and click 'Edit'.

Blue Monday > Edit
Fig 2.0: Blue Monday > Edit

Once inside the Colour Swatch you want to add, you will need to configure the background colour, text colour, label colour and card text colour. 

To configure the background colour, you will need to click inside the color box and use the eyedropper to grab the correct RGB from the background PNG. You then need to set the opacity to 1.

Background Colour
Fig 3.0: Background Colour

To configure the Text Colour you will need to click inside the color box and set the RGB values to be 30 higher than the respective values in the Background Colour box. In this example the background colour values are as follows: R 61 G 91 B 95 , therefore we need to set the Text Colour values to be R 91 G 121 B 125. You then need to set the opacity to 1.

Text Colour RGB
Fig 4.0: Text Colour RGB

The label colour should be set to white which has a value of R 255 G 255 B 255 and you need to set the opacity to 1.

Label Colour RGB
Fig 5.0: Label Colour RGB

The Card Text Colour can be set to either 'Light' or 'Dark'.

Card Text Colour
Fig 6.0: Card Text Colour.

Then click 'Save'.

Save
Fig 7.0: Save

Next, you will navigate to the page you want to add the Colour Picker component to and add a new full width section. To that section you will add the Colour Picker component.

Add Section > Add Block > Colour Picker
Fig 8.0: Add Section > Add Block > Colour Picker

Just like the Product Listing component you will select the Product Type and Category that you would like to have included in this section. You will then configure the Colour Picker as shown below, setting the default colour to one of your choice and selecting the available colours you want to include. 

Config of component
Fig 9.0: Icons filter Title: Colour Picker, Target Attribute: variantTitle, Swatches Taxonomy Vocabulary: Colour Swatches (variant_icons_map), Default Colour: Anthracite.

Click 'Add Block' and save the new layout of your page. 

You will then see all of the colours that you selected with the default colour underlined and active. 

The complete Colour Picker
Fig 10: The complete Colour Picker.