def rank_cells(self, rank, quality):
        c = Cell(self.ws, column="A", row=1, value=rank)
        color = methods[rank]
        if quality == 0:
            # If only 1 locale consists of translation, make color "Reddish".
            color = "FF" + color[2:]
        elif rank != "EQUAL_LOWERCASE" and quality >= 1:
            # If translation is consistent across 2 or more locales, then GREEN.
            color = "00FF00"
        elif quality > 1:
            color = "00FF00"

        # Fill background of cell with color
        pf = PatternFill("solid", fgColor=colors.Color(color))
        c.fill = pf
        return c
예제 #2
0
 def set_highlight(self, cell: Cell) -> None:
     cell.fill = PatternFill(fill_type='solid',
                             fgColor=Color(rgb='FFFFF200', type='rgb'),
                             bgColor=Color(rgb='FFFFFF00', type='rgb'))