store color field in hex code format | Community
Skip to main content
Level 3
September 29, 2022
Solved

store color field in hex code format

  • September 29, 2022
  • 2 replies
  • 994 views

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.
Best answer by arunpatidar

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

2 replies

arunpatidar
Community Advisor
arunpatidarCommunity AdvisorAccepted solution
Community Advisor
September 29, 2022

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
HeenaMadan
Community Advisor and Adobe Champion
Community Advisor and Adobe Champion
September 29, 2022