1 | import { mergeStyles } from '@uifabric/merge-styles';
|
2 | import { DefaultPalette } from '../styles/DefaultPalette';
|
3 | import { getTheme } from '../styles/index';
|
4 | export var ColorClassNames = {};
|
5 | for (var colorName in DefaultPalette) {
|
6 | if (DefaultPalette.hasOwnProperty(colorName)) {
|
7 |
|
8 | _defineGetter(ColorClassNames, colorName, '', false, 'color');
|
9 |
|
10 | _defineGetter(ColorClassNames, colorName, 'Hover', true, 'color');
|
11 |
|
12 | _defineGetter(ColorClassNames, colorName, 'Background', false, 'background');
|
13 |
|
14 | _defineGetter(ColorClassNames, colorName, 'BackgroundHover', true, 'background');
|
15 |
|
16 | _defineGetter(ColorClassNames, colorName, 'Border', false, 'borderColor');
|
17 |
|
18 | _defineGetter(ColorClassNames, colorName, 'BorderHover', true, 'borderColor');
|
19 | }
|
20 | }
|
21 |
|
22 |
|
23 |
|
24 | function _defineGetter(obj, colorName, suffix, isHover, cssProperty) {
|
25 | Object.defineProperty(obj, colorName + suffix, {
|
26 | get: function () {
|
27 | var _a;
|
28 |
|
29 | var style = (_a = {}, _a[cssProperty] = getTheme().palette[colorName], _a);
|
30 | return mergeStyles(isHover ? { selectors: { ':hover': style } } : style).toString();
|
31 | },
|
32 | enumerable: true,
|
33 | configurable: true,
|
34 | });
|
35 | }
|
36 |
|
\ | No newline at end of file |