Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

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

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