当前位置:网站首页 > 更多 > 玩电脑 > 正文

[玩转系统] SharePoint Online:如何使用 PowerShell 添加新的自定义主题?

作者:精品下载站 日期:2024-12-14 14:48:11 浏览:19 分类:玩电脑

SharePoint Online:如何使用 PowerShell 添加新的自定义主题?


要求:在 SharePoint Online 中创建一个新主题。

如何在 SharePoint Online 中创建新的颜色主题?

SharePoint Online 主题是可用于调整网站外观的设置的集合。您可以使用主题来控制网站的颜色、字体和布局。 SharePoint Online 现代网站(团队、通信和中心网站)提供一组默认主题(蓝色、橙色、红色、紫色、绿色和灰色),您可以使用它们快速更改 SharePoint 的外观和感觉或外观网站。此外,您还可以创建新主题,为用户提供更加定制化的体验。

我将向您展示如何使用 PowerShell 在 SharePoint Online 上安装主题。对于管理员或网站所有者本身来说,这是一种创建自定义 SharePoint 主题的绝佳方法,而无需使用 CSS。如何在 SharePoint Online 中添加自定义主题?在 SharePoint 中创建自定义主题是一种快速、简单的方法,可以为您的网站提供独特的外观和感觉。以下是在 SharePoint Online 中添加自定义主题的步骤:

步骤 1:在 SharePoint Online 中创建新的颜色主题

使用此 Microsoft Fluent UI 主题设计器在 SharePoint Online 中创建新主题:https://aka.ms/themedesigner。自定义和导出主题输出。

[玩转系统] SharePoint Online:如何使用 PowerShell 添加新的自定义主题?

步骤 2:使用 PowerShell 将自定义主题添加到 SharePoint Online

使用主题设计器创建主题后,使用 PowerShell 将主题颜色添加到 SharePoint Online 租户。以 SharePoint 管理员身份打开 SharePoint Online Management Shell 或 PowerShell ISE,确保将管理中心 URL 更改为您的域并运行此脚本以使用 PowerShell 将网站主题添加到 SharePoint Online:


#Define the color palette
$ThemePalette = @{
"themePrimary" = "#00d492";
"themeLighterAlt" = "#f3fdfa";
"themeLighter" = "#d0f8eb";
"themeLight" = "#a9f2db";
"themeTertiary" = "#5ce5b9";
"themeSecondary" = "#1ad99c";
"themeDarkAlt" = "#00be82";
"themeDark" = "#00a16e";
"themeDarker" = "#007751";
"neutralLighterAlt" = "#f8f8f8";
"neutralLighter" = "#f4f4f4";
"neutralLight" = "#eaeaea";
"neutralQuaternaryAlt" = "#dadada";
"neutralQuaternary" = "#d0d0d0";
"neutralTertiaryAlt" = "#c8c8c8";
"neutralTertiary" = "#ae9e9e";
"neutralSecondary" = "#938181";
"neutralPrimaryAlt" = "#796767";
"neutralPrimary" = "#0f0b0b";
"neutralDark" = "#443636";
"black" = "#2a2020";
"white" = "#ffffff";
}

#Set Admin Center URL
$AdminCenterURL = "https://crescent-admin.sharepoint.com"

#Connect to SharePoint Online - Prompt for credentials
Connect-SPOService -url $AdminCenterURL -Credential (Get-Credential)

#Add new SharePoint Online theme
Add-SPOTheme -Name "Crescent Green" -Palette $ThemePalette -IsInverted $False

此 PowerShell 将网站主题添加到 SharePoint Online。如果您转到站点设置齿轮图标>>更改外观,您会发现“公司主题”下列出了新的颜色主题!您可以选择团队,然后单击“应用”按钮来更改 SharePoint 网站集的团队。

[玩转系统] SharePoint Online:如何使用 PowerShell 添加新的自定义主题?

SharePoint Online 使用 PnP PowerShell 添加自定义主题

虽然 SharePoint 提供了各种预构建主题,但您可能会发现您想要创建一个更适合您组织需求的自定义主题。您可以使用 PnP PowerShell 和 Add-PnPTenantTheme cmdlet 将新主题添加到 SharePoint Online。以下是在 SharePoint Online 中创建自定义主题的方法:


#Parameter
$AdminCenterURL = "https://crescent-admin.sharepoint.com"

#Connect to Admin Center
Connect-PnPOnline -Url $AdminCenterURL -Interactive

#Define Theme
$ThemePalette = @{
    "themePrimary" = "#5fc5df";
    "themeLighterAlt" = "#f8fdfe";
    "themeLighter" = "#e3f5fa";
    "themeLight" = "#cbedf5";
    "themeTertiary" = "#9bdbeb";
    "themeSecondary" = "#71cbe2";
    "themeDarkAlt" = "#56b1c8";
    "themeDark" = "#4995a9";
    "themeDarker" = "#356e7c";
    "neutralLighterAlt" = "#f8f8f8";
    "neutralLighter" = "#f4f4f4";
    "neutralLight" = "#eaeaea";
    "neutralQuaternaryAlt" = "#dadada";
    "neutralQuaternary" = "#d0d0d0";
    "neutralTertiaryAlt" = "#c8c8c8";
    "neutralTertiary" = "#d8baba";
    "neutralSecondary" = "#b17f7f";
    "neutralPrimaryAlt" = "#8d5252";
    "neutralPrimary" = "#7e4343";
    "neutralDark" = "#5f3232";
    "black" = "#462525";
    "white" = "#ffffff";
    "primaryBackground" = "#ffffff";
    "primaryText" = "#7e4343";
    "bodyBackground" = "#ffffff";
    "bodyText" = "#7e4343";
    "disabledBackground" = "#f4f4f4";
    "disabledText" = "#c8c8c8";
}

#powershell to add custom theme in sharepoint online 
Add-PnPTenantTheme -Identity "Corporate Theme" -Palette $ThemePalette -IsInverted $False -Overwrite

这将在 SharePoint Online 中创建自定义主题。如何更改 SharePoint Online 中的默认主题?要将主题应用到 SharePoint Online 网站,请使用:如何使用 PowerShell 在 SharePoint Online 中应用主题?

您需要 登录账户 后才能发表评论

取消回复欢迎 发表评论:

关灯