How to change Patternfly default colours #16256
-
Hello good people! Thank you for the great tool cockpit is, I really am in love with it and I'm spreading the word with colleagues and friends. I am on the way to customise it in order to (graphically) integrate it with an ecosystem I am working on and I would like to get some tips on how to override the default UI colours (mainly the blue/dark blue ones). As far as I understand these should be the ones defined by Patternfly, but I cannot find where to override them. Can you give me some hints? Thank you very much, Gabriele |
Beta Was this translation helpful? Give feedback.
Replies: 6 comments 10 replies
-
The file you linked is intended to override PatternFly 3 only, to make it resemble PatternFly 4. Much of Cockpit has been ported over to PatternFly 4, so editing that file will have no effect on anything that's in PatternFly 4. Which colors in particular are you trying to change? Most are represented in CSS variables these days, not just for PatternFly 4, but also for PatternFly 3 and Cockpit custom widgets. There's one exception: The stripe at the top of the page. That's an accent color tied to the machine it's on, to help you differentiate between multiple machines (if you're using multiple machines). It's blue by default and a custom color can be set when adding or editing machines in the host switcher. |
Beta Was this translation helpful? Give feedback.
-
Hey there, :root {
--ct-color-host-accent: #FFA601 !important;
--ct-color-list-hover-text: #FFA601 !important;
/* Theme color */
--pf-global--primary-color--100: #fdc55d !important;
--pf-global--primary-color--200: #FFA601 !important;
--pf-global--warning-color--100: #eea0d3 !important;
--pf-global--warning-color--200: #D35FAA !important;
/* Link colors */
--pf-global--link--Color: #FFA601 !important;
--pf-global--link--Color--hover: #fdc55d !important;
/* Inline link colors */
--pf-c-button--m-link--Color: #FFA601 !important;
--pf-c-button--m-link--m-inline--hover--Color: #fdc55d !important;
/* Nav link colors */
--pf-c-badge--m-unread--BackgroundColor: #FFA601 !important;
--pf-c-nav__link--Color: #FFA601 !important;
--pf-c-nav__link--m-current--Color: #fdc55d !important;
--pf-c-nav__link--before--BorderColor: #FFA601 !important;
--pf-c-nav__section__link--hover--after--BorderColor: #fdc55d !important;
/* Progress indicators colors */
--pf-c-progress__indicator--BackgroundColor: #FFA601 !important;
--pf-c-progress__bar--BackgroundColor: #fadda7 !important;
/* Table headings colors */
--pf-c-table__sort__button__text--Color: #FFA601 !important;
} Here are some screenshots of the results so far. I am still trying to override the chart colours. |
Beta Was this translation helpful? Give feedback.
-
I'll try without the Yesterday I experimented a little bit more and I ended up creating another I still have to deal with it, but I think I can get to a setup where even such information is in the branding css. Thanks for the heads up on contrast, I'll definitely have a look and try to improve that! |
Beta Was this translation helpful? Give feedback.
-
I've opened an issue @ #16359. (No promises if/when this would be implemented, but I spec'd it out to make it more obvious what is needed, roughly how it should be implemented, and why it's wanted.) |
Beta Was this translation helpful? Give feedback.
-
@garrett I need an additional suggestion. I don't get if currently there's a style sheet loaded by all pages. I am getting incoherent behaviour when acting on some elements of the page via my |
Beta Was this translation helpful? Give feedback.
-
Hi guys! I want to first thank you both for the useful bits of advice and examples you have shared here. Much appreciated! 🙏 I've been playing around with that topic this week and have recorded some ideas and experiments in https://gist.github.com/dgdavid/ec2648c61f63f49a8aa8d9871d2b70f9. It would be great if you could take a peek at it. Your feedback is more than welcome, even comments calling me crazy for suggesting batch replacements in the final CSS output 🤦♂️ 😜 😉 Likewise, let me know if I can help with #16359 in any way. I could collaborate as far as my knowledge and time permits. Please, excuse me for reusing a discussion marked as answered. I thought that continuing the thread was better, but I can start a new one instead if you prefer. Regards. |
Beta Was this translation helpful? Give feedback.
I've opened an issue @ #16359.
(No promises if/when this would be implemented, but I spec'd it out to make it more obvious what is needed, roughly how it should be implemented, and why it's wanted.)