DrawingML 对象¶
DrawingML objects
出现在各种文档上下文中的低级绘图元素(如颜色)。
Low-level drawing elements like color that appear in various document contexts.
ColorFormat
对象¶
ColorFormat
objects
- class docx.dml.color.ColorFormat[源代码]¶
Provides access to color settings such as RGB color, theme color, and luminance adjustments.
- property rgb¶
An
RGBColor
value orNone
if no RGB color is specified.When
type
is MSO_COLOR_TYPE.RGB, the value of this property will always be anRGBColor
value. It may also be anRGBColor
value iftype
is MSO_COLOR_TYPE.THEME, as Word writes the current value of a theme color when one is assigned. In that case, the RGB value should be interpreted as no more than a good guess however, as the theme color takes precedence at rendering time. Its value isNone
whenevertype
is eitherNone
or MSO_COLOR_TYPE.AUTO.Assigning an
RGBColor
value causestype
to become MSO_COLOR_TYPE.RGB and any theme color is removed. AssigningNone
causes any color to be removed such that the effective color is inherited from the style hierarchy.
- property theme_color¶
Member of MSO_THEME_COLOR_INDEX or
None
if no theme color is specified.When
type
is MSO_COLOR_TYPE.THEME, the value of this property will always be a member of MSO_THEME_COLOR_INDEX. Whentype
has any other value, the value of this property isNone
.Assigning a member of MSO_THEME_COLOR_INDEX causes
type
to become MSO_COLOR_TYPE.THEME. Any existing RGB value is retained but ignored by Word. AssigningNone
causes any color specification to be removed such that the effective color is inherited from the style hierarchy.
- property type: MSO_COLOR_TYPE¶
Read-only.
A member of MSO_COLOR_TYPE, one of RGB, THEME, or AUTO, corresponding to the way this color is defined. Its value is
None
if no color is applied at this level, which causes the effective color to be inherited from the style hierarchy.