Skip to content

Commit

Permalink
Fix contrast issues in V8 Fluent2 Dark Theme (microsoft#28486)
Browse files Browse the repository at this point in the history
* Fix up fluent-2 v8 theme contrast colors in dark mode

* Add change log

* Add all color types

* Make sure theme aligns
  • Loading branch information
Mitch-At-Work authored Jul 12, 2023
1 parent 4f56d46 commit 915acd6
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "fix: Ensure fluent2 dark theme isInverted:true, set primary fluent2darktheme button color to match light theme",
"packageName": "@fluentui/fluent2-theme",
"email": "[email protected]",
"dependentChangeType": "patch"
}
3 changes: 3 additions & 0 deletions packages/fluent2-theme/src/componentStyles/Button.styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,9 @@ export function getPrimaryButtonStyles(theme: ITheme): Partial<IButtonStyles> {
description: {
color: semanticColors.primaryButtonText,
},
descriptionHovered: {
color: semanticColors.primaryButtonText,
},
};

return styles;
Expand Down
7 changes: 7 additions & 0 deletions packages/fluent2-theme/src/fluent2WebDarkTheme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { createTheme } from '@fluentui/react';
import { IExtendedEffects, IExtendedSemanticColors } from './types';
import { fluent2ComponentStyles } from './fluent2ComponentStyles';
import { fluent2SharedColors } from './fluent2SharedColors';
import { Fluent2WebLightTheme } from './fluent2WebLightTheme';

const fluent2ForV8DarkEffects: IExtendedEffects = {
elevation4: '0px 2px 4px rgba(0, 0, 0, 0.14), 0px 0px 2px rgba(0, 0, 0, 0.12)',
Expand Down Expand Up @@ -56,6 +57,11 @@ const p = fluent2ForV8DarkPalette;
const grey36 = '#5C5C5C';

const semanticColorMappingOverridesForDark: Partial<IExtendedSemanticColors> = {
// Primary button is unique, it's background color is shared across themes
primaryButtonBackgroundHovered: Fluent2WebLightTheme.palette.themePrimary,
primaryButtonBackgroundPressed: Fluent2WebLightTheme.palette.themeDarker,
primaryButtonBackground: Fluent2WebLightTheme.palette.themeDarkAlt,

// This hex matches the v9 theme.
link: p.themeDark,

Expand Down Expand Up @@ -104,4 +110,5 @@ export const Fluent2WebDarkTheme: ITheme = createTheme({
semanticColors: semanticColorMappingOverridesForDark,
components: fluent2ComponentStyles,
effects: fluent2ForV8DarkEffects,
isInverted: true,
});

0 comments on commit 915acd6

Please sign in to comment.