I am using HTML-Email with HTML Table within - Python MIME type : text/html Email with below code :
dashboardTable = """ <table>"""
indexCount = 1
for sectionIndex in range(0,len(sections_available)):
dashboardTable = dashboardTable + """
<tr>
<td align='left'>""" + str(indexCount) + """ </td>
<td align='left'>""" + sections_available[sectionIndex] + """ </td>
<td align='left'> """ + str(sections_timeTaken[sectionIndex]) + """ </td>
</tr>"""
indexCount = indexCount + 1
dashboardTable = dashboardTable + """</table>"""
I need to color Third Cell:
<td align='left'> """ + str(sections_timeTaken[sectionIndex]) + """ </td>
In a way such that, Highest sections_timeTaken value kept with "Red Color" to lowest in "Green Color". Coloring entire range of values in ordered manner from Highest to Lowsest :
Like Red -> Light red -> Lightesr Red -> Yellow - > Green eventually.[ Not mentioning exact shade]
The total number of Values to be plotted inside table will remain dynamic.
I am using Python HTML table within Email.
I think this would be easier to work with in HSL, at least for setting up your color values. That way you can work with one counter per hsl in a 0-1 range versus setting up a bunch of points in hexadecimal to fade up to / down from and addressing them via an array.
Luckily there's a good python library for color format conversion: https://pypi.python.org/pypi/colour/0.0.5
should be pretty easy to work that into your code i reckon.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.