From ca236c58bca60b7aa420f90674bdd1f20d1b20e2 Mon Sep 17 00:00:00 2001 From: Jacob Blomgren Date: Wed, 8 May 2019 10:57:21 +0200 Subject: [PATCH] feat: a11y colors (#629) --- src/styles/color.js | 12 ++++++------ src/styles/palette.js | 9 ++++----- src/styles/theme.js | 2 +- 3 files changed, 11 insertions(+), 12 deletions(-) diff --git a/src/styles/color.js b/src/styles/color.js index 8beeae20..e5b21e50 100644 --- a/src/styles/color.js +++ b/src/styles/color.js @@ -1,4 +1,4 @@ -export default { +export default ({ a11yColors = false }) => ({ // BRAND brandBlue: '#00C8F5', brandGreen: '#D2F500', @@ -30,8 +30,8 @@ export default { // FUNCTIONAL COLOURS FOR PRODUCT DEVELOPMENT - cta: '#0046FF', - positive: '#00D200', - negative: '#FF1900', - index: '#FFCF00', -}; + cta: a11yColors ? '#2D67FF' : '#0046FF', + positive: a11yColors ? '#008A00' : '#00D200', + negative: a11yColors ? '#E81700' : '#FF1900', + index: a11yColors ? '#FFCF00' : '#C15700', +}); diff --git a/src/styles/palette.js b/src/styles/palette.js index 88e0b4fe..3a97e424 100644 --- a/src/styles/palette.js +++ b/src/styles/palette.js @@ -1,11 +1,10 @@ -import color from './color'; - -export default function createPalette({ type = 'light' }) { - const palette = { ...color }; +import createColor from './color'; +export default function createPalette({ type = 'light', a11yColors = false }) { const proxyIsAvailable = typeof window !== 'undefined' ? 'Proxy' in window : true; if (!proxyIsAvailable) { + const palette = { ...createColor({ a11yColors }) }; return palette; } @@ -26,7 +25,7 @@ export default function createPalette({ type = 'light' }) { return { name: 'nordnet', type, - ...color, + ...createColor({ a11yColors }), color: pinkProxieFactory('.color'), variant: pinkProxieFactory('.variant'), // text: pinkProxieFactory('').text, diff --git a/src/styles/theme.js b/src/styles/theme.js index abe023f5..157461c2 100644 --- a/src/styles/theme.js +++ b/src/styles/theme.js @@ -9,7 +9,7 @@ import createMixins from './mixins'; export function createTheme(config = {}) { const { - palette = createPalette({ type: 'dark' }), + palette = createPalette({ type: 'dark', a11yColors: config.a11yColors }), breakpoints = createBreakpoints(), mixins = createMixins(breakpoints), typography = createTypography(),