Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.
SOLVED

store color field in hex code format

Avatar

Level 3

Hi,

 

How to store the textColor value under jcr:content in hex code format?

Currently it gets stored in rgb format

 

<textColor
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/coral/foundation/form/colorfield"
fieldLabel="Text Color"
name="./textColor"
showDefaultColors="{Boolean}false"
showProperties="{Boolean}true"
value="#000000"
variant="swatch">
</textColor>

 

Thanks in advance!

 
1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi,

If you choose from RGB then it will save as RGB value otherwise hex

 

chrome-capture-2022-8-29.gif

 

you can change this value on dialog submit example https://github.com/arunpatidar02/aem63app-repo/blob/master/js/color-picker-fix.js 

In above file I changed from hex to rgba but you can do opposite



Arun Patidar

View solution in original post

2 Replies

Avatar

Correct answer by
Community Advisor

Hi,

If you choose from RGB then it will save as RGB value otherwise hex

 

chrome-capture-2022-8-29.gif

 

you can change this value on dialog submit example https://github.com/arunpatidar02/aem63app-repo/blob/master/js/color-picker-fix.js 

In above file I changed from hex to rgba but you can do opposite



Arun Patidar