Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improved support for design system neutral color #16899

Merged
merged 4 commits into from
Feb 11, 2021

Conversation

bheston
Copy link
Contributor

@bheston bheston commented Feb 9, 2021

  • Added a neutralBaseColor property in the design system
  • Update neutralPalette and accentPalette when respective baseColor changes
  • Updated Card to base background color on local neutralPalette
  • Updated Card stories to illustrate use cases

Pull request checklist

  • Addresses an existing issue: Fixes #0000
  • Include a change request file using $ yarn change

Description of changes

Many use cases involve adjusting the neutral palette color, most commonly on cards or regions that have a special color. Currently this is difficult to do through properties alone, and is confusing even with code. This change makes adjusting the neutral color design system attributes easier as well as updates the Card component to adjust its background color with the neutral tint while respecting the relationship with its container.

Focus areas to test

(optional)

@codesandbox-ci
Copy link

codesandbox-ci bot commented Feb 9, 2021

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 5fe109b:

Sandbox Source
Fluent UI Button Configuration
codesandbox-react-template Configuration
codesandbox-react-northstar-template Configuration

@size-auditor
Copy link

size-auditor bot commented Feb 9, 2021

Asset size changes

Size Auditor did not detect a change in bundle size for any component!

Baseline commit: 4e3e43703b6315081f68aa8b61e73c7cc349c4aa (build)

@fabricteam
Copy link
Collaborator

fabricteam commented Feb 9, 2021

Perf Analysis

No significant results to display.

All results

Scenario Render type Master Ticks PR Ticks Iterations Status
Avatar mount 805 846 5000
BaseButton mount 915 927 5000
Breadcrumb mount 41289 41007 5000
ButtonNext mount 712 664 5000
Checkbox mount 1561 1511 5000
CheckboxBase mount 1287 1263 5000
ChoiceGroup mount 4891 4917 5000
ComboBox mount 973 940 1000
CommandBar mount 9813 9931 1000
ContextualMenu mount 6033 5984 1000
DefaultButton mount 1144 1143 5000
DetailsRow mount 3642 3587 5000
DetailsRowFast mount 3862 3601 5000
DetailsRowNoStyles mount 3429 3532 5000
Dialog mount 1458 1474 1000
DocumentCardTitle mount 1826 1840 1000
Dropdown mount 3446 3378 5000
FocusTrapZone mount 1840 1809 5000
FocusZone mount 1757 1772 5000
IconButton mount 1784 1795 5000
Label mount 320 335 5000
Layer mount 1806 1771 5000
Link mount 457 464 5000
MakeStyles mount 1852 1866 50000
MenuButton mount 1539 1530 5000
MessageBar mount 1988 2002 5000
Nav mount 3343 3312 1000
OverflowSet mount 1022 1054 5000
Panel mount 1434 1434 1000
Persona mount 905 897 1000
Pivot mount 1425 1423 1000
PrimaryButton mount 1283 1279 5000
Rating mount 7733 7762 5000
SearchBox mount 1326 1365 5000
Shimmer mount 2664 2620 5000
Slider mount 1939 1912 5000
SpinButton mount 5079 5096 5000
Spinner mount 412 398 5000
SplitButton mount 3204 3218 5000
Stack mount 498 489 5000
StackWithIntrinsicChildren mount 1596 1610 5000
StackWithTextChildren mount 4712 4707 5000
SwatchColorPicker mount 10267 11183 5000
Tabs mount 1373 1402 1000
TagPicker mount 2822 2849 5000
TeachingBubble mount 11602 11616 5000
Text mount 421 418 5000
TextField mount 1450 1422 5000
ThemeProvider mount 1421 1389 5000
ThemeProvider virtual-rerender 583 591 5000
ThemeProviderNext mount 2145 2166 5000
Toggle mount 813 809 5000
buttonNative mount 116 101 5000

Perf Analysis (Fluent)

Perf comparison
Status Scenario Fluent TPI Fabric TPI Ratio Iterations Ticks
🦄 Avatar.Fluent 0.2 0.54 0.37:1 2000 400
🦄 Button.Fluent 0.13 0.21 0.62:1 5000 638
🔧 Checkbox.Fluent 0.65 0.34 1.91:1 1000 649
🎯 Dialog.Fluent 0.17 0.23 0.74:1 5000 841
🔧 Dropdown.Fluent 3.12 0.41 7.61:1 1000 3118
🔧 Icon.Fluent 0.15 0.06 2.5:1 5000 746
🦄 Image.Fluent 0.09 0.13 0.69:1 5000 437
🔧 Slider.Fluent 1.62 0.46 3.52:1 1000 1622
🔧 Text.Fluent 0.08 0.03 2.67:1 5000 404
🦄 Tooltip.Fluent 0.12 0.89 0.13:1 5000 586

🔧 Needs work     🎯 On target     🦄 Amazing

