Adding color to the title and glyph icons in the widget instance service portal

Prerana1
Kilo Guru

Hello,

Can anyone suggest me how to add different colors to the glyphicons and title in the widget instances( apart from bootstrap color)

find_real_file.png

should be modified like below image

find_real_file.png

Can anyone guide me how to add color to the title and glyphicons.

Quick help would be highly appreciable!

Thanks,

Prerana

4 REPLIES 4

Chander Bhusha1
Tera Guru

Hi Prerna,

You can inspect the element and then add the color to the icons.by navigating to the page in which you have to add the colors then add the css there.

Fro example:

on the page right click and select inspect

find_real_file.png

 

Copy the element from right side the n add the color in the page(say these wiget are present in the index page) so go the index page and add the css there.

as shwon below:

.fa-book:before {
content: "\f02d";
color:blue;
}

find_real_file.png

 

Output:

 

 

find_real_file.png

Mark helpful and correct if it helps.

Thanks,

CB

 

Hello,

Thank you so much for your response, i successfully changed the color of the icons but as in my screenshot i want to change the color of the title( all the title like "Knowledge Base" "My requests" etc are defined with h2 tags with class ng-binding) i want to add different colors to different title's,

can you please guide me on this?

 

Thanks,

Prerana

Hi Prerana,

OOB its not possible to change the font color with the page CSS as shown in the screenshot.

As you can see that there they have added the class to the icons but not with the title.

find_real_file.png

If you wan't to proceed with the cloning of the widget then you have to do this workaround.

Clone the icon link widget and change the html code like this:

HTML code: [note: replace the HTML code in the cloned icon link widget--]

here i have added the {{::options.class_name}} in the <h2> tags.

<div class="iconlink" ng-class="{'high-contrast': accessibilityModeEnabled}">
  <!--// Top Icon -->
  <a ng-if="::(options.link_template == 'Top Icon' || !options.link_template)" ng-href="{{::data.href}}" class="top_icon {{::options.class_name}}" target="{{::data.target}}">
    <div class="m-b fa fa-{{::options.glyph}} fa-4x  text-{{::options.color}}"></div>
    <h2 class="{{::options.class_name}}">{{::options.title}}</h2>
    <span class="text-muted">{{::options.short_description}}</span>
  </a>

  <!--// Circle Icon -->
  <a ng-if="::(options.link_template == 'Circle Icon')" ng-href="{{::data.href}}" class="circle_icon text-{{::options.color}}" target="{{::data.target}}">
    <span class="fa fa-stack fa-2x">
      <i class="fa fa-circle fa-stack-2x"></i>
      <i class="fa fa-{{::options.glyph}} fa-stack-1x fa-inverse"></i>
    </span>
    <h2 class="{{::options.class_name}}">{{::options.title}}</h2>
    <span class="text-muted">{{::options.short_description}}</span>
  </a>

  <!--// Color Box -->
  <a ng-if="::(options.link_template == 'Color Box')" ng-href="{{::data.href}}" class="color_box {{::options.class_name}} icon-link-background-{{::options.color}} text-white" target="{{::data.target}}">
    <div class="fa fa-{{::options.glyph}} fa-3x "></div>
    <h2 class="{{::options.class_name}}">{{::options.title}}</h2>
    <span>{{::options.short_description}}</span>
  </a>
</div>

So what it does it it will add the class to the h2 tags.

When you add this icon link widget to the page then it will create a widget instances(Navigate to -- widget instances).

In that you can define the class name and update in the page with that class which you did earlier.

 

Widget instance class name update: [Note: here you have to update the class name ] like i have added here know_class
find_real_file.png

 

Update the same in the page so in that case each icon link will have different class and you can add that.

.know_class{
color:blue;
}

 

Mark helpful and correct if it helps.

Thanks,

CB

Prerana1
Kilo Guru

Thank you so much, i will check this solution also can you please help me on the below thread.

https://community.servicenow.com/community?id=community_question&sys_id=74323b8fdb995c10414eeeb5ca96...

Any suggestions are highly appreciated!

 

Thanks and Regards,

Prerana