Export themes from brand center
Theme Center has an API to export the theme that has been directly created in the Brand Center.
https://<tenant>.sharepoint.com/sites/brandcenter/_api/brandcenter/GetTenantThemes
This call will return all a theme in the following format:
{
"@odata.context": "https://contoso.sharepoint.com/sites/brandcenter/_api/$metadata#SP.TenantThemes",
"hideDefaultThemes": false,
"themeData": [
{
"id": 83,
"isThemesV2": false,
"isVisible": true,
"name": "Coffee Theme",
"source": 1,
"themeJson": "{\"name\":\"Coffee Theme\",\"isInverted\":true,\"palette\":{\"themeDarker\":\"#171f1d\",\"themeDark\":\"#2c3b37\",\"themeDarkAlt\":\"#415751\",\"themePrimary\":\"#C0FFEE\",\"themeSecondary\":\"#56736b\",\"themeTertiary\":\"#6b8f85\",\"themeLight\":\"#80ab9f\",\"themeLighter\":\"#95c7ba\",\"themeLighterAlt\":\"#aae3d4\",\"black\":\"#171f1d\",\"neutralDark\":\"#2c3b37\",\"neutralPrimary\":\"#C0FFEE\",\"neutralPrimaryAlt\":\"#56736b\",\"neutralSecondary\":\"#6b8f85\",\"neutralTertiary\":\"#80ab9f\",\"neutralTertiaryAlt\":\"#000000\",\"neutralLight\":\"#000000\",\"neutralLighter\":\"#000000\",\"neutralLighterAlt\":\"#000000\",\"white\":\"#000000\",\"neutralQuaternaryAlt\":\"#000000\",\"neutralQuaternary\":\"#000000\",\"accent\":\"#4F6BED\"}}"
}
]
}
This call returns all the themes.
m365 spo theme list
This does not return any of the Brand Center specifc themes so either we should include these calls in the regular command or write a dedicated set of Brand Center calls. Thoughts?
Makes perfect sense to include brand center themes in there.
We have the following options:
- Introduce a new command for it
- Extend
spo theme listto include BC themes, add a switch to exclude, eg.--withoutBrandCentral - Extend
spo theme listwith a switch to include BC themes, eg.--withBrandCentral
My gut feeling tells me to go with 2 but I'm curious what you think @pnp/cli-for-microsoft-365-maintainers
Turns out the api can get called from everywhere in SharePoint with that URL and does not need to get called within brand center.
In addition we have other brand center specific methods:
AddTenantTheme
Endpoint:
/_api/brandcenter/AddTenantTheme
Payload:
{
"themeData": {
"name": "Test",
"themeJson": "{\"name\":\"Test\",\"isInverted\":true,\"palette\":{\"themeDarker\":\"#014446\",\"themeDark\":\"#025c5f\",\"themeDarkAlt\":\"#026d70\",\"themePrimary\":\"#03787C\",\"themeSecondary\":\"#13898d\",\"themeTertiary\":\"#49aeb1\",\"themeLight\":\"#98d6d8\",\"themeLighter\":\"#c5e9ea\",\"themeLighterAlt\":\"#f0f9fa\",\"black\":\"#000000\",\"neutralDark\":\"#201f1e\",\"neutralPrimary\":\"#323130\",\"neutralPrimaryAlt\":\"#3b3a39\",\"neutralSecondary\":\"#605e5c\",\"neutralTertiary\":\"#a19f9d\",\"neutralTertiaryAlt\":\"#c8c6c4\",\"neutralLight\":\"#edebe9\",\"neutralLighter\":\"#f3f2f1\",\"neutralLighterAlt\":\"#faf9f8\",\"white\":\"#ffffff\",\"neutralQuaternaryAlt\":\"#e1dfdd\",\"neutralQuaternary\":\"#d0d0d0\",\"accent\":\"#C0FFEE\"}}",
"isVisible": true,
"source": 1
}
}
UpdateTenantTheme
Endpoint
/_api/brandcenter/UpdateTenantTheme
Payload
{
"themeData": {
"id": "83",
"name": "Coffee Theme",
"themeJson": "{\"name\":\"Coffee Theme\",\"isInverted\":true,\"palette\":{\"themeDarker\":\"#171f1d\",\"themeDark\":\"#2c3b37\",\"themeDarkAlt\":\"#415751\",\"themePrimary\":\"#C0FFEE\",\"themeSecondary\":\"#56736b\",\"themeTertiary\":\"#6b8f85\",\"themeLight\":\"#80ab9f\",\"themeLighter\":\"#95c7ba\",\"themeLighterAlt\":\"#aae3d4\",\"black\":\"#171f1d\",\"neutralDark\":\"#2c3b37\",\"neutralPrimary\":\"#C0FFEE\",\"neutralPrimaryAlt\":\"#56736b\",\"neutralSecondary\":\"#6b8f85\",\"neutralTertiary\":\"#80ab9f\",\"neutralTertiaryAlt\":\"#000000\",\"neutralLight\":\"#000000\",\"neutralLighter\":\"#000000\",\"neutralLighterAlt\":\"#000000\",\"white\":\"#000000\",\"neutralQuaternaryAlt\":\"#000000\",\"neutralQuaternary\":\"#000000\",\"accent\":\"#4F6BED\"}}",
"isVisible": true,
"source": 1
}
}
Validate Theme Name
Endpoint
_api/brandcenter/ValidateTenantThemeName
Payload:
{"name":"Test"}
Interesting @StfBauer, @waldekmastykarz. I agree it would be best to go with option 2; include the results from the extra api call on the existing theme list command.
Question though: do you have an idea what the source property means that's included in the response object? Could it be an enum of which nr 1 means brandcenter theme? (0 being regular tenant themes) That would be an interesting perspective that could maybe help us out here: if my assumption is correct we could add a --source option with several auto completed options like: all, regular, brandcenter, or something like it.
For adding and updating themes we should look into the same principle: adding the functionality to existing commands spo theme add and set.
One remark from my side, I would call the command spo brandcenter tenant theme list since it's about tenant themes. Seems like there is also an endpoint to list themes from a specific site (which we should call spo brandcenter site theme list for example).
Interesting @StfBauer, @waldekmastykarz. I agree it would be best to go with option 2; include the results from the extra api call on the existing theme list command.
Question though: do you have an idea what the
sourceproperty means that's included in the response object? Could it be an enum of which nr 1 means brandcenter theme? (0 being regular tenant themes) That would be an interesting perspective that could maybe help us out here: if my assumption is correct we could add a--sourceoption with several auto completed options like:all,regular,brandcenter, or something like it.For adding and updating themes we should look into the same principle: adding the functionality to existing commands
spo theme addandset.
Hey. Do you know if there is some roadmap on updating 'spo theme set' command to support Brand center themes?
One remark from my side, I would call the command
spo brandcenter tenant theme listsince it's about tenant themes. Seems like there is also an endpoint to list themes from a specific site (which we should callspo brandcenter site theme listfor example).
What if we dropped brandcenter from the name altogether and went with spo tenant theme list and spo site theme list?
Would that mean that we'll mix regular themes and brand center themes into one command? What will we do with the "spo brandcenter add" command to create a brand center? What will we do when more APIs become available like configuring a custom font? And currently we also have a spec for brand center settings.
There are no "regular" and "brand center themes" as far as I have seem them they are the same just have different end points.
There are no "regular" and "brand center themes" as far as I have seem them they are the same just have different end points.
So from the user's point of view, you apply a theme and they can be surfaced from wherever?
What will we do with the "spo brandcenter add" command to create a brand center?
What if we used spo brandcenter for managing brandcenter itself?
There are no "regular" and "brand center themes" as far as I have seem them they are the same just have different end points.
That's also something I found out. I wonder why they separate them with different endpoints.
@pnp/cli-for-microsoft-365-maintainers I wonder if we could try to reitarate on this one and clarify what needs to be done.
From what I checked I think the last stance would be to add spo tenant theme list and spo site theme list commands allowing to show all themes with and option --withoutBrandCentral to hide themes coming from brand center.
As part of the issue/work we need to also investigate the source property/enum and try to figure out what 1 and 0 means.
Is this good enough to open it up?
@Seathin sorry but currently we don't have any schedual when other commands like theme set/add will get updated as well.
@pnp/cli-for-microsoft-365-maintainers I wonder if we could try to reitarate on this one and clarify what needs to be done. From what I checked I think the last stance would be to add
spo tenant theme listandspo site theme listcommands allowing to show all themes with and option--withoutBrandCentralto hide themes coming from brand center. As part of the issue/work we need to also investigate thesourceproperty/enum and try to figure out what 1 and 0 means. Is this good enough to open it up?@Seathin sorry but currently we don't have any schedual when other commands like
theme set/addwill get updated as well.
How would spo tenant theme list differentiate from spo theme list?
How would
spo tenant theme listdifferentiate fromspo theme list?
Maybe I missed something but didn't you suggest here to rename the spo theme list to spo brandcenter tenant theme list and then we agreed to drop the brandcenter from the name 🤔.
I only like summarized the above I think
Since Microsoft changed the Brand Center again, there is no way to export the new themes—at least not that I have seen. It allows you to configure multiple slots of foreground and color, which I had no time to inspect yet.