# Dynamic colour coding of grid

**URL:** <https://forums.knack.com/t/dynamic-colour-coding-of-grid/14517>\
**Category:** Knacksters' Idea Lab\
**Created:** [June 27, 2023, 9:34am UTC](https://forums.knack.com/t/dynamic-colour-coding-of-grid/14517 "2023-06-27T09:34:26Z")\
**Posts on this page:** 1\
**Showing post:** 6

<div class="post-metadata">

**Author:** ![NormandDefayette\_CortexRD](https://sea2.discourse-cdn.com/flex020/user_avatar/forums.knack.com/normanddefayette_cortexrd/32/855_2.png) [@NormandDefayette\_CortexRD](https://forums.knack.com/u/NormandDefayette_CortexRD)\
**Post date:** [June 27, 2023, 9:15pm UTC](https://forums.knack.com/t/dynamic-colour-coding-of-grid/14517/6 "2023-06-27T21:15:49Z")

</div>

That’s it! I’ve got it working now.

See this screen grab:

 ![image](https://us1.discourse-cdn.com/flex020/uploads/knack/original/2X/a/a0c552ac1eebf0a2d8fd85917b167dd347de7abc.png)

The green highlight is based on a referenced value that is an average of sales at the bottom of the grid at **$28.27**.

All values greater than this will be colorized. And it will change dynamically upon the next calculation. It can even change in real-time is you add the auto-refresh keyword **\_ar**

All this is done with a string added to the view’s description, as seen here:

 ![image](https://us1.discourse-cdn.com/flex020/uploads/knack/original/2X/f/f3002f7103aba12a5d16ef83dd4d8b35eb066d16.png)

The string goes like this:

`_cfv=[Sales, gt,ktlRefVal,yellow,darkgreen], [ktlRefVal,#view_219 .kn-table-totals:last-of-type td:nth-child(2)]`

It would also work with another view, like a details view or anything else. Just change the CSS selector following the **ktlRefVal** option.

I will release this shortly in version 0.13.11 and update the documentation.

Cheers, enjoy!  
Norm

---

_[View the full topic](https://forums.knack.com/t/dynamic-colour-coding-of-grid/14517)._
