1. package main
    2. import (
    3. "fmt"
    4. "github.com/360EntSecGroup-Skylar/excelize"
    5. func main() {
    6. f, _ := excelize.OpenFile("Book1.xlsx")
    7. fmt.Println(getCellBgColor(f, "Sheet1", "C1"))
    8. }
    9. func getCellBgColor(f *excelize.File, sheet, axix string) string {
    10. fgColor := f.Styles.Fills.Fill[fillID].PatternFill.FgColor
    11. if fgColor.Theme != nil {
    12. srgbClr := f.Theme.ThemeElements.ClrScheme.Children[*fgColor.Theme].SrgbClr.Val
    13. return excelize.ThemeColor(srgbClr, fgColor.Tint)
    14. }
    15. return fgColor.RGB