title: How to color each cell of dash data table depends on it’s value
body: <p>I am using Python3.9. And I am a new learner in Python. This is the output of my dash data table in google chrome. I want to color each cell light green, if the value grater than 0 and green if the value grater than 0 and also grater than the value of the same cell of the previous row. I have tried in many ways but I failed. I think the dash data table and call back function makes it difficult to me to change colour of each cell. Please help me to modify my code for my purpose. Thanks.</p>
  <p><a href="https://i.stack.imgur.com/sMY1w.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/sMY1w.png" alt="enter image description here" /></a></p>
  <pre><code>    import dash
      from dash import dcc
      from dash import html
      from dash import dash_table
      import pandas as pd
      import numpy as np
      from OC import *
      import pandas_ta as pta
  
      findtargetcount=0
      condition_ltp=&quot;&quot;
      condition_demand_supply=&quot;&quot;
      condition_call_vs_putt=&quot;&quot;
      condition_arbitrage=&quot;&quot;
      bullbear=&quot;&quot;
  
      all_data=[]
      app = dash.Dash(__name__)
  
      def getData(): #For getting data from NSEpython
          data=returnn()
          all_data.append(copy.deepcopy(data))
          df = pd.DataFrame(all_data)
  
          for i in range(1, len(df)):
      
              def find_trend():
  
                  global findtargetcount,condition_ltp,condition_demand_supply,condition_call_vs_putt,condition_arbitrage,bullbear
                  val_ltp=df.loc[i, 'LTP']
                  val_ltppre=df.loc[i-1, 'LTP']
                  val_callvsput=df.loc[i, 'Call vs Put']
                  valcallvsputpre=df.loc[i-1, 'Call vs Put']
                  val_demandsupply=df.loc[i, 'Demand/Supply']
                  val_demandsupplypre=df.loc[i-1, 'Demand/Supply']
                  val_Arbitrage=df.loc[i, 'Arbitrage']
                  val_Arbitragepre=df.loc[i-1, 'Arbitrage']
          
                  if condition_ltp==&quot;&quot; and val_ltp&gt;val_ltppre:
                          condition_ltp=&quot;bullish&quot;
                  elif condition_ltp==&quot;&quot; and val_ltp&lt;val_ltppre:
                          condition_ltp=&quot;bearish&quot;
              
                  if condition_call_vs_putt==&quot;&quot; and val_callvsput&gt;call_vs_put_standerd_val and val_callvsput&gt;valcallvsputpre:
                          condition_call_vs_putt=&quot;bullish&quot;
                  elif condition_call_vs_putt==&quot;&quot; and val_callvsput&lt;call_vs_put_standerd_val and val_callvsput&lt;valcallvsputpre:
                          condition_call_vs_putt=&quot;bearish&quot;
              
                  if condition_demand_supply==&quot;&quot; and val_demandsupply&gt;demand_supply_standerd_val and val_demandsupply&gt;val_demandsupplypre:
                          condition_demand_supply=&quot;bullish&quot;
                  elif condition_demand_supply==&quot;&quot; and val_demandsupply&lt;demand_supply_standerd_val and val_demandsupply&lt;val_demandsupplypre:
                          condition_demand_supply=&quot;bearish&quot;
              
                  if condition_arbitrage==&quot;&quot; and val_Arbitrage&gt;arbitrage_standerd_val and val_Arbitrage&gt;val_Arbitragepre:
                          condition_arbitrage=&quot;bullish&quot;
                  elif condition_arbitrage==&quot;&quot; and val_Arbitrage&lt;arbitrage_standerd_val and val_Arbitrage&lt;val_Arbitragepre:
                          condition_arbitrage=&quot;bearish&quot;
              
                  if condition_ltp==&quot;bullish&quot; and condition_call_vs_putt==&quot;bullish&quot; and condition_demand_supply==&quot;bullish&quot; and condition_arbitrage==&quot;bullish&quot;:
                          bullbear=&quot;BULLISH&quot;
                  elif condition_ltp==&quot;bearish&quot; and condition_call_vs_putt==&quot;bearish&quot; and condition_demand_supply==&quot;bearish&quot; and condition_arbitrage==&quot;bearish&quot;:
                          bullbear=&quot;BEARISH&quot;
                  else:
                          bullbear=&quot;NOT CONFIRMED&quot;
  
                  return bullbear
     
              df.loc[i, 'ZONE']=find_trend()
  
          return df.to_dict('records')
  
      app.layout = html.Div([
            html.H4('Option Chain'),
            dcc.Interval('table-update', interval = 60000*1, n_intervals = 1),
            dash_table.DataTable(
                id = 'table',
                data = getData())])
        
        
      @app.callback(
              dash.dependencies.Output('table','data'),
              [dash.dependencies.Input('table-update', 'n_intervals')])
      def updateTable(n):
           time.sleep(1)
           return getData()
  
      if __name__ == '__main__':
           app.run_server(debug=False)
  </code></pre>