Using CSS variables in Field Styles.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-30-2019 10:34 PM
I want to use color values from the themes for styling fields (Field Styles) in ServiceNow.The main idea of this - to enable users to have personal (themed) settings for coloring priority in tasks.
Here is a questions:
How to use these variables from Field style? At the moment I couldn't use any CSS variables in styles directly:
background-color:$search-text-color
Any ideas?
Regards, Nikolay.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-03-2019 07:11 PM
Hi,
Below link will help you to configure field styles, it has all the examples to get started and understand the concept
Note: Please mark reply as correct if it has answered your question or helpful if it has assisted you with respect to your question
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-03-2019 07:21 PM
Hi,
I read it many times. There is not a word about how to set a color (for example, background or font) as value from user theme, like $navpage-header-color or $navpage-button-color.
I've tried
background-color: $navpage-header-color
background-color: css.$navpage-header-color
background-color: "${gs.getProperty('css.base.color','#6699CC')}";
background-color:javascript:${gs.getProperty('css.base.color','#6699CC')}
but none of the options work.
Regards, Nikolay.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-03-2019 08:10 PM
I'm don't think this is supported, never considered using it this way.
So many styles are overridden by the system in UI16 that I personally don't even bother with field styles anymore.
ServiceNow Nerd
ServiceNow Developer MVP 2020-2022
ServiceNow Community MVP 2019-2022
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-03-2019 08:59 PM
Did you try below link to create your own themes ?
I know it was working before UI16, I have not tried it with UI16 though, you may give it a try