SharePoint / sp-dev-docs

SharePoint & Viva Connections Developer Documentation
https://docs.microsoft.com/en-us/sharepoint/dev/
Creative Commons Attribution 4.0 International
1.24k stars 994 forks source link

Custom color palette reverts to default after refresh page #9153

Closed vomos2020 closed 11 months ago

vomos2020 commented 11 months ago

Target SharePoint environment

SharePoint Online

What SharePoint development model, framework, SDK or API is this about?

๐Ÿ’ฅ SharePoint Framework

Developer environment

Windows

What browser(s) / client(s) have you tested

Additional environment details

Describe the bug / error

We use custom color palette for branding custom spfx web parts. We are facing an issue that after some time after refreshing setting in spfx webpart custom colors became reverting to default colors. We checked on different tenants and this issue reproducing only on specific tenant not on all.

We used Add-SPOTheme -Name "Custom theme" -Palette $palette -IsInverted $false to deploy custom palette.

Steps to reproduce

  1. Upload new color palette
  2. Apply new color palette on Site collection.
  3. Click Save. Result: colors applied to spfx webparts
  4. Refresh the page. Result: color reverted to default values on all webparts

Expected behavior

After applying new color palette color must change on all custom spfx webparts

ghost commented 11 months ago

Thank you for reporting this issue. We will be triaging your incoming issue as soon as possible.

AJIXuMuK commented 11 months ago

@vomos2020 - could you please provide more information on this issue?

sosandumsft commented 11 months ago

@AJIXuMuK here's the theme definition $palette= @{ "sb_themePrimary" = "#06858ะก"; "sb_themeSecondary" = "#fff200" ; "sb_themeTertiary" = "#fff200" ; "sb_neutralPrimaryAlt" = "#27251f"; "sb_neutralPrimary" = "#27251f"; "sb_themeLight" = "#fffccc"; "sb_themeLighter" = "#fffee5"; "sb_yellow" = "#fdba00"; "sb_accent"= "#ff3d00"; "sb_neutralTertiaryAlt" = "#27251f"; "sb_neutralQuaternary" = "#27251f"; "sb_neutralQuaternaryAlt" = "#90a0b7"; "sb_neutralLight" = "#e6effd"; "sb_neutralSecondary" = "#f9fafc"; "sb_black" = "#000000"; "sb_white" = "#ffffff"; "themePrimary" = "#27251F"; } Add-SPOTheme -Name "Test Intranet" -Palette $palette -IsInverted $false Add the attached web part to a modern home page also add an OOTB button. theme-test.zip Change the site theme to Test Intranet The right side of web part will change it's colors also the Button color. Refresh the page - colors will revert on the right side but the OOTB button will remain with theme. We need to wait also for @vomos2020 developer to answer question 1 (from spfx I assume that is using it's own theme and palette).

vomos2020 commented 11 months ago

@AJIXuMuK hi, we use this in code export const theme = window.themeState?.theme; export const spTheme = { themePrimary: theme?.sb_themePrimary, themeSecondary: theme?.sb_themeSecondary, ... };

CallumCrowley commented 11 months ago

@AJIXuMuK we've also noticed this bug on multiple tenants. We've uploaded a custom theme using Add-SPOTheme but the value for neutralLighter reverts to a default SharePoint colour (#F0F0F0) after a page refresh.

AJIXuMuK commented 11 months ago

@vomos2020 @sosandumsft - unfortunately we don't support custom properties in the theme (sb_ prefixed ones in your case). I would recommend having a mapping where based on the primary color of the theme you can grab all others from your custom code.

@CallumCrowley - the issue with neutral colors has been discussed here and here

ghost commented 11 months ago

Issues that have been closed & had no follow-up activity for at least 7 days are automatically locked. Please refer to our wiki for more details, including how to remediate this action if you feel this was done prematurely or in error: Issue List: Our approach to locked issues