Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"changes": [
{
"packageName": "@uifabric/styling",
"comment": "add new semantic slot",
"type": "minor"
}
],
"packageName": "@uifabric/styling",
"email": "phkuo@microsoft.com"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"changes": [
{
"packageName": "@uifabric/variants",
"comment": "update variants algorithm for new semantic slot",
"type": "patch"
}
],
"packageName": "@uifabric/variants",
"email": "phkuo@microsoft.com"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"changes": [
{
"packageName": "office-ui-fabric-react",
"comment": "add new semantic slot",
"type": "minor"
}
],
"packageName": "office-ui-fabric-react",
"email": "phkuo@microsoft.com"
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/* Base slots */
$bodyBackgroundColor: "[theme:bodyBackground, default: #ffffff]";
$bodyFrameBackgroundColor: "[theme:bodyFrameBackground, default: #ffffff]";
$bodyTextColor: "[theme:bodyText, default: #333333]";
$bodyTextCheckedColor: "[theme:bodyTextChecked, default: #000000]";
$bodySubtextColor: "[theme:bodySubtext, default: #666666]";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@ exports[`MarqueeSelection renders MarqueeSelection correctly 1`] = `
"blockingBackground": "rgba(234, 67, 0, .2)",
"bodyBackground": "#ffffff",
"bodyDivider": "#c8c8c8",
"bodyFrameBackground": "#ffffff",
"bodySubtext": "#666666",
"bodyText": "#333333",
"bodyTextChecked": "#000000",
Expand Down
7 changes: 7 additions & 0 deletions packages/styling/src/interfaces/ISemanticColors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,13 @@ export interface ISemanticColors {
*/
bodyBackground: string;

/**
* A special semantic slot that will always be the same or darker (not necessarily stronger) than the bodyBackground slot, even in
* an inverted theme. This is used for zones near the edge of the page, to provide a vignetting effect. This is especially effective
* with zones near the edge of the page in stronger themes or if it uses a variant theme.
*/
bodyFrameBackground: string;

/**
* The default color for text.
*/
Expand Down
4 changes: 2 additions & 2 deletions packages/styling/src/styles/theme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,10 +125,10 @@ export function createTheme(theme: IPartialTheme, depComments: boolean = false):

// Generates all the semantic slot colors based on the Fabric palette.
// We'll use these as fallbacks for semantic slots that the passed in theme did not define.
// This does NOT fix deprecated slots.
function _makeSemanticColorsFromPalette(p: IPalette, isInverted: boolean, depComments: boolean): ISemanticColors {
let toReturn: ISemanticColors = {
bodyBackground: p.white,
bodyFrameBackground: p.white,
bodyText: p.neutralPrimary,
bodyTextChecked: p.black,
bodySubtext: p.neutralSecondary,
Expand Down Expand Up @@ -185,7 +185,7 @@ function _makeSemanticColorsFromPalette(p: IPalette, isInverted: boolean, depCom
link: p.themePrimary,
linkHovered: p.themeDarker,

// Deprecated slots, fixed by _fixDeprecatedSlots() later
// Deprecated slots, second pass by _fixDeprecatedSlots() later for self-referential slots
listTextColor: '',
menuItemBackgroundChecked: p.neutralLight
};
Expand Down
6 changes: 5 additions & 1 deletion packages/variants/src/variants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ export function getNeutralVariant(theme: IPartialTheme): ITheme {
};

const partialSemantic: Partial<ISemanticColors> = {
bodyBackground: p.neutralLighter
bodyBackground: p.neutralLighter,
bodyFrameBackground: !fullTheme.isInverted ? p.neutralLight : p.neutralLighterAlt
};

return makeThemeFromPartials(theme, partialPalette, partialSemantic);
Expand Down Expand Up @@ -115,6 +116,7 @@ export function getSoftVariant(theme: IPartialTheme): ITheme {

const partialSemantic: Partial<ISemanticColors> = {
bodyBackground: p.themeLighter,
bodyFrameBackground: !fullTheme.isInverted ? p.themeLight : p.themeLighterAlt,

inputBorder: p.themeLighter,
// inputBorderHovered: p.neutralPrimary,
Expand Down Expand Up @@ -179,6 +181,8 @@ export function getStrongVariant(theme: IPartialTheme): ITheme {

const partialSemantic: Partial<ISemanticColors> = {
bodyBackground: p.themePrimary,
bodyFrameBackground: !fullTheme.isInverted ? p.themeDarkAlt : p.themeSecondary,

bodyText: p.white,
bodySubtext: p.white,

Expand Down