24 lines
639 B
Python
24 lines
639 B
Python
#!/usr/bin/env python
|
|
# encoding: utf-8
|
|
|
|
|
|
def highlight_scores(highlight_columns, score_color):
|
|
""" Cells style in a datatable for scores
|
|
|
|
:param highlight_columns: columns to highlight
|
|
:param value_color: dictionnary {"score": "color"}
|
|
|
|
"""
|
|
hight = []
|
|
for v, color in score_color.items():
|
|
if v:
|
|
hight += [
|
|
{
|
|
"if": {"filter_query": "{{{}}} = {}".format(col, v), "column_id": col},
|
|
"backgroundColor": color,
|
|
"color": "white",
|
|
}
|
|
for col in highlight_columns
|
|
]
|
|
return hight
|