Project

General

Profile

How to change color of WMenuItem?

Added by Vitali Grabovski about 7 years ago

I tried

menuItem->setStyleClass("myStyleWithColor");

Where "myStyleWithColor" is

.myStyleWithColor {
    color: #e58100;
}

also tried:

menuItem->decorationStyle().foregroundColor().setRgb(206, 36, 43);

and this:

menuItem->decorationStyle().seForegroundColor( Wt::WColor(206, 36, 43) );

Nothing works. Any suggestions?


Replies (3)

RE: How to change color of WMenuItem? - Added by Diwakar Kumar about 7 years ago

css property "color" only changes text color.

To change background color use "background-color" css property.

Also you should apply css property to ".dropdown-menu" class of bootstrap.

For e.g.:

@

.dropdown-menu .active > a, .dropdown-menu .active > a:hover {

background-color: #2004b4 !important;

background-image: none !important;

color: #e4d7d7 !important;

@

RE: How to change color of WMenuItem? - Added by Vitali Grabovski about 7 years ago

I want exactly to change text color.

Background color si changing fine.

RE: How to change color of WMenuItem? - Added by Diwakar Kumar about 7 years ago

Then you should try "!important" like this:

.myStyleWithColor {
    color: #e58100 !important;
}
    (1-3/3)