2

I have custom theme which is using Color Pallette from Bartik. I want to add another color options:

 'fields' => array(
    'top-bar-' => t('Top Bar background'),
    'top' => t('Header top'),
    'bottom' => t('Header bottom'),
    'base' => t('Main background'),
    'sidebar' => t('Sidebar background'),
    'sidebarborders' => t('Sidebar borders'),
    'footer' => t('Footer background'),
    'titleslogan' => t('Title and slogan'),
    'text' => t('Text color'),
    'link' => t('Link color'),
  ),

top-bar- is id of top container (someone named it top-bar-, anyway it's best to remains the same)

In schemes array I added default color to every schema, e.g.:

    'top-bar-' => '#666666',

Now in colors.css I added:

#top-bar- {
    background-color: #666666;
}

I cleared cache but my new color pallette options doesn't appear in theme settings form :( I read a few tutorials about this topic, but in my case it just don't work.

1 Answer 1

2

It's starts working when I changed color.module in line 234 (added TRUE param):

$palette = color_get_palette($theme, TRUE);

Caution: This removes any custom colour palette so you might want to note the colour settings somewhere

EDIT

Now I have removed TRUE param from code, my new field still appears and everything is working correctly.

Anyway at last problem is trivial to solve, just disable and enable theme again, but it remove blocks settings etc on this theme.

1
  • I can't get this working in Drupal 9. Can you tell me how this works in D9?
    – drupalfan
    Feb 7, 2022 at 14:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.