Changing colors per page through drupal interface Using Content type: News, I have created pages NewsItem1, NewsItem2

I would like to have a background and color blue to NewsItem1 page
and set the pink background to NewsItem2 page through Drupal admin. Is that possible?

I am using Drupal 8.5 version. I think themekey module allowed to do this but it is not available for D8. I couldn't find any other easy way to do this. Any suggestions? Thanks in advance.
You will probably have to add a "Background Color" field to the content type with some selections that map to CSS class names.

Then, depending on where you want to add the background (e.g. on the body or on just the main content area), to add a preprocessor function in your theme to add the selected class as a variable that can be used by the twig template.

E.g. for just the main content area, you would use something like:


function bartik_preprocess_page(&amp;$variables) {
  $node = \Drupal::routeMatch()-&gt;getParameter('node');
  if ($node) {
    if (!$node-&gt;color-&gt;isEmpty()) {
      $variables['bg-class'] = $node-&gt;color-&gt;getValue();
    }
  }
}
 

Copy the page.html.twig file to your theme's templates directory and add the bg-class to the section you want that color.  E.g. class="{{ bg-color }}".