Skip to content

Commit 9afefeb

Browse files
committed
feat: migrate to primer design tokens
Signed-off-by: Adam Setch <[email protected]>
1 parent 5000c7a commit 9afefeb

File tree

7 files changed

+36
-17
lines changed

7 files changed

+36
-17
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@
140140
"@discordapp/twemoji": "15.1.0",
141141
"@electron/notarize": "2.5.0",
142142
"@primer/octicons-react": "19.14.0",
143+
"@primer/primitives": "^10.3.4",
143144
"@primer/react": "36.27.0",
144145
"@testing-library/react": "16.2.0",
145146
"@types/jest": "29.5.14",

pnpm-lock.yaml

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/renderer/App.css

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
1+
/** GitHub Primer Design System */
2+
/* Size & Typography */
3+
@import "@primer/primitives/dist/css/base/size/size.css";
4+
@import "@primer/primitives/dist/css/base/typography/typography.css";
5+
@import "@primer/primitives/dist/css/functional/size/border.css";
6+
@import "@primer/primitives/dist/css/functional/size/breakpoints.css";
7+
@import "@primer/primitives/dist/css/functional/size/size.css";
8+
@import "@primer/primitives/dist/css/functional/size/viewport.css";
9+
@import "@primer/primitives/dist/css/functional/typography/typography.css";
10+
11+
/* Themes and Colors */
12+
@import "@primer/primitives/dist/css/functional/themes/light.css";
13+
@import "@primer/primitives/dist/css/functional/themes/dark.css";
14+
@import "@primer/primitives/dist/css/functional/themes/dark-dimmed.css";
15+
116
html,
217
body,
318
#root {

src/renderer/App.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ function RequireAuth({ children }) {
3535

3636
export const App = () => {
3737
return (
38-
<ThemeProvider>
38+
// TODO - Add support for setting color modes (dark_dimmed)
39+
<ThemeProvider dayScheme="light" nightScheme="dark">
3940
<BaseStyles>
4041
<AppProvider>
4142
<Router>

src/renderer/utils/theme.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ describe('renderer/utils/theme.ts', () => {
4141
});
4242

4343
it('should get color mode from theme', () => {
44-
expect(getColorModeFromTheme(Theme.LIGHT)).toBe('light');
44+
expect(getColorModeFromTheme(Theme.LIGHT)).toBe('day');
4545
expect(getColorModeFromTheme(Theme.DARK)).toBe('night');
4646
expect(getColorModeFromTheme(Theme.SYSTEM)).toBe('auto');
4747
});

src/renderer/utils/theme.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ export function setTheme(theme?: Theme) {
4949
export function getColorModeFromTheme(theme: Theme): ColorModeWithAuto {
5050
switch (theme) {
5151
case Theme.LIGHT:
52-
return 'light';
52+
return 'day';
5353
case Theme.DARK:
5454
return 'night';
5555
default:

tailwind.config.ts

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,22 +10,17 @@ const config: Config = {
1010
xxs: '0.625rem', // 10px
1111
},
1212
colors: {
13-
/**
14-
* Temporary solution until we migrate to using GitHub Primer Design Tokens Directly.
15-
*
16-
* See https://primer.style/foundations/primitives/color
17-
*/
1813
primer: {
19-
attention: '#9a6700',
20-
closed: '#cf222e',
21-
done: '#8250df',
22-
muted: '#59636e',
23-
open: '#1f883d',
14+
attention: 'var(--fgColor-attention)',
15+
closed: 'var(--fgColor-closed)',
16+
done: 'var(--fgColor-done)',
17+
muted: 'var(--fgColor-muted)',
18+
open: 'var(--fgColor-open)',
2419
},
2520
gitify: {
2621
background: 'var(--gitify-background)',
2722
font: 'var(--gitify-font)',
28-
error: colors.red[500],
23+
error: 'var(--fgColor-danger)',
2924
sidebar: '#24292e',
3025
footer: 'var(--gitify-footer)',
3126
accounts: {
@@ -39,12 +34,11 @@ const config: Config = {
3934
hover: 'var(--gitify-notifications-hover)',
4035
},
4136
tooltip: {
42-
icon: colors.blue[500],
37+
icon: 'var(--fgColor-accent)',
4338
popout: 'var(--gitify-tooltip-popout)',
4439
},
45-
link: colors.blue[500],
40+
link: 'var(--fgColor-link)',
4641
caution: colors.orange[600],
47-
settings: colors.blue[600],
4842
pill: {
4943
rest: 'var(--gitify-pill-rest)',
5044
hover: 'var(--gitify-pill-hover)',

0 commit comments

Comments
 (0)