Woman In Tech: NAVIGATING THE DIGITAL WORLD

seeker, learner, educator and paying it forward… in short – Jigyaasu

Color your SharePoint Online list rows with KPI

Posted by

·

, , , , , ,

Tiny nugget of code that goes a lonngggg way. Why? Cause everyone likes pretty colors. What? You don’t? Well, I most definitely, absolutely, positively, entirely do! So I share what I do. Mostly because its easy to look this post up than the 20 site collections I code for.

Just as the script says…its jQuery. It looks for values in columns with words ‘green’, ‘red’,’yellow’. Those are from calculated column by the way. Any row that has the color, is styled with its matching background. I have always found good results when I go for softer colors. As much as I love bright and bold, when it comes to tables/lists, the softer the better. Easy on the eyes. Mostly because it makes those scary reds easier to handle. Yep, you will probably still get in trouble,or not  but at-least your eyes wont be alarmed much!

What are these $ and (document) adn all that good stuff in between script tags? checkout http://www.jquery.com

https://code.jquery.com/jquery-2.1.3.min.js

$(document).ready(function () {
$Text = $(“td.ms-cellstyle.ms-vb2:contains(‘green’)”);
$Text.parent().css(“background-color”, “#CEF6D8”);

$Text = $(“td.ms-cellstyle.ms-vb2:contains(‘red’)”);
$Text.parent().css(“background-color”, “#F8E0E6”);

$Text = $(“td.ms-cellstyle.ms-vb2:contains(‘yellow’)”);
$Text.parent().css(“background-color”, “#FFFFD5”);

$Text = $(“td.ms-cellstyle.ms-vb2:contains(‘gray’)”);
$Text.parent().css(“background-color”, “#d3d3d3”);

});

Strongly typing this section in the post. This little fix gets rid of those nagging ghost left navigation margin in your Oslo template. What is Oslo template? Meh! Another topic, another post. 🙂

<style>
.contentwrapper{
margin-left: 0px;
}
</style>

Color me KPI
Color me KPI
Swetha Sankaran, Microsoft MVP(2017-2020) | Gen AI enthusiast Avatar

About the author

Hi! My name is Joan Smith, I’m a travel blogger from the UK and founder of Hevor. In this blog I share my adventures around the world and give you tips about hotels, restaurants, activities and destinations to visit. You can watch my videos or join my group tours that I organize to selected destinations. [Suggestion: You could use the Author Biography Block here]

Discover more from Woman In Tech: NAVIGATING THE DIGITAL WORLD

Subscribe now to keep reading and get access to the full archive.

Continue reading