store color field in hex code format | Community
Skip to main content
Level 3
Sep 29, 2022 8:13 AM UTC
Solved

store color field in hex code format

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!

 
This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
arunpatidar
arunpatidarAccepted solution
New Participant
Sep 29, 2022 10:28 AM UTC

Hi,

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

 

 

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

2 replies

HeenaMadan
New Participant
Sep 29, 2022 12:20 PM UTC
arunpatidar
arunpatidarAccepted solution
New Participant
Sep 29, 2022 10:28 AM UTC

Hi,

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

 

 

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

Translate
Arun Patidar