package xlsx import ( "bytes" "encoding/xml" . "gopkg.in/check.v1" ) type ThemeSuite struct{} var _ = Suite(&ThemeSuite{}) func (s *ThemeSuite) TestThemeColors(c *C) { themeXmlBytes := bytes.NewBufferString(` `) var themeXml xlsxTheme err := xml.NewDecoder(themeXmlBytes).Decode(&themeXml) c.Assert(err, IsNil) clrSchemes := themeXml.ThemeElements.ClrScheme.Children c.Assert(len(clrSchemes), Equals, 12) dk1Scheme := clrSchemes[0] c.Assert(dk1Scheme.XMLName.Local, Equals, "dk1") c.Assert(dk1Scheme.SrgbClr, IsNil) c.Assert(dk1Scheme.SysClr, NotNil) c.Assert(dk1Scheme.SysClr.Val, Equals, "windowText") c.Assert(dk1Scheme.SysClr.LastClr, Equals, "000000") dk2Scheme := clrSchemes[2] c.Assert(dk2Scheme.XMLName.Local, Equals, "dk2") c.Assert(dk2Scheme.SysClr, IsNil) c.Assert(dk2Scheme.SrgbClr, NotNil) c.Assert(dk2Scheme.SrgbClr.Val, Equals, "1F497D") theme := newTheme(themeXml) c.Assert(theme.themeColor(0, 0), Equals, "FFFFFFFF") c.Assert(theme.themeColor(2, 0), Equals, "FFEEECE1") }