import openpyxl as vb
from openpyxl.styles.colors import Color
path='F:/test/'
book=vb.load_workbook(path+'test.xlsx')
chuhuo=book['Sheet1']
fg=Color(theme=4,tint=0.6)
bg=Color(indexed=64)
fill=vb.styles.PatternFill(fill_type='solid',fgColor=fg,bgColor=bg)
print(fill)
chuhuo.cell(1,1).fill=fill #styles.colors和styles.PatternFill非同级,colors在PatternFill中,单独设定chuhuo.cell(1,1).fill=vb.styles.colors.Color(theme=4,tint=0.6)会报错无法成功设定
book.save(path+'test2.xlsx')