tooot/src/utils/styles/themes.ts

124 lines
2.7 KiB
TypeScript
Raw Normal View History

2020-11-23 00:07:32 +01:00
import { DefaultTheme, DarkTheme } from '@react-navigation/native'
export type ColorDefinitions =
| 'primaryDefault'
2020-12-03 01:28:56 +01:00
| 'primaryOverlay'
2020-11-23 00:07:32 +01:00
| 'secondary'
2020-12-26 14:40:10 +01:00
| 'disabled'
2020-12-26 00:40:27 +01:00
| 'blue'
| 'red'
| 'green'
| 'yellow'
| 'backgroundDefault'
| 'backgroundOverlayDefault'
| 'backgroundOverlayInvert'
2020-11-23 00:07:32 +01:00
| 'border'
2021-01-07 19:13:09 +01:00
| 'shimmerDefault'
| 'shimmerHighlight'
2020-11-23 00:07:32 +01:00
const themeColors: {
[key in ColorDefinitions]: {
light: string
dark: string
}
} = {
primaryDefault: {
2020-12-26 00:40:27 +01:00
light: 'rgb(18, 18, 18)',
2021-01-12 00:12:44 +01:00
dark: 'rgb(180, 180, 180)'
2020-11-23 00:07:32 +01:00
},
2020-12-03 01:28:56 +01:00
primaryOverlay: {
2020-12-26 00:40:27 +01:00
light: 'rgb(250, 250, 250)',
2021-02-07 00:39:11 +01:00
dark: 'rgb(200, 200, 200)'
2020-12-03 01:28:56 +01:00
},
2020-11-23 00:07:32 +01:00
secondary: {
2020-12-26 00:40:27 +01:00
light: 'rgb(135, 135, 135)',
2021-01-12 00:12:44 +01:00
dark: 'rgb(130, 130, 130)'
2020-11-23 00:07:32 +01:00
},
2020-12-26 14:40:10 +01:00
disabled: {
light: 'rgb(200, 200, 200)',
dark: 'rgb(66, 66, 66)'
},
2020-12-26 00:40:27 +01:00
blue: {
light: 'rgb(43, 144, 221)',
dark: 'rgb(43, 144, 221)'
2020-11-28 17:07:30 +01:00
},
2020-12-26 00:40:27 +01:00
red: {
light: 'rgb(225, 45, 35)',
2021-02-07 00:39:11 +01:00
dark: 'rgb(225, 78, 79)'
2020-12-26 00:40:27 +01:00
},
green: {
light: 'rgb(18, 158, 80)',
dark: 'rgb(18, 158, 80)'
},
yellow: {
light: 'rgb(230, 166, 30)',
dark: 'rgb(200, 145, 25)'
},
2020-12-26 00:40:27 +01:00
backgroundDefault: {
2020-12-26 00:40:27 +01:00
light: 'rgb(250, 250, 250)',
2021-02-11 01:33:31 +01:00
dark: 'rgb(18, 18, 18)'
2020-11-23 00:07:32 +01:00
},
backgroundOverlayDefault: {
2020-12-26 00:40:27 +01:00
light: 'rgba(250, 250, 250, 0.5)',
dark: 'rgba(0, 0, 0, 0.5)'
2020-12-02 00:16:27 +01:00
},
backgroundOverlayInvert: {
2021-01-12 00:12:44 +01:00
light: 'rgba(25, 25, 25, 0.5)',
2020-12-26 14:40:10 +01:00
dark: 'rgba(0, 0, 0, 0.5)'
2020-12-03 01:28:56 +01:00
},
2020-11-23 00:07:32 +01:00
border: {
2021-01-12 00:12:44 +01:00
light: 'rgba(25, 25, 25, 0.3)',
2020-12-26 23:05:17 +01:00
dark: 'rgba(255, 255, 255, 0.3)'
2020-12-27 16:25:29 +01:00
},
2021-01-07 19:13:09 +01:00
shimmerDefault: {
2021-01-12 00:12:44 +01:00
light: 'rgba(25, 25, 25, 0.05)',
2021-01-07 19:13:09 +01:00
dark: 'rgba(250, 250, 250, 0.05)'
},
shimmerHighlight: {
2021-01-12 00:12:44 +01:00
light: 'rgba(25, 25, 25, 0.15)',
2021-01-07 19:13:09 +01:00
dark: 'rgba(250, 250, 250, 0.15)'
2020-11-23 00:07:32 +01:00
}
}
const getTheme = (mode: 'light' | 'dark') => {
let Theme = {} as {
[key in ColorDefinitions]: string
}
const keys = Object.keys(themeColors) as ColorDefinitions[]
keys.forEach(key => (Theme[key] = themeColors[key][mode]))
return Theme
}
const themes = {
light: {
...DefaultTheme,
colors: {
...DefaultTheme.colors,
primary: themeColors.primaryDefault.light,
background: themeColors.backgroundDefault.light,
card: themeColors.backgroundDefault.light,
text: themeColors.primaryDefault.light,
2020-11-23 00:07:32 +01:00
border: themeColors.border.light,
2020-12-27 16:25:29 +01:00
notification: themeColors.red.light
2020-11-23 00:07:32 +01:00
}
},
dark: {
...DarkTheme,
colors: {
...DarkTheme.colors,
primary: themeColors.primaryDefault.dark,
background: themeColors.backgroundDefault.dark,
card: themeColors.backgroundDefault.dark,
text: themeColors.primaryDefault.dark,
2020-11-23 00:07:32 +01:00
border: themeColors.border.dark,
2020-12-27 16:25:29 +01:00
notification: themeColors.red.dark
2020-11-23 00:07:32 +01:00
}
}
}
export { themeColors, getTheme, themes }