Skip to main content
Inspiring
July 9, 2016
Answered

Changing font color in Javascript

  • July 9, 2016
  • 1 reply
  • 924 views

Could someone explain how to change the font of variable values.  Here I have a variable but_word_1

and I want to set it with the value of but_word_2   but in gold color--   #FFD700

How do I add in the html for font color? 


window.cpAPIInterface.setVariableValue("but_word_1", but_word_2);

    This topic has been closed for replies.
    Correct answer RodWard

    Hi Bill,

    Normally when displaying a variable inside of a caption/shape you would select that text and change its color from inside the properties dialog. However, if you are using HTML5 export, there is a way to sort of add to the text in a variable's value.

    If you're using the color #FFD700, then you would want to set your but_word_1 variable to this value:

    <span style='color:#FFD700'>Your Text Here</span>

    Hope that helps!

    Rod (on behalf of Tristan)

    1 reply

    RodWard
    Community Expert
    RodWardCommunity ExpertCorrect answer
    Community Expert
    July 10, 2016

    Hi Bill,

    Normally when displaying a variable inside of a caption/shape you would select that text and change its color from inside the properties dialog. However, if you are using HTML5 export, there is a way to sort of add to the text in a variable's value.

    If you're using the color #FFD700, then you would want to set your but_word_1 variable to this value:

    <span style='color:#FFD700'>Your Text Here</span>

    Hope that helps!

    Rod (on behalf of Tristan)

    Inspiring
    July 13, 2016

    Thanks Rod!