Skip to content

Commit

Permalink
feat(theme): add a low resolution version of the theme
Browse files Browse the repository at this point in the history
  • Loading branch information
whilelucky committed Feb 1, 2018
1 parent 88d1f0f commit af725b8
Show file tree
Hide file tree
Showing 4 changed files with 152 additions and 96 deletions.
1 change: 1 addition & 0 deletions src/theme/index.js
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
export default from './theme';
export lowResolutionTheme from './lowResolutionTheme';
export injectBaseStyles from './injectBaseStyles';
2 changes: 1 addition & 1 deletion src/theme/injectBaseStyles.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default (theme) => injectGlobal`
}
body {
background: ${theme.color.greyLight};
background: ${theme.color.greyLighter};
color: ${theme.color.greyDarker};
font-size: ${theme.fontSize.s};
font-weight: ${theme.fontWeight.normal};
Expand Down
70 changes: 70 additions & 0 deletions src/theme/lowResolutionTheme.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
import theme from './theme';

const lowResolutionTheme = {};

lowResolutionTheme.borderRadius = theme.borderRadius;

lowResolutionTheme.boxShadow = theme.boxShadow;

lowResolutionTheme.color = {};
lowResolutionTheme.color.greenLighter = '#e6f7ed';
lowResolutionTheme.color.greenLight = '#78bb91';
lowResolutionTheme.color.green = '#088337';
lowResolutionTheme.color.greenDark = '#06682c';
lowResolutionTheme.color.blueLighter = '#e0e3fb';
lowResolutionTheme.color.blueLight = '#949ef1';
lowResolutionTheme.color.blue = '#5768e9';
lowResolutionTheme.color.blueDark = '#4553ba';
lowResolutionTheme.color.indigoLighter = '#d7d9e3';
lowResolutionTheme.color.indigoLight = '#757a9e';
lowResolutionTheme.color.indigo = '#272f67';
lowResolutionTheme.color.indigoDark = '#1b2552';
lowResolutionTheme.color.yellowLighter = '#fcf0cd';
lowResolutionTheme.color.yellowLight = '#f8e799';
lowResolutionTheme.color.yellow = '#edc200';
lowResolutionTheme.color.yellowDark = '#9c6f19';
lowResolutionTheme.color.redLighter = '#fbeae5';
lowResolutionTheme.color.redLight = '#fdac9a';
lowResolutionTheme.color.red = '#ed6347';
lowResolutionTheme.color.redDark = '#bf0711';
lowResolutionTheme.color.lagoonLighter = '#e5f1f3';
lowResolutionTheme.color.lagoonLight = '#66afb8';
lowResolutionTheme.color.lagoon = '#007989';
lowResolutionTheme.color.lagoonDark = '#004c56';
lowResolutionTheme.color.tealLighter = '#eaf3f1';
lowResolutionTheme.color.tealLight = '#a1d5ca';
lowResolutionTheme.color.teal = '#44ac95';
lowResolutionTheme.color.tealDark = '#267f6b';
lowResolutionTheme.color.chillLighter = '#f2f8f7';
lowResolutionTheme.color.chillLight = '#d4e8e4';
lowResolutionTheme.color.chill = '#bcdcd6';
lowResolutionTheme.color.chillDark = '#9ab5b0';
lowResolutionTheme.color.white = '#ffffff';
lowResolutionTheme.color.greyLighter = '#d9d9d9';
lowResolutionTheme.color.greyLight = '#aeaeae';
lowResolutionTheme.color.grey = '#9b9b9b';
lowResolutionTheme.color.greyDark = '#616161';
lowResolutionTheme.color.greyDarker = '#3a3a3a';
lowResolutionTheme.color.black = '#000000';
lowResolutionTheme.color.translucent = 'rgba(0, 0, 0, 0.1)';
lowResolutionTheme.color.transparent = 'rgba(0, 0, 0, 0)';
lowResolutionTheme.color.primaryLighter = lowResolutionTheme.color.greenLighter;
lowResolutionTheme.color.primaryLight = lowResolutionTheme.color.greenLight;
lowResolutionTheme.color.primary = lowResolutionTheme.color.green;
lowResolutionTheme.color.primaryDark = lowResolutionTheme.color.greenDark;
lowResolutionTheme.color.accentLighter = lowResolutionTheme.color.white;
lowResolutionTheme.color.accentLight = lowResolutionTheme.color.white;
lowResolutionTheme.color.accent = lowResolutionTheme.color.white;
lowResolutionTheme.color.accentDark = lowResolutionTheme.color.white;

lowResolutionTheme.fontFamily = theme.fontFamily;

lowResolutionTheme.fontSize = theme.fontSize;

lowResolutionTheme.fontWeight = theme.fontWeight;

lowResolutionTheme.pxScale = theme.pxScale;

lowResolutionTheme.px = theme.px;

export default lowResolutionTheme;
175 changes: 80 additions & 95 deletions src/theme/theme.js
Original file line number Diff line number Diff line change
@@ -1,105 +1,90 @@
const theme = {
borderRadius: '2px',

boxShadow: [
'none',
'0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(114, 113, 113, 0.08)',
'0 3px 6px 0 rgba(0, 0, 0, 0.12), 0 3px 6px 0 rgba(174, 174, 174, 0.16)',
'0 10px 20px 0 rgba(0, 0, 0, 0.12), 0 6px 6px 0 rgba(0, 0, 0, 0.16)',
'0 14px 28px 0 rgba(0, 0, 0, 0.12), 0 10px 10px 0 rgba(0, 0, 0, 0.16)',
'0 19px 38px 0 rgba(0, 0, 0, 0.16), 0 15px 12px 0 rgba(0, 0, 0, 0.16)',
],

color: {
greenLighter: '#e6f7ed',
greenLight: '#6ed396',
green: '#0eb550',
greenDark: '#00893d',

blueLighter: '#eeeffc',
blueLight: '#9aa4f2',
blue: '#5768e9',
blueDark: '#4451b6',

yellowLighter: '#fff0d6',
yellowLight: '#ffc866',
yellow: '#ffa400',
yellowDark: '#cc8300',

redLighter: '#ffeff1',
redLight: '#ffa3ab',
red: '#ff6673',
redDark: '#cc525c',

lagoonLighter: '#e5f1f3',
lagoonLight: '#66afb8',
lagoon: '#007989',
lagoonDark: '#004c56',

tealLighter: '#eaf3f1',
tealLight: '#a1d5ca',
teal: '#44ac95',
tealDark: '#2d907a',

chillLighter: '#f2f8f7',
chillLight: '#d4e8e4',
chill: '#bcdcd6',
chillDark: '#9ab5b0',

white: '#ffffff',
greyLighter: '#f1f1f1',
greyLight: '#dedede',
grey: '#aeaeae',
greyDark: '#717171',
greyDarker: '#4a4a4a',
black: '#000000',

translucent: 'rgba(0, 0, 0, 0.1)',
transparent: 'rgba(0, 0, 0, 0)',
},

fontFamily: {
roboto: 'Roboto',
averta: 'Averta',
},

fontSize: {
xxxxl: '32px',
xxxl: '28px',
xxl: '24px',
xl: '20px',
l: '18px',
m: '16px',
s: '14px',
xs: '12px',
xxs: '10px',
},

fontWeight: {
regular: 400,
medium: 500,
semibold: 600,
bold: 700,
},

px(value) {
const values = [].concat(value);
return values
.map((v) => typeof v === 'string' ? v : `${v * this.pxScale}px`)
.join(' ');
},

pxScale: 8,
};

const theme = {};

theme.borderRadius = '2px';

theme.boxShadow = [];
theme.boxShadow[0] = 'none';
theme.boxShadow[1] = '0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(114, 113, 113, 0.08)';
theme.boxShadow[2] = '0 3px 6px 0 rgba(0, 0, 0, 0.12), 0 3px 6px 0 rgba(174, 174, 174, 0.16)';
theme.boxShadow[3] = '0 10px 20px 0 rgba(0, 0, 0, 0.12), 0 6px 6px 0 rgba(0, 0, 0, 0.16)';
theme.boxShadow[4] = '0 14px 28px 0 rgba(0, 0, 0, 0.12), 0 10px 10px 0 rgba(0, 0, 0, 0.16)';
theme.boxShadow[5] = '0 19px 38px 0 rgba(0, 0, 0, 0.16), 0 15px 12px 0 rgba(0, 0, 0, 0.16)';

theme.color = {};
theme.color.greenLighter = '#e6f7ed';
theme.color.greenLight = '#6ed396';
theme.color.green = '#0eb550';
theme.color.greenDark = '#00893d';
theme.color.blueLighter = '#eeeffc';
theme.color.blueLight = '#9aa4f2';
theme.color.blue = '#5768e9';
theme.color.blueDark = '#4451b6';
theme.color.yellowLighter = '#fff0d6';
theme.color.yellowLight = '#ffc866';
theme.color.yellow = '#ffa400';
theme.color.yellowDark = '#cc8300';
theme.color.redLighter = '#ffeff1';
theme.color.redLight = '#ffa3ab';
theme.color.red = '#ff6673';
theme.color.redDark = '#cc525c';
theme.color.lagoonLighter = '#e5f1f3';
theme.color.lagoonLight = '#66afb8';
theme.color.lagoon = '#007989';
theme.color.lagoonDark = '#004c56';
theme.color.tealLighter = '#eaf3f1';
theme.color.tealLight = '#a1d5ca';
theme.color.teal = '#44ac95';
theme.color.tealDark = '#2d907a';
theme.color.chillLighter = '#f2f8f7';
theme.color.chillLight = '#d4e8e4';
theme.color.chill = '#bcdcd6';
theme.color.chillDark = '#9ab5b0';
theme.color.white = '#ffffff';
theme.color.greyLighter = '#f1f1f1';
theme.color.greyLight = '#dedede';
theme.color.grey = '#aeaeae';
theme.color.greyDark = '#717171';
theme.color.greyDarker = '#4a4a4a';
theme.color.black = '#000000';
theme.color.translucent = 'rgba(0, 0, 0, 0.1)';
theme.color.transparent = 'rgba(0, 0, 0, 0)';
theme.color.primaryLighter = theme.color.greenLighter;
theme.color.primaryLight = theme.color.greenLight;
theme.color.primary = theme.color.green;
theme.color.primaryDark = theme.color.greenDark;

theme.color.accentLighter = theme.color.white;
theme.color.accentLight = theme.color.white;
theme.color.accent = theme.color.white;
theme.color.accentDark = theme.color.white;

theme.fontFamily = {};
theme.fontFamily.roboto = 'Roboto';
theme.fontFamily.averta = 'Averta';

theme.fontSize = {};
theme.fontSize.xxxxl = '32px';
theme.fontSize.xxxl = '28px';
theme.fontSize.xxl = '24px';
theme.fontSize.xl = '20px';
theme.fontSize.l = '18px';
theme.fontSize.m = '16px';
theme.fontSize.s = '14px';
theme.fontSize.xs = '12px';
theme.fontSize.xxs = '10px';

theme.fontWeight = {};
theme.fontWeight.regular = 400;
theme.fontWeight.medium = 500;
theme.fontWeight.semibold = 600;
theme.fontWeight.bold = 700;

theme.pxScale = 8;

theme.px = (value) => {
const values = [].concat(value);
return values
.map((v) => typeof v === 'string' ? v : `${v * theme.pxScale}px`)
.join(' ');
};

export default theme;

0 comments on commit af725b8

Please sign in to comment.