Perf tests with no regressions
Scenario Current PR Ticks Baseline Ticks Ratio
PortalMinimalPerf.default 172 160 1.08:1
Avatar.Fluent 400 371 1.08:1
AttachmentMinimalPerf.default 203 189 1.07:1
AvatarMinimalPerf.default 228 213 1.07:1
ImageMinimalPerf.default 454 423 1.07:1
TableMinimalPerf.default 481 449 1.07:1
TooltipMinimalPerf.default 910 854 1.07:1
AnimationMinimalPerf.default 439 414 1.06:1
SegmentMinimalPerf.default 413 391 1.06:1
ListMinimalPerf.default 587 559 1.05:1
StatusMinimalPerf.default 818 778 1.05:1
BoxMinimalPerf.default 421 403 1.04:1
FormMinimalPerf.default 507 487 1.04:1
LayoutMinimalPerf.default 467 451 1.04:1
SkeletonMinimalPerf.default 411 397 1.04:1
ChatMinimalPerf.default 711 692 1.03:1
ListCommonPerf.default 740 719 1.03:1
MenuMinimalPerf.default 967 943 1.03:1
PopupMinimalPerf.default 744 719 1.03:1
Button.Fluent 638 621 1.03:1
Dialog.Fluent 841 814 1.03:1
CarouselMinimalPerf.default 555 543 1.02:1
CheckboxMinimalPerf.default 3027 2973 1.02:1
DatepickerMinimalPerf.default 49385 48199 1.02:1
GridMinimalPerf.default 387 379 1.02:1
InputMinimalPerf.default 1339 1316 1.02:1
ListWith60ListItems.default 711 699 1.02:1
LoaderMinimalPerf.default 749 736 1.02:1
MenuButtonMinimalPerf.default 1692 1664 1.02:1
ReactionMinimalPerf.default 444 436 1.02:1
TextMinimalPerf.default 415 408 1.02:1
Checkbox.Fluent 649 636 1.02:1
Icon.Fluent 746 732 1.02:1
AlertMinimalPerf.default 322 320 1.01:1
ButtonSlotsPerf.default 623 614 1.01:1
CardMinimalPerf.default 649 643 1.01:1
DialogMinimalPerf.default 849 841 1.01:1
EmbedMinimalPerf.default 4402 4352 1.01:1
FlexMinimalPerf.default 338 335 1.01:1
HeaderSlotsPerf.default 852 844 1.01:1
ListNestedPerf.default 629 625 1.01:1
RadioGroupMinimalPerf.default 501 495 1.01:1
IconMinimalPerf.default 746 735 1.01:1
TreeMinimalPerf.default 849 840 1.01:1
Dropdown.Fluent 3118 3098 1.01:1
Tooltip.Fluent 586 579 1.01:1
AttachmentSlotsPerf.default 1265 1263 1:1
DropdownMinimalPerf.default 3124 3112 1:1
ItemLayoutMinimalPerf.default 1337 1341 1:1
LabelMinimalPerf.default 468 468 1:1
SplitButtonMinimalPerf.default 3996 3984 1:1
TableManyItemsPerf.default 2229 2230 1:1
TextAreaMinimalPerf.default 561 562 1:1
CustomToolbarPrototype.default 3789 3802 1:1
ToolbarMinimalPerf.default 1049 1052 1:1
DividerMinimalPerf.default 409 413 0.99:1
HeaderMinimalPerf.default 413 417 0.99:1
ProviderMergeThemesPerf.default 1535 1548 0.99:1
ButtonOverridesMissPerf.default 1739 1773 0.98:1
ChatWithPopoverPerf.default 481 493 0.98:1
ProviderMinimalPerf.default 969 990 0.98:1
RefMinimalPerf.default 241 246 0.98:1
SliderMinimalPerf.default 1607 1635 0.98:1
VideoMinimalPerf.default 707 724 0.98:1
Text.Fluent 404 411 0.98:1
ButtonMinimalPerf.default 195 201 0.97:1
DropdownManyItemsPerf.default 792 813 0.97:1
Image.Fluent 437 450 0.97:1
Slider.Fluent 1622 1664 0.97:1
AccordionMinimalPerf.default 177 184 0.96:1
ButtonUseCssPerf.default 879 920 0.96:1
TreeWith60ListItems.default 192 199 0.96:1
ChatDuplicateMessagesPerf.default 383 403 0.95:1
RosterPerf.default 1253 1331 0.94:1
ButtonUseCssNestingPerf.default 1079 1162 0.93:1

})
public neutralBaseColor: string;
protected neutralBaseColorChanged(oldValue: string, newValue: string): void {
this.neutralPalette = createColorPalette(parseColorHexRGB(newValue));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

parseColorHexRGB can return null so you might want to null check the result prior to providing it to createColorPalette unless you want this to throw

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's our standard here? I thought parseColor was the function that threw if the format of the color is not supported, but it looks now like it just runs a regex. What would be expected behavior if someone passed this something other than a valid hex color? Seems maybe preferable to throw instead of default to grey or something.

@bheston bheston force-pushed the add-neutral-base-color branch from e8bc9a9 to f144c53 Compare February 10, 2021 18:35
Brian Heston added 4 commits February 11, 2021 10:05
- Added a neutralBaseColor property in the design system
- Update neutralPalette and accentPalette when respective baseColor changes
- Updated Card to base background color on local neutralPalette
- Updated Card stories to illustrate use cases
@bheston bheston force-pushed the add-neutral-base-color branch from 614d650 to 5fe109b Compare February 11, 2021 18:14
@chrisdholt chrisdholt merged commit c71f383 into microsoft:master Feb 11, 2021
@msft-fluent-ui-bot
Copy link
Collaborator

🎉@fluentui/web-components@v0.14.0 has been released which incorporates this pull request.:tada:

Handy links:

joshualamusga1 pushed a commit to joshualamusga1/fluentui that referenced this pull request Feb 25, 2021
* Improved support for design system neutral color
- Added a neutralBaseColor property in the design system
- Update neutralPalette and accentPalette when respective baseColor changes
- Updated Card to base background color on local neutralPalette
- Updated Card stories to illustrate use cases

* Change files

* Update api report

* Added null checking on parsed color

Co-authored-by: Brian Heston <brheston@microsoft.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants