Change colours for web part menu

Iain Waddell asked on August 12, 2019 20:40

I find the web part menu very hard to read.

Web Part Menu

Can the colours be changed, and if so, how?

Recent Answers


Dragoljub Ilic answered on August 13, 2019 10:22 (last edited on December 10, 2019 02:31)

Hi,

I'm not sure there is OTB solution to change colors of it. This type of issues usually happens when your custom CSS interfere with Kentico's styling. What you can do is to apply additional styling on your page that will live only in edit mode, to allow editors to work within. You can simply add static text web part at the top of the master page with some styling in text field (see code snippet bellow). This is only a sample how to use it, but browser inspect tool is your best friend, to find what all that needs to be changed:

{% if (PortalContext.ViewMode != "LiveSite") { %}
<style>
.cms-bootstrap .PortalContextMenu {
    border-radius: 0;
    box-shadow: 0 6px 12px rgba(0,0,0,.175);
    background-clip: padding-box;
    background: #403e3d !important;
}
</style>
{% } |(identity)GlobalAdministrator%}

Best regards, Dragoljub

0 votesVote for this answer Mark as a Correct answer

Iain Waddell answered on August 13, 2019 10:44 (last edited on December 10, 2019 02:31)

I've tried your suggestion but it didn't work here.

The code you sent was reformatted by Kentico:

{% if (PortalContext.ViewMode != &quot;LiveSite&quot;) { %}
<style type="text/css">.cms-bootstrap .PortalContextMenu {
    border-radius: 0;
    box-shadow: 0 6px 12px rgba(0,0,0,.175);
    background-clip: padding-box;
    background: #403e3d !important;
}
</style>
{% } |(identity)GlobalAdministrator%}

Not sure if that's what caused it to not work. I did edit it a second time to match your post but it still got reformatted.

Iain

0 votesVote for this answer Mark as a Correct answer

Dragoljub Ilic answered on August 13, 2019 11:25 (last edited on August 13, 2019 11:25)

You have an error in your sample that is related to the macros at the first line:

{% if (PortalContext.ViewMode != &quot;LiveSite&quot;) { %}

&quote; shoud be simple quote like this ". Try to click on blue arrow next to the text field (to open macro editor) and then copy code sample from above. I think that should help.

0 votesVote for this answer Mark as a Correct answer

Iain Waddell answered on August 13, 2019 11:40

Hi there,

That's what I was talking about when I said it got reformatted. My " were changed to " and a # appeared near the end.

Clicked in the triangle after Text and pasted in your text but it's not made any difference :(

Iain

0 votesVote for this answer Mark as a Correct answer

Dragoljub Ilic answered on August 13, 2019 11:53

Then, in your case, it's not only background color related issue. You need to inspect that menu from by using browser developer tools (right click -> inspect) to see what's causing issue and why background color of every item in your dropdown is white. When you find real cause of that, then you need to modify <style> in body of macro {% if (PortalContext.ViewMode != "LiveSite") { %} to prevent your changes from live site.

0 votesVote for this answer Mark as a Correct answer

Iain Waddell answered on August 13, 2019 11:58

OK. I'm way out of my depth here. I'm not a CSS or Web guy. I just write C# code behind. When my colleague is back later in the week I'll see if he can help figure out what makes the CSS wrong.

Thanks for you efforts.

Iain

0 votesVote for this answer Mark as a Correct answer

Iain Waddell answered on August 15, 2019 13:39

Thanks for your assistance. In the end I've no idea how it's been fixed but while trying to find out what CSS to change we visited various parts of Kentico's admin setup and suddenly it was fixed.

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.