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:

SharePoint Development
SharePoint Development
SharePoint: A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.Development: The process of researching, productizing, and refining new or existing technologies.
3,154 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. RaytheonXie_MSFT 37,076 Reputation points Microsoft Vendor
    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.