Show custom term fields in node tpl

Hello, I have a Vocabulary called Colors. In this vocabulary I have a custom field called Class.

I have other vocabulary called Categories and in this vocabulary I have the field Background color (term reference for the vocabulary Colors).

I have a content type called Articles. There I have a field called Category (term reference for the vocabulary Categories).

In the node tpl of the Articles, for the Category field I would like to display the Class field of the Colors vocabulary.

I used the code below to display a customized field, but I can only display the Name field of Colors vocabulary:

$ term = taxonomy_term_load ($ node-> field_category ['und'] [0] ['tid']);
$ result = field_view_field ('taxonomy_term', $ term, 'field_background_color', 'text');
print render ($ result);

I was able to do this using Views and creating a relationship between the fields, however how can I do this in node tpl?

Drupal version: