0

I am having some issues integrating the color module into my custom D8 theme.

I can create a custom set of colour palettes that can be customized on the settings screen.

I can modify the layout of the preview html file to mimic my site.

What I can't seem to do is make the js files - preview.es6.js and preview.js do anything. Like, for example, take my custom palette values to populate the preview.

I have tried attaching the js files the way the Bartik theme does:

color.preview:
  version: VERSION
  css:
    theme:
      color/preview.css: {}
  js:
    color/preview.js: {}
  dependencies:
    - color/drupal.color

This appears to do nothing and modifying the preview does nothing. There is a note and a link to an old issue indicating preview.js should no longer be used in favour of preview.es6.js but modifying that file, or attaching it instead of preview.js also appears to do nothing.

Leaving aside the question of why Bartik is attaching a depreciated js file to its theme, how do I go about being able to modify the js code spitting out my color module preview?

If any color module experts happen past I would also love to know why this module maps hex colors to colors only, wouldn't it have made more sense to map something like named scss variables to individual colors so you could create a more flexible set of colour palettes?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.