Start a new topic

Change label color

Change label color


Hello!

I am trying to change my label color, but my code is not working. I want the text to be white and the background to be green. This is the code:

var descriptionLabel = new AR.Label(description, 1, {

          zOrder: 1,

          offsetX: -2,

          offsetY: -3,

          style.textColor: #FFFFFF,

          style.backgroundColor: #008000

});

 

Any idea?

Thank you in advance!!!

Style requires an object to be passed. Try following call:

var descriptionLabel = new AR.Label(description, 1, {

          zOrder:  1,

          offsetX: -2,

          offsetY:  -3,

          style: {textColor: #FFFFFF,

                    backgroundColor: #008000}

});

Thank you. I did what you told me but If I do it nothing is shown.

This is what I have now:

var descriptionLabel = new AR.Label(description, 1, {

         zOrder: 1,

        offsetX: 0,

        offsetY: -3,

        style: {textColor: #FFFFFF,

                    backgroundColor: #008000}

});

 

Any other idea? I can't see where the error is.

 

Thank you in advance.

my bad, you'll need to put the colors as strings:

var descriptionLabel = new AR.Label(description, 1, {

         zOrder:  1,

        offsetX: 0,

        offsetY:  -3,

        style: {textColor: "#FFFFFF",

                    backgroundColor: "#008000"}

});

 

Aggg, I dind't realize about that. Working now.

Thank you Wolfgang!!
Login or Signup to post a comment