Class ThemeGenerator
Sets an IThemeSlotRule to the given color and cascades it to the rest of the theme, updating other IThemeSlotRules in the theme that inherit from that color. isInverted: whether it's a dark theme or not, which affects the algorithm used to generate shades isCustomization should be true only if it's a user action, and indicates overwriting the slot's inheritance(if any) overwriteCustomColor: a slot could have a generated color based on its inheritance rules(isCustomized is false), or a custom color based on user input(isCustomized is true), this bool tells us whether to override existing customized colors
Inheritance
Namespace: PnP.Framework.Utilities.Themes.Generator
Assembly: PnP.Framework.dll
Syntax
public static class ThemeGenerator : object
Methods
GetThemeAsJson(IThemeRules)
Gets the JSON-formatted blob that describes the theme, usable with the REST request endpoints { [theme slot name as string] : [color as string], "tokenName": "#f00f00", "tokenName2": "#ba2ba2", ... }
Declaration
public static string GetThemeAsJson(IThemeRules slotRules)
Parameters
ITheme
|
Returns
System.
|
InsureSlots(IThemeRules, Boolean)
Sets the color of each slot based on its rule. Slots that don't inherit must have a color already. If this completes without error, then the theme is ready to use. (All slots will have a color.) setSlot() can be called before this, but this must be called before getThemeAs*(). Does not override colors of rules where isCustomized is true (i.e. doesn't override existing customizations).
Declaration
public static void InsureSlots(IThemeRules slotRules, Boolean isInverted)
Parameters
ITheme
|
Boolean
isInverted
|
SetSlot(IThemeSlotRule, IColor, Boolean, Boolean, Boolean)
Declaration
public static void SetSlot(IThemeSlotRule rule, IColor color, Boolean isInverted = null, Boolean isCustomization = null, Boolean overwriteCustomColor = null)
Parameters
ITheme
|
IColor
color
|
Boolean
isInverted
|
Boolean
isCustomization
|
Boolean
overwriteCustomColor
|