I have tried to print some_cell.font.color.rgb and got various results.
For some I got what I want (like "FF000000"), but for others it gives me Value must be type 'basetring'. I assume that the latter is because I haven't actually defined the font color for these cells.
I'm using openpyxl 2.2.2
解决方案
I think this is a bug in openpyxl and I think you should report it here.
Debugging the following code (with trepan3k of course):
from openpyxl import Workbook
wb = Workbook()
ws = wb.active
c = ws['A4'] # cell gets created here
print(ws['A4'].font.color)
I get:
Color(rgb=Value must be type 'str', indexed=Value must be type 'int', auto=Value must be type 'bool', theme=1, tint=0.0, type='theme')