How to change background colour of text column in List or Library control

Hi there,

I have a list or library control that is pulling in some columns from a SP list. I have a text column I would like to change the background colour of if it contains certain text (see image).

Is there a way to do this?

Dear @mhannaway,
Here's an article on how to customize view of columns - Customize view of columns in List or Library — SharePoint forms

The one example changes color of the text, but you can use CSS to customize background instead.

Thank you @Nikita_Kurguzov ,

I have attempted this but cannot seem to get it to work. Is there any code for customising background of a text field. The one in the article references overdue dates from date field.

Thank you

Dear @mhannaway,
I don't know what your condition needs to be, but in general, it works like this:

fd.spRendered(function() {
    fd.control('SPDataTable1').templates = {
        // Highlight overdue dates in red
        Title: function(ctx) {
            var value = ctx.row.Title;
            if (!value) {
                return '';
            }

            return value.indexOf('Test') >= 0
                ? '<span style="display:block; background:#ffe68a; padding:5px;">' + value + '</span>'
                : '<span>' + value + '</span>';
        }
    }
})