Skip to Content

overriding semantic colors - sap.m.ValueColor in SAPUI5

Dec 11, 2017 at 05:20 AM


avatar image

How can I set a custom color over the default semantic color (sap.m.ValueColor) on sap.m.NumericContent control.

I am using addStyleClass on my control & setting color in custom css style sheet.

But its using the default color of property valueColor - generated class in dom - .sapMNCValue.Neutral, .sapMNCIndicator.Neutral, .sapMNCScale.Neutral

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Ivan Mirisola
Dec 21, 2017 at 02:36 PM

Hi Deep,

To the best of my knowledge you don't have that option for the NumericContent control. You will need either extend the control by creating a new component of your own or use a different control to display the data. The way to change colors is by placing your own css stylesheet file and using the class attribute on the corresponding xml tag of your control.



10 |10000 characters needed characters left characters exceeded
Iftah Peretz
Dec 29, 2017 at 09:14 PM


You can do it, however, the way is problematic.

You can enforce the design onto the DOM. All of the precautions of this way should be clear to you, and if not you are welcome to Google it, as this is beyond this scope.

I used this example .

If you replace in the controller the function "press" with this

press: function(evt) {
	var domRef = evt.getSource().getDomRef(); = "color: blue";

Once you'll click a number it will turn blue.

10 |10000 characters needed characters left characters exceeded