Skip to content

Commit bec4e6e

Browse files
committed
support to add theme v2
1 parent f653bff commit bec4e6e

File tree

1 file changed

+77
-21
lines changed
  • sharepoint/sharepoint-ps/Microsoft.Online.SharePoint.PowerShell

1 file changed

+77
-21
lines changed

sharepoint/sharepoint-ps/Microsoft.Online.SharePoint.PowerShell/Add-SPOTheme.md

Lines changed: 77 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -18,22 +18,37 @@ Creates a new custom theme, or overwrites an existing theme to modify its settin
1818

1919
## SYNTAX
2020

21+
### LegacyThemeSet
2122
```
22-
Add-SPOTheme [-Identity] <SpoThemePipeBind> -Palette <SpoThemePalettePipeBind> -IsInverted <Boolean>
23-
[-Overwrite] [<CommonParameters>]
23+
Add-SPOTheme
24+
[-Identity] <SpoThemePipeBind>
25+
-Palette <SpoThemePalettePipeBind>
26+
-IsInverted <Boolean>
27+
[-Overwrite]
28+
[<CommonParameters>]
2429
```
2530

26-
## DESCRIPTION
31+
### NewThemeSet
32+
```
33+
Add-SPOTheme
34+
[-Identity] <SpoThemePipeBind>
35+
-ColorPairs <SpoThemeColorPairPipeBind>
36+
[-Overwrite]
37+
[<CommonParameters>]
38+
```
2739

28-
The **Add-SPOTheme** cmdlet creates a new theme or updates an existing theme. The color palette settings can be passed as either a hash table or a dictionary.
40+
## DESCRIPTION
41+
The **Add-SPOTheme** cmdlet creates a new theme or updates an existing theme. The color palette and color pairs settings can be passed as either a hash table or a dictionary.
2942

3043
Adding a theme does not apply the theme to any sites. It adds the theme to your tenant store, and then the theme is available in the list of themes under the **Change the look** option for modern pages.
3144

32-
## EXAMPLES
45+
You can choose which parameter set to use depending on the legacy or new theme format you want to add. Please read [Site theme](https://learn.microsoft.com/sharepoint/site-theme) for more about new theme.
46+
3347

34-
### Example 1
48+
## Examples
3549

36-
In this example, a new theme named `"Custom Cyan"` is created, with color palette settings that are various shades of cyan. Note that the settings are passed as a hash table.
50+
### Example 1: Add a legacy format theme
51+
In this example, a theme named `"Custom Cyan"` is created, with color palette settings that are various shades of cyan. Note that the settings are passed as a hash table.
3752

3853
```powershell
3954
$themepalette = @{
@@ -70,14 +85,37 @@ Add-SPOTheme -Identity "Custom Cyan" -Palette $themepalette -IsInverted $false
7085
> [!NOTE]
7186
> Prior to the December 2017 release of the SPO Management Shell, the **Add-SPOTheme** cmdlet required that color palette settings be passed as a dictionary. We recommend that you use the latest version of the SPO Management Shell, or use the `HashToDictionary` function to convert a hash table to a dictionary if needed.
7287
73-
### Example 2
88+
### Example 2: Overwrite a legacy format theme
7489

75-
If you want to update an existing theme (to modify some of its color settings, for example), use the same syntax as shown previously, but add the `-Overwrite` flag to the **Add-SPOTheme** cmdlet.
90+
If you want to update an existing legacy format theme (to modify some of its color settings, for example), use the same syntax as shown previously, but add the `-Overwrite` flag to the **Add-SPOTheme** cmdlet.
7691

7792
```powershell
7893
Add-SPOTheme -Identity "Custom Cyan" -Palette $themepalette -IsInverted $false -Overwrite
7994
```
8095

96+
### Example 3: Add a new format theme
97+
```powershell
98+
$colorPairs = @{
99+
light = @(
100+
@{
101+
foregroundColor = '#00ffff'
102+
backgroundColor = '#fff'
103+
},
104+
@{
105+
foregroundColor = '#fff'
106+
backgroundColor = '#00ffff'
107+
}
108+
)
109+
}
110+
111+
Add-SPOTheme -Identity "Custom Cyan" -ColorPairs $colorPairs
112+
```
113+
114+
### Example 4: Overwrite a new format theme
115+
```powershell
116+
Add-SPOTheme -Identity "Custom Cyan" -ColorPairs $colorPairs -Overwrite
117+
```
118+
81119
## PARAMETERS
82120

83121
### -Identity
@@ -98,36 +136,36 @@ Accept pipeline input: True (ByValue)
98136
Accept wildcard characters: False
99137
```
100138
101-
### -IsInverted
139+
### -Overwrite
102140
103141
> Applicable: SharePoint Online
104142
105-
Specifies whether the theme is inverted, with a dark background and a light foreground.
143+
Overwrites a theme of the same name in case it exists.
106144
107145
```yaml
108-
Type: System.Boolean
146+
Type: System.Management.Automation.SwitchParameter
109147
Parameter Sets: (All)
110148
Aliases: None
111149

112-
Required: True
150+
Required: False
113151
Position: Named
114152
Default value: None
115153
Accept pipeline input: False
116154
Accept wildcard characters: False
117155
```
118156
119-
### -Overwrite
157+
### -ColorPairs
120158
121159
> Applicable: SharePoint Online
122160
123-
Overwrites a theme of the same name in case it exists.
161+
Specifies the color pairs of the theme, as a dictionary or hash table of theme slot values. Supports up to 16 color pairs.
124162
125163
```yaml
126-
Type: System.Management.Automation.SwitchParameter
127-
Parameter Sets: (All)
128-
Aliases: None
164+
Type: Microsoft.Online.SharePoint.PowerShell.SpoThemeColorPairPipeBind
165+
Parameter Sets: NewThemeSet
166+
Aliases:
129167

130-
Required: False
168+
Required: True
131169
Position: Named
132170
Default value: None
133171
Accept pipeline input: False
@@ -138,11 +176,11 @@ Accept wildcard characters: False
138176
139177
> Applicable: SharePoint Online
140178
141-
Specifies the palette of colors in the theme, as a dictionary of theme slot values.
179+
Specifies the palette of colors in the theme, as a dictionary or hash table of theme slot values.
142180
143181
```yaml
144182
Type: Microsoft.Online.SharePoint.PowerShell.SpoThemePalettePipeBind
145-
Parameter Sets: (All)
183+
Parameter Sets: LegacyThemeSet
146184
Aliases:
147185

148186
Required: True
@@ -155,6 +193,24 @@ Accept wildcard characters: False
155193
### CommonParameters
156194
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](https://go.microsoft.com/fwlink/?LinkID=113216).
157195
196+
### -IsInverted
197+
198+
> Applicable: SharePoint Online
199+
200+
Specifies whether the theme is inverted, with a dark background and a light foreground.
201+
202+
```yaml
203+
Type: System.Boolean
204+
Parameter Sets: LegacyThemeSet
205+
Aliases: None
206+
207+
Required: True
208+
Position: Named
209+
Default value: None
210+
Accept pipeline input: False
211+
Accept wildcard characters: False
212+
```
213+
158214
## INPUTS
159215
160216
### Microsoft.Online.SharePoint.PowerShell.SpoThemePipeBind

0 commit comments

Comments
 (0)