Specifying Colors for SharePoint Header

Nate Gervenak 0 Reputation points
2024-12-23T21:59:02.42+00:00

I want to specify the colors on a SharePoint header. However, the theme generated in the Theme Generator UI arbitrarily sets the colors based on my Primary Color and Accent Color. I want to specify the exact colors that the header uses.

We will be using the Compact layout.

I'd like the top bar (<div class="root-431">) to have a background color of: #D50622

Then the sub-bar ( <div class="root-438" >) to have a background color of: #8A0416

A few notes:

Microsoft 365 and Office SharePoint Development
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. RaytheonXie_MSFT 40,471 Reputation points Microsoft External Staff
    2024-12-24T02:48:01.1766667+00:00

    Hi @Nate Gervenak

    I would recommend you to use SharePoint Framework (SPFx) Extensions to apply the css for all pages. This solution helps to add/modify/delete custom js and css file references using SPFx application customizer extension all modern pages within SP online site. You could deploy the extension to your page to manage your css style.

    https://github.com/pnp/sp-dev-fx-webparts/tree/main/samples/react-add-js-css-ref


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.