summaryrefslogtreecommitdiff
path: root/xmlTheme.go
diff options
context:
space:
mode:
Diffstat (limited to 'xmlTheme.go')
-rw-r--r--xmlTheme.go142
1 files changed, 77 insertions, 65 deletions
diff --git a/xmlTheme.go b/xmlTheme.go
index 6b9e207..80bb3af 100644
--- a/xmlTheme.go
+++ b/xmlTheme.go
@@ -16,12 +16,59 @@ import "encoding/xml"
// xlsxTheme directly maps the theme element in the namespace
// http://schemas.openxmlformats.org/drawingml/2006/main
type xlsxTheme struct {
- ThemeElements xlsxThemeElements `xml:"themeElements"`
+ XMLName xml.Name `xml:"http://schemas.openxmlformats.org/drawingml/2006/main theme"`
+ XMLNSa string `xml:"xmlns:a,attr"`
+ XMLNSr string `xml:"xmlns:r,attr"`
+ Name string `xml:"name,attr"`
+ ThemeElements xlsxBaseStyles `xml:"themeElements"`
ObjectDefaults xlsxObjectDefaults `xml:"objectDefaults"`
ExtraClrSchemeLst xlsxExtraClrSchemeLst `xml:"extraClrSchemeLst"`
+ CustClrLst *xlsxInnerXML `xml:"custClrLst"`
ExtLst *xlsxExtLst `xml:"extLst"`
}
+// xlsxBaseStyles defines the theme elements for a theme, and is the workhorse
+// of the theme. The bulk of the shared theme information that is used by a
+// given document is defined here. Within this complex type is defined a color
+// scheme, a font scheme, and a style matrix (format scheme) that defines
+// different formatting options for different pieces of a document.
+type xlsxBaseStyles struct {
+ ClrScheme xlsxColorScheme `xml:"clrScheme"`
+ FontScheme xlsxFontScheme `xml:"fontScheme"`
+ FmtScheme xlsxStyleMatrix `xml:"fmtScheme"`
+ ExtLst *xlsxExtLst `xml:"extLst"`
+}
+
+// xlsxCTColor holds the actual color values that are to be applied to a given
+// diagram and how those colors are to be applied.
+type xlsxCTColor struct {
+ ScrgbClr *xlsxInnerXML `xml:"scrgbClr"`
+ SrgbClr *attrValString `xml:"srgbClr"`
+ HslClr *xlsxInnerXML `xml:"hslClr"`
+ SysClr *xlsxSysClr `xml:"sysClr"`
+ SchemeClr *xlsxInnerXML `xml:"schemeClr"`
+ PrstClr *xlsxInnerXML `xml:"prstClr"`
+}
+
+// xlsxColorScheme defines a set of colors for the theme. The set of colors
+// consists of twelve color slots that can each hold a color of choice.
+type xlsxColorScheme struct {
+ Name string `xml:"name,attr"`
+ Dk1 xlsxCTColor `xml:"dk1"`
+ Lt1 xlsxCTColor `xml:"lt1"`
+ Dk2 xlsxCTColor `xml:"dk2"`
+ Lt2 xlsxCTColor `xml:"lt2"`
+ Accent1 xlsxCTColor `xml:"accent1"`
+ Accent2 xlsxCTColor `xml:"accent2"`
+ Accent3 xlsxCTColor `xml:"accent3"`
+ Accent4 xlsxCTColor `xml:"accent4"`
+ Accent5 xlsxCTColor `xml:"accent5"`
+ Accent6 xlsxCTColor `xml:"accent6"`
+ Hlink xlsxCTColor `xml:"hlink"`
+ FolHlink xlsxCTColor `xml:"folHlink"`
+ ExtLst *xlsxExtLst `xml:"extLst"`
+}
+
// objectDefaults element allows for the definition of default shape, line,
// and textbox formatting properties. An application can use this information
// to format a shape (or text) initially on insertion into a document.
@@ -35,24 +82,24 @@ type xlsxExtraClrSchemeLst struct {
ExtraClrSchemeLst string `xml:",innerxml"`
}
-// xlsxThemeElements directly maps the element defines the theme formatting
-// options for the theme and is the workhorse of the theme. This is where the
-// bulk of the shared theme information is contained and used by a document.
-// This element contains the color scheme, font scheme, and format scheme
-// elements which define the different formatting aspects of what a theme
-// defines.
-type xlsxThemeElements struct {
- ClrScheme xlsxClrScheme `xml:"clrScheme"`
- FontScheme xlsxFontScheme `xml:"fontScheme"`
- FmtScheme xlsxFmtScheme `xml:"fmtScheme"`
+// xlsxCTSupplementalFont defines an additional font that is used for language
+// specific fonts in themes. For example, one can specify a font that gets used
+// only within the Japanese language context.
+type xlsxCTSupplementalFont struct {
+ Script string `xml:"script,attr"`
+ Typeface string `xml:"typeface,attr"`
}
-// xlsxClrScheme element specifies the theme color, stored in the document's
-// Theme part to which the value of this theme color shall be mapped. This
-// mapping enables multiple theme colors to be chained together.
-type xlsxClrScheme struct {
- Name string `xml:"name,attr"`
- Children []xlsxClrSchemeEl `xml:",any"`
+// xlsxFontCollection defines a major and minor font which is used in the font
+// scheme. A font collection consists of a font definition for Latin, East
+// Asian, and complex script. On top of these three definitions, one can also
+// define a font for use in a specific language or languages.
+type xlsxFontCollection struct {
+ Latin *xlsxCTTextFont `xml:"latin"`
+ Ea *xlsxCTTextFont `xml:"ea"`
+ Cs *xlsxCTTextFont `xml:"cs"`
+ Font []xlsxCTSupplementalFont `xml:"font"`
+ ExtLst *xlsxExtLst `xml:"extLst"`
}
// xlsxFontScheme element defines the font scheme within the theme. The font
@@ -61,34 +108,19 @@ type xlsxClrScheme struct {
// document, and the minor font corresponds well with the normal text or
// paragraph areas.
type xlsxFontScheme struct {
- Name string `xml:"name,attr"`
- MajorFont xlsxMajorFont `xml:"majorFont"`
- MinorFont xlsxMinorFont `xml:"minorFont"`
- ExtLst *xlsxExtLst `xml:"extLst"`
-}
-
-// xlsxMajorFont element defines the set of major fonts which are to be used
-// under different languages or locals.
-type xlsxMajorFont struct {
- Children []xlsxFontSchemeEl `xml:",any"`
-}
-
-// xlsxMinorFont element defines the set of minor fonts that are to be used
-// under different languages or locals.
-type xlsxMinorFont struct {
- Children []xlsxFontSchemeEl `xml:",any"`
-}
-
-// xlsxFmtScheme element contains the background fill styles, effect styles,
-// fill styles, and line styles which define the style matrix for a theme. The
-// style matrix consists of subtle, moderate, and intense fills, lines, and
-// effects. The background fills are not generally thought of to directly be
-// associated with the matrix, but do play a role in the style of the overall
-// document. Usually, a given object chooses a single line style, a single
-// fill style, and a single effect style in order to define the overall final
-// look of the object.
-type xlsxFmtScheme struct {
- Name string `xml:"name,attr"`
+ Name string `xml:"name,attr"`
+ MajorFont xlsxFontCollection `xml:"majorFont"`
+ MinorFont xlsxFontCollection `xml:"minorFont"`
+ ExtLst *xlsxExtLst `xml:"extLst"`
+}
+
+// xlsxStyleMatrix defines a set of formatting options, which can be referenced
+// by documents that apply a certain style to a given part of an object. For
+// example, in a given shape, say a rectangle, one can reference a themed line
+// style, themed effect, and themed fill that would be theme specific and
+// change when the theme is changed.
+type xlsxStyleMatrix struct {
+ Name string `xml:"name,attr,omitempty"`
FillStyleLst xlsxFillStyleLst `xml:"fillStyleLst"`
LnStyleLst xlsxLnStyleLst `xml:"lnStyleLst"`
EffectStyleLst xlsxEffectStyleLst `xml:"effectStyleLst"`
@@ -123,26 +155,6 @@ type xlsxBgFillStyleLst struct {
BgFillStyleLst string `xml:",innerxml"`
}
-// xlsxClrScheme specifies the theme color, stored in the document's Theme
-// part to which the value of this theme color shall be mapped. This mapping
-// enables multiple theme colors to be chained together.
-type xlsxClrSchemeEl struct {
- XMLName xml.Name
- SysClr *xlsxSysClr `xml:"sysClr"`
- SrgbClr *attrValString `xml:"srgbClr"`
-}
-
-// xlsxFontSchemeEl directly maps the major and minor font of the style's font
-// scheme.
-type xlsxFontSchemeEl struct {
- XMLName xml.Name
- Script string `xml:"script,attr,omitempty"`
- Typeface string `xml:"typeface,attr"`
- Panose string `xml:"panose,attr,omitempty"`
- PitchFamily string `xml:"pitchFamily,attr,omitempty"`
- Charset string `xml:"charset,attr,omitempty"`
-}
-
// xlsxSysClr element specifies a color bound to predefined operating system
// elements.
type xlsxSysClr struct {