Search code examples
javascriptcssmeteoriron-router

Dynamically set background-color on html tag


I need to dynamically set the background-color in the html tag.

<html style="background-color:{{ backColor }};">

How is this done in Meteor?


Solution

  • The solution turned out to be simple. Just added the style for body to the top of the template. Doesn't seem to be best practice, but it works on Chrome and Safari.

    This also seems to work for the htmltag.

    <template name="spriteBox">
        <style type="text/css">
            body {
                background-color: {{ backColor }}
            }
        </style>
        <!-- rest of content -->
    </template>