Hi!
I'm using this module with fullcalendar and it works very well.
The interface is so neat that I would love to extend its usage to colorize fields and nodes everywhere in my website.
E.g. I would love to colorize taxonomy term fields according to the colors I chose in the colors admin.
So, I tried to emulate what fullcalendar_colors submodule does in a custom module, with no success.
I had a look at the database table, at colors module, at colors.api.php, and so on. I quite understood the logic, but still I can't use the stored colors in my module or in templates.tpl.php or in theme template.php, which I also tried.
I can't find any documentation, just a related issue which I linked here.
May I ask for your kind support, maybe just some more hints on how to use it?
Thank you

Comments

miromarchi created an issue.

adam-delaney’s picture

I was able to accomplish this by implementing hook_colors_build_selector() and then calling colors_create_css() in a preprocess function. Here is my example code:

/**
 * Implements hook_colors_build_selector().
 */
function MYMODULE_colors_build_selector($class) {
  $selector = array(
    ".$class",
  );
  return implode(', ', $selector);
}

/**
 * Implements hook_preprocess_taxonomy_term().
 */
function MYMODULE_preprocess_taxonomy_term(&$vars) {
  $css_url = file_create_url(colors_create_css('MYMODULE'));
  drupal_add_css($css_url);
  $vars['classes_array'] = array(
    'colors-taxonomy-term-' . $vars['tid'],
  );
}