Bokeh conditional formatting based on text

Hi,
Definitely bokeh is a great tool.
I try to apply conditional formatting based on text and not value.
This is my code based on number’s value, but for tables with texts, how could I turn this code and adapt font color based for example on the 3 first letters of the text ?

template="""
        <div style="background:<%= 
            (function colorfromstr(){
                if(value < 0){
                    return("yellow")}
                }()) %>; 
            color: black"> 
        <%= value %>
        </div>
        """

Many thanks.