Skip to Content
avatar image
Former Member

overriding semantic colors - sap.m.ValueColor in SAPUI5

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

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • 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.

    Regards,

    Ivan

    Add comment
    10|10000 characters needed characters exceeded

  • Dec 29, 2017 at 09:14 PM

    Hi,

    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();
    	domRef.lastChild.lastChild.lastChild.style = "color: blue";
    		     }
    

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

    Add comment
    10|10000 characters needed characters exceeded