# Proposal: Differentiate navbar bg color from header color

**URL:** <https://forum.xwiki.org/t/proposal-differentiate-navbar-bg-color-from-header-color/15844>\
**Category:** Development\
**Tags:** proposal, usability\
**Created:** [October 31, 2024, 4:33pm UTC](https://forum.xwiki.org/t/proposal-differentiate-navbar-bg-color-from-header-color/15844 "2024-10-31T16:33:25Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![tkrieck](https://forum.xwiki.org/user_avatar/forum.xwiki.org/tkrieck/32/6019_2.png) [@tkrieck](https://forum.xwiki.org/u/tkrieck)\
**Post date:** [October 31, 2024, 4:33pm UTC](https://forum.xwiki.org/t/proposal-differentiate-navbar-bg-color-from-header-color/15844/1 "2024-10-31T16:33:25Z")

</div>

Hey everyone, I’d like to propose a change to the background color of the menus beneath the main header. This comes as a result of [XWIKI-15629](https://jira.xwiki.org/browse/XWIKI-15629)

**Current Issue** :  
The menu shares the same color as the header, which creates a visually confusing style as the visual hierarchy is difficult to be perceived (both elements have the same visual weight), as shown below:

![current](https://forum.xwiki.org/uploads/default/original/2X/f/f9bb3bd126699d2f957a43e92b5ac87fd5efdbf5.png)

**Additional issues:**

- The menu has an inner shadow that isn’t used anywhere else in the interface, making it stand out unnecessarily.
- Without editing CSS directly, it is impossible to customize the navigation background and header background separately.

**Proposed Solution** :  
I suggest creating a new color variable called `@header-default-bg`, which would be applied only to the header. The existing `@navbar-default-bg` would then be used exclusively for the menu. By **default** , this menu color could be 10% less saturated and bright compared to the header color, maintaining a subtle differentiation. `@header-default-bg` should also be exposed on the admin interface for easy customization (Global Admin \> Look and Feel \> Themes \> Iceberg \> Customize \> Navigation bar).

Another change would be to reduce the height of the navbar. Currently, it’s the same height as the header, but as a secondary element, it doesn’t need to be that tall. Shortening it slightly would improve visual hierarchy.

Together, these changes would look like this:

![proposal](https://forum.xwiki.org/uploads/default/original/2X/6/6697cf4cc92d333d5963758060a72daee09d8c89.png)

What do you think of it?

Thanks all

---

<div class="post-metadata">

**Author:** ![amilica](https://forum.xwiki.org/user_avatar/forum.xwiki.org/amilica/32/8216_2.png) [@amilica](https://forum.xwiki.org/u/amilica)\
**Post date:** [November 1, 2024, 8:15am UTC](https://forum.xwiki.org/t/proposal-differentiate-navbar-bg-color-from-header-color/15844/2 "2024-11-01T08:15:32Z")

</div>

> [@tkrieck](#):
>
> Together, these changes would look like this:
> 
> ![proposal](https://forum.xwiki.org/uploads/default/original/2X/6/6697cf4cc92d333d5963758060a72daee09d8c89.png)

Looks great, I think it’s a good idea to have both these changes. Thank you for the proposal, Thiago!!

---

<div class="post-metadata">

**Author:** ![LucD](https://forum.xwiki.org/user_avatar/forum.xwiki.org/lucd/32/8010_2.png) [@LucD](https://forum.xwiki.org/u/LucD)\
**Post date:** [November 1, 2024, 1:36pm UTC](https://forum.xwiki.org/t/proposal-differentiate-navbar-bg-color-from-header-color/15844/3 "2024-11-01T13:36:37Z")

</div>

Hi @tkrieck ,

As a user of XWiki, I am really interesting in this feature as it would avoid a lot of CSS customization for **menu** (below the navbar-header), used through the [Menu Application](https://extensions.xwiki.org/xwiki/bin/view/Extension/Menu%20Application).

But in the **Navigation bar** section of the administration section, there are alll these variables: `@navbar-default-color`, `@navbar-default-bg`, `@navbar-default-link-color`, `@navbar-default-link-hover-color`, `@navbar-default-link-hover-bg`, `@navbar-default-link-active-color`, `@navbar-default-link-active-bg`, `@navbar-height`.  
Should _all variables_ be available also for the menu ?

Best Regards,  
Luc

---

<div class="post-metadata">

**Author:** ![tkrieck](https://forum.xwiki.org/user_avatar/forum.xwiki.org/tkrieck/32/6019_2.png) [@tkrieck](https://forum.xwiki.org/u/tkrieck)\
**Post date:** [November 4, 2024, 1:38pm UTC](https://forum.xwiki.org/t/proposal-differentiate-navbar-bg-color-from-header-color/15844/4 "2024-11-04T13:38:15Z")

</div>

> [@LucD](#):
>
> Should _all variables_ be available also for the menu ?

Hi @LucD, good point. Yes, for the sake of consistency, I think that these variables should be available as well. In practice, we should have all of them in `@navbar-` and `@header-` prefixes.

---

<div class="post-metadata">

**Author:** ![CharpentierLucas](https://forum.xwiki.org/user_avatar/forum.xwiki.org/charpentierlucas/32/4830_2.png) [@CharpentierLucas](https://forum.xwiki.org/u/CharpentierLucas)\
**Post date:** [November 4, 2024, 2:55pm UTC](https://forum.xwiki.org/t/proposal-differentiate-navbar-bg-color-from-header-color/15844/5 "2024-11-04T14:55:54Z")

</div>

> [@tkrieck](#):
>
> Another change would be to reduce the height of the navbar. Currently, it’s the same height as the header, but as a secondary element, it doesn’t need to be that tall. Shortening it slightly would improve visual hierarchy.

I had to hard code this height last year when changing the structure of the menu while keeping the display consistent → [XWIKI-19725: Menu are not accessible using a screen reader by Sereza7 · Pull Request #2078 · xwiki/xwiki-platform · GitHub](https://github.com/xwiki/xwiki-platform/pull/2078)  
Before that, it relied on `@navbar-padding-vertical` to get its height  
👍 to reduce the default height of the navbar.

> [@tkrieck](#):
>
> Hi @LucD, good point. Yes, for the sake of consistency, I think that these variables should be available as well. In practice, we should have all of them in `@navbar-` and `@header-` prefixes.

So if I understand well, we should probably add a new section to the colorTheme admin UI.  
Side note: This UI is getting larger and larger with time. Maybe it could be interesting to give further details on what’s the main element for each section (it could get confusing for someone not very knowledgeable to differentiate between `dropdown`, `navbar` and `header` for example).

> [@tkrieck](#):
>
> By **default** , this menu color could be 10% less saturated and bright compared to the header color, maintaining a subtle differentiation. `@header-default-bg` should also be exposed on the admin interface for easy customization (Global Admin \> Look and Feel \> Themes \> Iceberg \> Customize \> Navigation bar).

👍 For the idea of using color to differentiate those elements. Note that even on [xwiki.org](http://xwiki.org) we do use a stylesheet extension to have both of these colors different, so there’s definitely a use case for this 🙂

I assume this default you’re talking about is `using the Iceberg colorTheme`. Note that we cannot extend the rule you described to all colorThemes. Here is an example with Charcoal, where the color is pretty much black and we cannot reduce saturation and brightness.

 ![image](https://forum.xwiki.org/uploads/default/original/2X/8/80a6102241ebacd216ce44a09a678bad0452e972.png)  
For other color themes, what should be our strategy? I can see two solutions:

- Be lazy, keep them as they are now, but admins have access to the UI if they want to update them.
- Update every single one to have slight variations in colors

* * *

Thanks for handling this proposal!  
Lucas C.

---

<div class="post-metadata">

**Author:** ![tkrieck](https://forum.xwiki.org/user_avatar/forum.xwiki.org/tkrieck/32/6019_2.png) [@tkrieck](https://forum.xwiki.org/u/tkrieck)\
**Post date:** [November 4, 2024, 5:13pm UTC](https://forum.xwiki.org/t/proposal-differentiate-navbar-bg-color-from-header-color/15844/6 "2024-11-04T17:13:55Z")

</div>

> [@CharpentierLucas](#):
>
> So if I understand well, we should probably add a new section to the colorTheme admin UI

Yes, I think this will be necessary.

> [@CharpentierLucas](#):
>
> Side note: This UI is getting larger and larger with time. Maybe it could be interesting to give further details on what’s the main element for each section (it could get confusing for someone not very knowledgeable to differentiate between `dropdown`, `navbar` and `header` for example).

I agree, and the naming for the variables also does not help. For less technically inclined users it can be scary to mess with “@navbar-default-link-hover-color” but not so much with “Link hover color” inside a section named “Navigation Bar” (this also would need to be translated as well).

On a side note, we seem to have a bug in the color picker. It didn’t open for me sometimes, but I could not find the pattern in the error, sometimes it worked, sometimes it didn’t.

> [@CharpentierLucas](#):
>
> I assume this default you’re talking about is `using the Iceberg colorTheme`. Note that we cannot extend the rule you described to all colorThemes. Here is an example with Charcoal, where the color is pretty much black and we cannot reduce saturation and brightness.

Indeed, we can have two rules based on the general lightness of the color theme, if it is a dark one we can ADD 10% brightness to the navbar and get something like this:

![Screenshot 2024-11-04 at 13.58.01](https://forum.xwiki.org/uploads/default/original/2X/8/8012f0a161913fdffa701183292ce3a2c8d0f9ba.png)

> [@CharpentierLucas](#):
>
> Update every single one to have slight variations in colors

I would update every color theme, but following the same rule. It shouldn’t be too difficult if the main rule is simple enough.

- Light themes: reduce saturation and brightness by 10%
- Dark theme: add brightness by 10% (maybe we can do with less, like 5%)

In HSL color model, it is easy to find the corresponding hex values and I can add them to the final proposal for each Theme. What do you think?

---

<div class="post-metadata">

**Author:** ![CharpentierLucas](https://forum.xwiki.org/user_avatar/forum.xwiki.org/charpentierlucas/32/4830_2.png) [@CharpentierLucas](https://forum.xwiki.org/u/CharpentierLucas)\
**Post date:** [November 5, 2024, 8:27am UTC](https://forum.xwiki.org/t/proposal-differentiate-navbar-bg-color-from-header-color/15844/7 "2024-11-05T08:27:13Z")

</div>

> [@tkrieck](#):
>
> In HSL color model, it is easy to find the corresponding hex values and I can add them to the final proposal for each Theme. What do you think?

I didn’t see it this solution yesterday, but if the rule is simple enough, we can just use [LESS color functions](https://lesscss.org/functions/#color-operations-lighten) to set the default value of this color from the `@header-default-bg`. I don’t think it’s worth your time to find and note down hex values for every colortheme 🙂

* * *

Thanks for the update, looks good to me 👍

---

<div class="post-metadata">

**Author:** ![tkrieck](https://forum.xwiki.org/user_avatar/forum.xwiki.org/tkrieck/32/6019_2.png) [@tkrieck](https://forum.xwiki.org/u/tkrieck)\
**Post date:** [November 5, 2024, 10:14am UTC](https://forum.xwiki.org/t/proposal-differentiate-navbar-bg-color-from-header-color/15844/8 "2024-11-05T10:14:18Z")

</div>

> [@CharpentierLucas](#):
>
> I didn’t see it this solution yesterday, but if the rule is simple enough, we can just use [LESS color functions](https://lesscss.org/functions/#color-operations-lighten) to set the default value of this color from the `@header-default-bg`.

We could, but then we would rely a little bit more on LESS functions, and it will be harder to go LESSless in the future. It’s really no trouble for me to do it manually for the default themes.

Thanks for your input!

---

<div class="post-metadata">

**Author:** ![CharpentierLucas](https://forum.xwiki.org/user_avatar/forum.xwiki.org/charpentierlucas/32/4830_2.png) [@CharpentierLucas](https://forum.xwiki.org/u/CharpentierLucas)\
**Post date:** [November 8, 2024, 10:08am UTC](https://forum.xwiki.org/t/proposal-differentiate-navbar-bg-color-from-header-color/15844/9 "2024-11-08T10:08:46Z")

</div>

> [@tkrieck](#):
>
> We could, but then we would rely a little bit more on LESS functions, and it will be harder to go LESSless in the future. It’s really no trouble for me to do it manually for the default themes.

I just found a blog post about it, there’s a feature that’ll be fully supported soon and should map pretty well to LESS color functions 🙂  
So we should not restrain our use of LESS color functions in regards to this move 🙂

> **[Build Colors from Colors with CSS Relative Color Syntax](https://calebhearth.com/css-relative-colors)**
>
> This is a post I’m mostly writing for my future self, because I can never remember the actual term for the CSS feature that lets you define a color based on another color (it’s “CSS Relative Color”...

 ![image](https://forum.xwiki.org/uploads/default/original/2X/7/7d92828cb6bcc300b80c76fd7e674783fdb0435a.png)  
 ![image](https://forum.xwiki.org/uploads/default/original/2X/d/de3400690376d2e783ca73f41819004ec9876afd.png)

---

<div class="post-metadata">

**Author:** ![tkrieck](https://forum.xwiki.org/user_avatar/forum.xwiki.org/tkrieck/32/6019_2.png) [@tkrieck](https://forum.xwiki.org/u/tkrieck)\
**Post date:** [November 8, 2024, 10:25am UTC](https://forum.xwiki.org/t/proposal-differentiate-navbar-bg-color-from-header-color/15844/10 "2024-11-08T10:25:11Z")

</div>

> [@CharpentierLucas](#):
>
> I just found a blog post about it, there’s a feature that’ll be fully supported soon and should map pretty well to LESS color functions 🙂  
> So we should not restrain our use of LESS color functions in regards to this move 🙂

That’s very nice! I also didn’t know about this feature, I’ll try this on beta channels of chrome/firefox.  
Thank you!

---

<div class="post-metadata">

**Author:** ![tkrieck](https://forum.xwiki.org/user_avatar/forum.xwiki.org/tkrieck/32/6019_2.png) [@tkrieck](https://forum.xwiki.org/u/tkrieck)\
**Post date:** [November 19, 2024, 11:59am UTC](https://forum.xwiki.org/t/proposal-differentiate-navbar-bg-color-from-header-color/15844/11 "2024-11-19T11:59:14Z")

</div>

Hi everyone, I’ve created the proposal about this here: [https://design.xwiki.org/xwiki/bin/view/Proposal/Separateheaderandnavcolorvariables](https://design.xwiki.org/xwiki/bin/view/Proposal/Separateheaderandnavcolorvariables)

I am marking this post as solved, but feel free to keep discussing if anything comes to mind, and I’ll update the proposal accordingly

---

<div class="post-metadata">

**Author:** ![vmassol](https://forum.xwiki.org/user_avatar/forum.xwiki.org/vmassol/32/6_2.png) [@vmassol](https://forum.xwiki.org/u/vmassol)\
**Post date:** [November 19, 2024, 1:25pm UTC](https://forum.xwiki.org/t/proposal-differentiate-navbar-bg-color-from-header-color/15844/12 "2024-11-19T13:25:20Z")

</div>

Thanks @tkrieck !

FYI: [Add a new "Accepted" xproperty on design.xwiki.org](https://forum.xwiki.org/t/add-a-new-accepted-xproperty-on-design-xwiki-org/15950)
