編輯

共用方式為


Color element (Server Ribbon)

Applies to: SharePoint 2016 | SharePoint Foundation 2013 | SharePoint Online | SharePoint Server 2013

Defines a color.

<Color
     Sequence="Integer"
     Title="Text"
     Style="CSS Selector"
     Color="Color string"
     DisplayColor="#hexdec"
/>

Elements and attributes

The following sections describe attributes, child elements, and parent elements.

Attributes

Attribute Description
Sequence
Optional. An integer that specifies the order of placement among sibling XML nodes.
Title
Optional. Specifies text for the Title attribute of the HTML anchor tag that renders the color.
Style
Optional. The name of a CSS selector to apply to the table cell that represents the color.
Color
Optional. A color string to be passed with the command event when the color is selected.
DisplayColor
Optional. A hexadecimal color code to use for the background color of the table cell, such as #FF0000 (red).

Child elements

None

Parent elements

Occurrences

  • Minimum: 0
  • Maximum: unbounded

Example

The following example defines a section of a menu that includes a color picker control with several Color elements.

<MenuSection
    Id="fontColor"
    Title="Standard Colors">
    <Controls Id="Font.Color.Menu.Controls">
        <ColorPicker
            Id="fontColor"
            Command="FontColor">
            <Colors>
                <Color Color="0000C0" Title="Dark Red" DisplayColor="#C00000"/>
                <Color Color="0000FF" Title="Red" DisplayColor="#FF0000" />
                <Color Color="00C0FF" Title="Orange" DisplayColor="#FFC000"/>
                <Color Color="00FFFF" Title="Yellow" DisplayColor="#FFFF00" />
                <Color Color="50D092" Title="Light Green" DisplayColor="#92D050"/>
                <Color Color="50B000" Title="Dark Green" DisplayColor="#00B050"/>
                <Color Color="F0B000" Title="Light Blue" DisplayColor="#00B0F0"/>
                <Color Color="C07000" Title="Blue" DisplayColor="#0070C0"/>
                <Color Color="602000" Title="Dark Blue" DisplayColor="#002060" />
                <Color Color="A03070" Title="Purple" DisplayColor="#7030A0"/>
            </Colors>
        </ColorPicker>
    </Controls>
</MenuSection>