How to change background color for a component using sightly | Community
Skip to main content
Level 2
Oct 18, 2016 10:13 AM UTC
Solved

How to change background color for a component using sightly

I have a particular footer component, written in sightly but the background color is hard coded, which i want to make it dynamic. I want to provide the color in the dialog, then value should hold in footer.js file, and write the sightly code to get image value dynamically in my footer.html file

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
kautuk_sahni
kautuk_sahniAccepted solution
Employee
Oct 18, 2016 1:31 PM UTC

Hi 

You can do it as:

<p> Color : ${properties.color}</p>
<p style="color:${properties.color @ context='styleToken'};"> Text : ${properties.text}</p>

 

<p> Background Color : ${properties.backgroundColor}</p>
<p style="backgroundColor:${properties.backgroundColor@ context='styleToken'};"> Text : ${properties.text}</p>

 

<script> var trackingID = "${myTrackingID @ context='scriptString'}"; </script>
<style> a { font-family: "${myFont @ context='styleString'}"; } </style>

Reference article :- https://docs.adobe.com/docs/en/htl/docs/getting-started.html?wcmmode=disabled

I hope this would help you.

~kautuk

Kautuk Sahni

4 replies

Level 2
Dec 28, 2017 12:36 PM UTC

working fine. thanks!!

            <nav style="background-color:${properties.backgroundColor @ context='styleToken'}">

Translate
kautuk_sahni
kautuk_sahniAccepted solution
Employee
Oct 18, 2016 1:31 PM UTC

Hi 

You can do it as:

<p> Color : ${properties.color}</p>
<p style="color:${properties.color @ context='styleToken'};"> Text : ${properties.text}</p>

 

<p> Background Color : ${properties.backgroundColor}</p>
<p style="backgroundColor:${properties.backgroundColor@ context='styleToken'};"> Text : ${properties.text}</p>

 

<script> var trackingID = "${myTrackingID @ context='scriptString'}"; </script>
<style> a { font-family: "${myFont @ context='styleString'}"; } </style>

Reference article :- https://docs.adobe.com/docs/en/htl/docs/getting-started.html?wcmmode=disabled

I hope this would help you.

~kautuk

Translate
Kautuk Sahni
smacdonald2008
Level 10
Oct 18, 2016 12:45 PM UTC
Feike_Visser1
Employee
Oct 18, 2016 11:51 AM UTC

You can just replace the background-color with an expression, like : ${properties.backgroundColor}

Translate