Skip to content
This repository was archived by the owner on Mar 4, 2020. It is now read-only.

Commit 24337ce

Browse files
authored
feat(colors): add red color scheme in Teams theme (#1353)
* -added red color scheme -added new colors in default color scheme -refactored label variables to use inverted color scheme * -added labelVariables for dark and HC themes * -added transparent colors in the color palette * -reverted the inverted added foreground and background colors in default scheme * -added typings on the invert color scheme function * -reverted changes for inverted color scheme * -updated changelog
1 parent bbace32 commit 24337ce

File tree

11 files changed

+187
-46
lines changed

11 files changed

+187
-46
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
3737
- Aligned link styles for `Chat.Message` component with latest Teams theme design @Bugaa92 ([#1269](https://github.com/stardust-ui/react/pull/1269))
3838
- Export `qna` and `yammer` SVG icons for `Teams` theme @manindr ([#1325](https://github.com/stardust-ui/react/pull/1325))
3939
- Add FontAwesome theme @layershifter ([#1337](https://github.com/stardust-ui/react/pull/1337))
40+
- Add red color scheme in Teams theme @mnajdova ([#1353](https://github.com/stardust-ui/react/pull/1353))
4041

4142
### Documentation
4243
- Clearly identify Slots in DocSite @hughreeling ([#1292](https://github.com/stardust-ui/react/pull/1292))

docs/src/views/ColorPalette.tsx

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ const ColorPalette = () => (
5959
}}
6060
>
6161
<ProviderConsumer
62-
render={({ siteVariables: { colors, emphasisColors, naturalColors } }) => (
62+
render={({ siteVariables: { colors, emphasisColors, naturalColors, transparentColors } }) => (
6363
<DocPage title="Colors">
6464
<Header as="h2">Introduction</Header>
6565
<p>
@@ -140,11 +140,14 @@ const ColorPalette = () => (
140140
<Header as="h3">All colors</Header>
141141
<p>This are all colors available in the color palette.</p>
142142
<Grid columns={2} variables={{ gridGap: '2rem' }}>
143-
{_.map({ ...emphasisColors, ...naturalColors }, (variants, color) => (
144-
<div key={color}>
145-
<ColorVariants name={color} />
146-
</div>
147-
))}
143+
{_.map(
144+
{ ...emphasisColors, ...naturalColors, ...transparentColors },
145+
(variants, color) => (
146+
<div key={color}>
147+
<ColorVariants name={color} />
148+
</div>
149+
),
150+
)}
148151
</Grid>
149152

150153
<Header as="h2" content="Color scheme" />

packages/react/src/themes/teams-dark/colors.ts

Lines changed: 45 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ export const colorScheme: ColorSchemeMapping = {
4040
default: {
4141
foreground: colors.white,
4242
foreground1: colors.grey[250],
43-
foreground3: colors.grey[300],
44-
foreground4: colors.white,
43+
foreground2: colors.grey[300],
44+
foreground3: colors.white,
4545

4646
background: colors.grey[650],
4747
background1: colors.grey[700],
@@ -241,23 +241,51 @@ export const colorScheme: ColorSchemeMapping = {
241241
shadowDisabled: colors.white,
242242
},
243243
grey: createColorScheme('grey', { foreground: colors.grey[250] }),
244-
green: createColorScheme('green'),
245-
orange: createColorScheme('orange', {
246-
background: colors.black,
247-
foregroundHover: colors.black,
248-
foregroundActive: colors.black,
249-
foregroundFocus: colors.black,
250-
foregroundFocusWithin: colors.black,
251-
foregroundDisabled: colors.black,
244+
green: createColorScheme('green', {
245+
background: colors.white,
252246
}),
247+
orange: createColorScheme('orange'),
253248
pink: createColorScheme('pink'),
254-
red: createColorScheme('red'),
249+
red: {
250+
foreground: colors.red[200],
251+
foreground1: colors.white,
252+
foreground2: colors.grey[800],
253+
254+
background: colors.red[300],
255+
background1: colors.red[800],
256+
background2: colors.ruby[500],
257+
background3: colors.red[400],
258+
259+
border: colors.red[900],
260+
261+
shadow: undefined,
262+
263+
foregroundHover: colors.white,
264+
backgroundHover: colors.ruby[600],
265+
borderHover: undefined,
266+
shadowHover: undefined,
267+
268+
foregroundActive: undefined,
269+
backgroundActive: undefined,
270+
borderActive: undefined,
271+
shadowActive: undefined,
272+
273+
foregroundFocus: undefined,
274+
backgroundFocus: undefined,
275+
borderFocus: undefined,
276+
shadowFocus: undefined,
277+
278+
foregroundPressed: colors.white,
279+
backgroundPressed: colors.ruby[600],
280+
borderPressed: undefined,
281+
shadowPressed: undefined,
282+
283+
foregroundDisabled: undefined,
284+
backgroundDisabled: undefined,
285+
borderDisabled: undefined,
286+
shadowDisabled: undefined,
287+
},
255288
yellow: createColorScheme('yellow', {
256-
background: colors.black,
257-
foregroundHover: colors.black,
258-
foregroundActive: colors.black,
259-
foregroundFocus: colors.black,
260-
foregroundFocusWithin: colors.black,
261-
foregroundDisabled: colors.black,
289+
background: colors.yellow[100],
262290
}),
263291
}

packages/react/src/themes/teams-dark/componentVariables.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,5 @@ export { default as Reaction } from './components/Reaction/reactionVariables'
1717
export { default as Alert } from './components/Alert/alertVariables'
1818
export { default as ProviderBox } from './components/Provider/providerBoxVariables'
1919
export { default as Dropdown } from './components/Dropdown/dropdownVariables'
20-
20+
export { default as Label } from './components/Label/labelVariables'
2121
export { default as PopupContent } from './components/Popup/popupContentVariables'
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import { SiteVariablesPrepared } from '../../../types'
2+
import { LabelVariables } from '../../../teams/components/Label/labelVariables'
3+
import { extendColorScheme } from '../../../colorUtils'
4+
5+
export default (siteVars: SiteVariablesPrepared): Partial<LabelVariables> => {
6+
return {
7+
colorScheme: extendColorScheme(siteVars.colorScheme, {
8+
brand: {
9+
background: siteVars.colorScheme.brand.foreground4,
10+
},
11+
red: {
12+
background: siteVars.colorScheme.red.foreground1,
13+
},
14+
}),
15+
}
16+
}

packages/react/src/themes/teams-high-contrast/colors.ts

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,44 @@ export const colorScheme: ColorSchemeMapping = {
189189
green: createColorScheme(),
190190
orange: createColorScheme(),
191191
pink: createColorScheme(),
192-
red: createColorScheme(),
192+
red: {
193+
foreground: colors.white,
194+
foreground1: colors.black,
195+
foreground2: colors.black,
196+
197+
background: colors.white,
198+
background1: colors.white,
199+
background2: colors.black,
200+
background3: colors.white,
201+
202+
border: colors.white,
203+
204+
shadow: undefined,
205+
206+
foregroundHover: colors.black,
207+
backgroundHover: accessibleYellow,
208+
borderHover: undefined,
209+
shadowHover: undefined,
210+
211+
foregroundActive: undefined,
212+
backgroundActive: undefined,
213+
borderActive: undefined,
214+
shadowActive: undefined,
215+
216+
foregroundFocus: undefined,
217+
backgroundFocus: undefined,
218+
borderFocus: undefined,
219+
shadowFocus: undefined,
220+
221+
foregroundPressed: colors.black,
222+
backgroundPressed: accessibleYellow,
223+
borderPressed: undefined,
224+
shadowPressed: undefined,
225+
226+
foregroundDisabled: undefined,
227+
backgroundDisabled: undefined,
228+
borderDisabled: undefined,
229+
shadowDisabled: undefined,
230+
},
193231
yellow: createColorScheme(),
194232
}

packages/react/src/themes/teams-high-contrast/componentVariables.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,4 @@ export { default as Reaction } from './components/Reaction/reactionVariables'
1717
export { default as Alert } from './components/Alert/alertVariables'
1818
export { default as ProviderBox } from './components/Provider/providerBoxVariables'
1919
export { default as Dropdown } from './components/Dropdown/dropdownVariables'
20+
export { default as Label } from './components/Label/labelVariables'
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import { SiteVariablesPrepared } from '../../../types'
2+
import { LabelVariables } from '../../../teams/components/Label/labelVariables'
3+
import { extendColorScheme } from '../../../colorUtils'
4+
5+
export default (siteVars: SiteVariablesPrepared): Partial<LabelVariables> => {
6+
return {
7+
colorScheme: extendColorScheme(siteVars.colorScheme, {
8+
brand: {
9+
background: siteVars.colorScheme.brand.foreground4,
10+
},
11+
red: {
12+
background: siteVars.colorScheme.red.foreground1,
13+
},
14+
}),
15+
}
16+
}

packages/react/src/themes/teams/colors.ts

Lines changed: 46 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -205,15 +205,6 @@ const createColorScheme = (color: string, customValues = {}) => {
205205
}
206206
}
207207

208-
const lightColorOverrides = {
209-
background: colors.black,
210-
foregroundHover: colors.black,
211-
foregroundActive: colors.black,
212-
foregroundFocus: colors.black,
213-
foregroundFocusWithin: colors.black,
214-
foregroundDisabled: colors.black,
215-
}
216-
217208
export const colorScheme: ColorSchemeMapping = {
218209
default: {
219210
foreground: colors.grey[750],
@@ -418,11 +409,53 @@ export const colorScheme: ColorSchemeMapping = {
418409
shadowDisabled: colors.white,
419410
},
420411
grey: createColorScheme('grey'),
421-
green: createColorScheme('green'),
422-
orange: createColorScheme('orange', lightColorOverrides),
412+
green: createColorScheme('green', {
413+
background: colors.white,
414+
}),
415+
orange: createColorScheme('orange'),
423416
pink: createColorScheme('pink'),
424-
red: createColorScheme('red'),
425-
yellow: createColorScheme('yellow', lightColorOverrides),
417+
red: {
418+
foreground: colors.red[400],
419+
foreground1: colors.white,
420+
foreground2: colors.white,
421+
422+
background: colors.red[400],
423+
background1: colors.red[50],
424+
background2: colors.ruby[500],
425+
background3: colors.red[400],
426+
427+
border: colors.red[100],
428+
429+
shadow: undefined,
430+
431+
foregroundHover: colors.white,
432+
backgroundHover: colors.ruby[600],
433+
borderHover: undefined,
434+
shadowHover: undefined,
435+
436+
foregroundActive: undefined,
437+
backgroundActive: undefined,
438+
borderActive: undefined,
439+
shadowActive: undefined,
440+
441+
foregroundFocus: undefined,
442+
backgroundFocus: undefined,
443+
borderFocus: undefined,
444+
shadowFocus: undefined,
445+
446+
foregroundPressed: colors.white,
447+
backgroundPressed: colors.ruby[600],
448+
borderPressed: undefined,
449+
shadowPressed: undefined,
450+
451+
foregroundDisabled: undefined,
452+
backgroundDisabled: undefined,
453+
borderDisabled: undefined,
454+
shadowDisabled: undefined,
455+
},
456+
yellow: createColorScheme('yellow', {
457+
background: colors.yellow[100],
458+
}),
426459
}
427460

428461
export const availableColors = [

packages/react/src/themes/teams/components/Label/labelVariables.ts

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,29 +9,27 @@ export interface LabelVariables {
99
startPaddingLeft: string
1010
endPaddingRight: string
1111
height: string
12-
iconColor: string
1312
}
1413

1514
export default (siteVars: SiteVariablesPrepared): LabelVariables => {
16-
const color = 'rgba(0, 0, 0, 0.6)'
17-
1815
return {
1916
colorScheme: extendColorScheme(siteVars.colorScheme, {
17+
// TODO use here some color scheme values, after the designs are delivered
2018
default: {
21-
background: color,
19+
background: 'rgba(0, 0, 0, 0.6)',
2220
foreground: 'rgb(232, 232, 232)',
2321
},
2422
brand: {
2523
background: siteVars.colorScheme.brand.foreground4,
2624
},
25+
red: {
26+
background: siteVars.colorScheme.red.foreground1,
27+
},
2728
}),
2829
circularRadius: pxToRem(9999),
2930
padding: `0 ${pxToRem(4)} 0 ${pxToRem(4)}`,
3031
startPaddingLeft: '0px',
3132
endPaddingRight: '0px',
3233
height: pxToRem(20),
33-
34-
// variables for 'icon' part
35-
iconColor: color,
3634
}
3735
}

0 commit comments

Comments
 (0)