How To Change the Select Field Color?

Hello , I have created a Doctype named Request I have a select field in it having 4 values A , B , C , D
I want them to be displayed in color in list view .
Please Can Any One Tell Me How Can I do So

In Doctype find Document state and add states like these

@nilpatel42 Thanks For your response
I implemented the changes as per your suggestion


but it is still not showing color in the list view

@dhruv_vaswani try to use formatter : create a client script type list :

frappe.listview_settings['Request'] = {
   formatters: {
        response_status(val) {
            if (val=="A"){
          return "<span class='indicator-pill green'>"+__(val)+"</span>"
          }else{
           return "<span class='indicator-pill red'>"+__(val)+"</span>"
             }
        }
    }


}
7 Likes

@bahaou Really thanks for your.
The color is being displayed on the list view now ;

can we set the above code to display red if the number is negative & green if number is positive?
Rgds
Frz

If you are doing it for a select field then simply select the option in the if statement and give it a color
and if there is more then one negative value you can also use the “else if” statement for it

Hope this is helpfull

Thank you