Skip to content

Commit

Permalink
[xlsx-] default color if no coloring present #1718
Browse files Browse the repository at this point in the history
  • Loading branch information
saulpw committed Oct 20, 2023
1 parent 04d09a2 commit 54045f8
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions visidata/loaders/xlsx.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,8 +205,8 @@ def save_xls(vd, p, *sheets):

@XlsxSheet.api
def colorize_xlsx_cell(sheet, col, row):
fg = getattrdeep(row, col.column_letter+'.font.color')
bg = getattrdeep(row, col.column_letter+'.fill.start_color')
fg = getattrdeep(row, col.column_letter+'.font.color', None)
bg = getattrdeep(row, col.column_letter+'.fill.start_color', None)
fg = sheet.xlsx_color_to_xterm256(fg)
bg = sheet.xlsx_color_to_xterm256(bg)

Expand All @@ -217,6 +217,9 @@ def colorize_xlsx_cell(sheet, col, row):

@XlsxSheet.api
def xlsx_color_to_xterm256(sheet, color) -> str:
if not color:
return ''

if color.type == 'rgb':
s = color.value
if isinstance(s, int):
Expand Down

0 comments on commit 54045f8

Please sign in to comment.