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

feat: add color recipes to web component packages #16755

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
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,4 @@ change

# package specific files
packages/web-components/**/*.spec.ts
packages/web-components/src/default-palette.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"type": "minor",
"comment": "feat: move color recipes into fluent web component package",
"packageName": "@fluentui/web-components",
"email": "chhol@microsoft.com",
"dependentChangeType": "patch",
"date": "2021-02-02T19:55:41.615Z"
}
1 change: 1 addition & 0 deletions packages/web-components/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ module.exports = {
'@typescript-eslint/no-use-before-define': 'off',
'@typescript-eslint/typedef': 'off',
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/no-non-null-assertion': 'off',
'@typescript-eslint/interface-name-prefix': 'off',
},
Expand Down
29 changes: 29 additions & 0 deletions packages/web-components/build/generate-default-palettes.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import fs from 'fs';
import path from 'path';
import { parseColorHexRGB } from '@microsoft/fast-colors';
import { createColorPalette } from '../src/color/create-color-palette';
import { accentBaseColor, neutralBaseColor } from '../src/color/color-constants';

const outpath = path.resolve(__dirname, '../src/default-palette.ts');

/**
* Define palettes from base colors
*/
const neutralPalette = createColorPalette(parseColorHexRGB(neutralBaseColor));
const accentPalette = createColorPalette(parseColorHexRGB(accentBaseColor));

const file = `/**
* DO NOT EDIT THIS FILE DIRECTLY
* This file generated by web-components/build/${path.parse(__filename).name}${path.parse(__filename).ext}
*/
export const neutralPalette: string[] = ${JSON.stringify(neutralPalette, null, 4)};
export const accentPalette: string[] = ${JSON.stringify(accentPalette, null, 4)};
`;

fs.writeFile(outpath, file, error => {
if (error) {
throw error;
} else {
console.log('\nPalette data written to', outpath, '\n');
}
});
31 changes: 0 additions & 31 deletions packages/web-components/color.ts

This file was deleted.

Loading