Skip to content
This repository was archived by the owner on Jun 5, 2019. It is now read-only.

Commit cd9e78e

Browse files
authored
Merge pull request #44 from skellock/window-styling
Updates the window styling & color variables.
2 parents 3fd95eb + 4553363 commit cd9e78e

File tree

11 files changed

+101
-105
lines changed

11 files changed

+101
-105
lines changed

src/main/main-window/main-window.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,11 @@ export function createMainWindow(appPath: string) {
2929
y: windowState.y,
3030
show: false,
3131
useContentSize: true,
32-
titleBarStyle: 'hidden',
32+
titleBarStyle: 'hidden-inset',
3333
autoHideMenuBar: true,
34-
backgroundColor: '#fff',
34+
// backgroundColor: '#fff',
35+
vibrancy: 'light',
36+
transparent: true,
3537
title: app.getName(),
3638
webPreferences: {
3739
backgroundThrottling: false,

src/renderer/features/app/app.tsx

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,24 @@
11
import * as React from 'react'
22
import { WelcomeScreen } from '..'
3-
import { styles, cssProps, colors } from '../../platform'
4-
import { css, compose } from 'glamor'
3+
import { styles, colors } from '../../platform'
4+
import { compose } from 'glamor'
55

6-
const ROOT = compose(
7-
styles.fullScreen,
8-
cssProps({
9-
backgroundColor: colors.background,
10-
}),
11-
)
6+
const ROOT = compose(styles.fullScreen, {
7+
background: colors.window.background,
8+
borderRadius: 0,
9+
'& ::-webkit-scrollbar': {
10+
backgroundColor: colors.scrollbar.base,
11+
width: 12,
12+
height: 12,
13+
},
14+
'& ::-webkit-scrollbar-track': { backgroundColor: colors.scrollbar.track },
15+
'& ::-webkit-scrollbar-thumb': { backgroundColor: colors.scrollbar.thumb, borderRadius: 4 },
16+
})
1217

1318
export class App extends React.Component<{}, {}> {
1419
render() {
1520
return (
16-
<div {...css(ROOT)}>
21+
<div {...ROOT}>
1722
<WelcomeScreen />
1823
</div>
1924
)

src/renderer/features/example-using-tabs/header/header.tsx

Lines changed: 0 additions & 30 deletions
This file was deleted.

src/renderer/features/example-using-tabs/header/index.ts

Lines changed: 0 additions & 1 deletion
This file was deleted.

src/renderer/features/example-using-tabs/welcome-screen/sample-tabs.tsx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import {
1010
commandOrControlKey,
1111
EnterAnimation,
1212
} from '../../../platform'
13-
import { css, compose } from 'glamor'
13+
import { css } from 'glamor'
1414

1515
export type SampleTabType = 'one' | 'two' | 'three'
1616

@@ -24,20 +24,20 @@ const KEY_2 = `${commandOrControlKey}+2`
2424
const KEY_3 = `${commandOrControlKey}+3`
2525

2626
// an extra layer just for the drag style due to electron bug
27-
const ROOT = styles.windowDrag
27+
const ROOT = css(styles.windowDrag)
2828

29-
const BAR = compose(
29+
const BAR = css(
3030
styles.row,
31+
styles.windowDrag,
3132
cssProps({
3233
paddingLeft: spacing.medium,
3334
paddingRight: spacing.medium,
3435
paddingTop: spacing.small,
35-
backgroundColor: colors.navBackground,
36+
backgroundColor: colors.nav.background,
3637
justifyContent: 'center',
3738
borderBottom: 1,
38-
borderBottomColor: colors.line,
39+
borderBottomColor: colors.nav.line,
3940
borderBottomStyle: 'solid',
40-
boxShadow: `0px 2px 10px ${colors.navBackground}`,
4141
}),
4242
)
4343

@@ -62,7 +62,7 @@ export class SampleTabs extends React.PureComponent<SampleTabsProps, {}> {
6262
const { tab } = this.props
6363

6464
return (
65-
<div {...css(ROOT)}>
65+
<div {...ROOT}>
6666
<EnterAnimation animation='slide' delay={100} y={-60}>
6767
<div {...BAR}>
6868
<Tab onClick={this.changeTab1} active={tab === 'one'} text='doggo' />

src/renderer/platform/components/tab/tab.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@ const BASE = compose(
2222
)
2323

2424
const ACTIVE = cssProps({
25-
borderBottom: colors.line,
25+
borderBottom: colors.nav.line,
2626
borderBottomWidth: 2,
2727
borderBottomStyle: 'solid',
2828
})
2929

30-
const BASE_TEXT = cssProps({ color: colors.navInactive, fontSize: fontSizes.mediumPlus })
31-
const ACTIVE_TEXT = cssProps({ color: colors.navActive })
30+
const BASE_TEXT = cssProps({ color: colors.nav.inactive, fontSize: fontSizes.mediumPlus })
31+
const ACTIVE_TEXT = cssProps({ color: colors.nav.active })
3232

3333
/**
3434
* A tab component that you click on. Not the tab panel.

src/renderer/platform/components/text/text.test.js.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@ Generated by [AVA](https://ava.li).
99
> Snapshot 1
1010
1111
<p
12-
"data-css-f6nk39"=""
12+
"data-css-6bregx"=""
1313
/>
1414

1515
## children have priority over text
1616

1717
> Snapshot 1
1818
1919
<p
20-
"data-css-f6nk39"=""
20+
"data-css-6bregx"=""
2121
>
2222
one
2323
</p>
@@ -27,7 +27,7 @@ Generated by [AVA](https://ava.li).
2727
> Snapshot 1
2828
2929
<p
30-
"data-css-f6nk39"=""
30+
"data-css-6bregx"=""
3131
>
3232
hi
3333
</p>
@@ -37,7 +37,7 @@ Generated by [AVA](https://ava.li).
3737
> Snapshot 1
3838
3939
<p
40-
"data-css-f6nk39"=""
40+
"data-css-6bregx"=""
4141
>
4242
hello
4343
</p>
@@ -47,7 +47,7 @@ Generated by [AVA](https://ava.li).
4747
> Snapshot 1
4848
4949
<p
50-
"data-css-19csgvw"=""
50+
"data-css-rouig7"=""
5151
>
5252
one
5353
</p>
Binary file not shown.

src/renderer/platform/theme/colors.ts

Lines changed: 63 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,71 @@
1-
/**
2-
* Named colours.
3-
*/
4-
const palette = {
5-
bluez: ['#2B3A45', '#56748A', '#9CD4FC', '#D2EBFD', '#EDF7FE'],
6-
beige: ['#383330', '#585350', '#a8a3a0', '#d8d3d0', '#f8f3f0'],
7-
mint: ['#385350', '#587370', '#a8c3c0', '#d8e3e0', '#f8ffff'],
8-
purps: ['#503853', '#705873', '#c0a8c3', '#e0d8e3', '#fff8ff'],
9-
grayscale: ['#1d1d1d', '#2d2d2d', '#333', '#666', '#888', '#aaa', '#ddd', '#e6e6e6', '#f0f0f0'],
10-
cherry: '#d44',
1+
// =--- theme colors ------>
2+
3+
// const mintScale = ['#385350', '#587370', '#A8C3C0', '#D8E3E0', '#F8FFFF']
4+
// const purpleScale = ['#503853', '#705873', '#C0A8C3', '#E0D8E3', '#FFF8FF']
5+
const blueScale = ['#2B3A45', '#56748A', '#9CD4FC', '#D2EBFD', '#EDF7FE']
6+
const beigeScale = ['#383330', '#585350', '#A8A3A0', '#D8D3D0', '#F8F3F0']
7+
8+
// choose a primaries (frequent use) & secondaries (rare use)
9+
const primaryScale = beigeScale
10+
const secondaryScale = blueScale
11+
12+
// a healthy selection of grays
13+
const grayScale = [
14+
'#1D1D1D',
15+
'#2D2D2D',
16+
'#333',
17+
'#666',
18+
'#888',
19+
'#AAA',
20+
'#DDD',
21+
'#E6E6E6',
22+
'#F0F0F0',
23+
]
24+
25+
// black is 1st, white is last
26+
const black = grayScale[0]
27+
const white = grayScale[grayScale.length - 1]
28+
29+
// =--- colors with specific meaning ------>
30+
31+
const sentiment = {
32+
error: '#D44',
33+
success: '#4D4',
34+
warning: '#DD4',
1135
}
1236

13-
/**
14-
* The dominant color scale.
15-
*/
16-
const dominant = palette.beige
37+
// =--- special-use window chrome ------>
38+
39+
const window = { background: 'transparent' }
40+
const scrollbar = {
41+
base: 'transparent',
42+
track: 'rgba(0, 0, 0, 0.04)',
43+
thumb: 'rgba(0, 0, 0, 0.1)',
44+
}
45+
46+
// =--- special-use window chrome ------>
47+
48+
const text = grayScale[0]
49+
const line = primaryScale[1]
50+
const nav = {
51+
line,
52+
background: primaryScale[2],
53+
inactive: primaryScale[3],
54+
active: primaryScale[1],
55+
}
1756

1857
/**
1958
* These are the various roles that colour plays in the system.
2059
*/
2160
export const colors = {
22-
/**
23-
* The color palette if you need it, but prefer to use the other
24-
* roles since it is easier to make sweeping chanegs.
25-
*/
26-
palette,
27-
28-
/**
29-
* The default dackground color.
30-
*/
31-
background: dominant[4],
32-
33-
/**
34-
* The background color navigation.
35-
*/
36-
navBackground: dominant[2],
37-
/** the line color of the nav */
38-
navLine: dominant[1],
39-
/** Navigation foreground when it isn't active. */
40-
navInactive: dominant[3],
41-
/** Navigation foreground when active. */
42-
navActive: dominant[1],
43-
44-
/** Normal reading text. */
45-
text: palette.grayscale[2],
46-
47-
/** When something goes wrong. */
48-
error: palette.cherry,
49-
50-
/** Subtle lines like dividers. */
51-
line: dominant[1],
61+
primaryScale,
62+
secondaryScale,
63+
black,
64+
white,
65+
window,
66+
scrollbar,
67+
nav,
68+
line,
69+
text,
70+
sentiment,
5271
}
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
export const fontSizes = {
2-
small: 12,
3-
medium: 15,
4-
mediumPlus: 18,
2+
small: 11,
3+
medium: 13,
4+
mediumPlus: 14,
55
}

0 commit comments

Comments
 (0)