Skip to content

Commit

Permalink
[web-components] add attr for changing accent base color on design sy…
Browse files Browse the repository at this point in the history
…stem provider (#18922)

* add attribute to recreate the accentPalette via DSP

* Change files
  • Loading branch information
chrisdholt authored Jul 13, 2021
1 parent a84e635 commit 3d08290
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "minor",
"comment": "add attribute to recreate the accent palette using design system provider",
"packageName": "@fluentui/web-components",
"email": "chhol@microsoft.com",
"dependentChangeType": "patch"
}
1 change: 1 addition & 0 deletions packages/web-components/docs/api-report.md
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,7 @@ export const density: CSSDesignToken<number>;
// @public
export class DesignSystemProvider extends FoundationElement {
constructor();
accentBaseColor: Swatch;
accentFillActiveDelta: number;
accentFillFocusDelta: number;
accentFillHoverDelta: number;
Expand Down
22 changes: 22 additions & 0 deletions packages/web-components/src/design-system-provider/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,28 @@ export class DesignSystemProvider extends FoundationElement {
@designToken(fillColor)
public fillColor: Swatch;

/**
* A convenience to recreate the accentPalette
* @remarks
* HTML attribute: accent-base-color
*/
@attr({
attribute: 'accent-base-color',
converter: swatchConverter,
})
public accentBaseColor: Swatch;

/**
* @internal
*/
private accentBaseColorChanged(prev: Swatch, next: Swatch): void {
if (next !== undefined && next !== null) {
accentPalette.setValueFor(this, PaletteRGB.create(next as SwatchRGB));
} else {
accentPalette.deleteValueFor(this);
}
}

/**
* A convenience to recreate the neutralPalette
* @remarks
Expand Down

0 comments on commit 3d08290

Please sign in to comment.