How to get selected Theme's Style(Color) in widget

3004
3
09-08-2015 07:29 AM
SumitZ
by
New Contributor III

We want to set color of some text in the widget to selected theme's color, is their any way we can get selected Theme's Style(Color) in widget .

Thanks,

Sumit

0 Kudos
3 Replies
RobertScheitlin__GISP
MVP Emeritus

Sumit,

  Sure use this.

requires

    'dojo/_base/query',
    'dojo/dom-style'

    dojoQuery,
    domStyle

        var node = dojoQuery('.jimu-main-background')[0];
        console.info(domStyle.get(node, 'background-color'));
ZeZhengLi
Esri Contributor

Sumit,

First,you can access a style array from `this.appConfig`, the first one as the selected style. If there doesn't have styles property, use `default` as default.

Second, you should send a request to get the manifest.json of theme manually.

The `styleColor` is you need.

SumitZ
by
New Contributor III

Thanks ZeZheng Li​ !

We have already tried this and it is working fine.We thought this would be an workaround and will have maintenance impact if any changes in WAB carried out in feature.

Is their any other way by which we can get the selected Style (color), without implementing this workaround.

For e.g.  It would be good if WAB provide the selected style(color) along with the style name. 

0 Kudos