tooot/src/utils/styles/themes.ts

107 lines
2.3 KiB
TypeScript
Raw Normal View History

2020-11-23 00:07:32 +01:00
import { DefaultTheme, DarkTheme } from '@react-navigation/native'
export type ColorDefinitions =
| 'primary'
2020-12-03 01:28:56 +01:00
| 'primaryOverlay'
2020-11-23 00:07:32 +01:00
| 'secondary'
2020-12-26 00:40:27 +01:00
| 'blue'
| 'red'
2020-11-23 00:07:32 +01:00
| 'background'
2020-12-02 00:16:27 +01:00
| 'backgroundGradientStart'
| 'backgroundGradientEnd'
2020-12-03 01:28:56 +01:00
| 'backgroundOverlay'
2020-11-23 00:07:32 +01:00
| 'border'
| 'separator'
const themeColors: {
[key in ColorDefinitions]: {
light: string
dark: string
}
} = {
primary: {
2020-12-26 00:40:27 +01:00
light: 'rgb(18, 18, 18)',
dark: 'rgb(218, 218, 218)'
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)',
dark: 'rgb(218, 218, 218)'
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)',
dark: 'rgb(135, 135, 135)'
2020-11-23 00:07:32 +01:00
},
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)',
dark: 'rgb(225, 98, 89)'
},
2020-11-23 00:07:32 +01:00
background: {
2020-12-26 00:40:27 +01:00
light: 'rgb(250, 250, 250)',
dark: 'rgb(18, 18, 18)'
2020-11-23 00:07:32 +01:00
},
2020-12-02 00:16:27 +01:00
backgroundGradientStart: {
2020-12-26 00:40:27 +01:00
light: 'rgba(250, 250, 250, 0.5)',
dark: 'rgba(18, 18, 18, 0.5)'
2020-12-02 00:16:27 +01:00
},
backgroundGradientEnd: {
2020-12-26 00:40:27 +01:00
light: 'rgba(250, 250, 250, 1)',
dark: 'rgba(18, 18, 18, 1)'
2020-12-02 00:16:27 +01:00
},
2020-12-03 01:28:56 +01:00
backgroundOverlay: {
2020-12-26 00:40:27 +01:00
light: 'rgba(18, 18, 18, 0.5)',
2020-12-25 18:20:09 +01:00
dark: 'rgba(255, 255, 255, 0.5)'
2020-12-03 01:28:56 +01:00
},
2020-11-23 00:07:32 +01:00
border: {
light: 'rgba(0, 0, 0, 0.3)',
dark: 'rgba(255, 255, 255, 0.16)'
},
separator: {
light: 'rgba(0, 0, 0, 0.1)',
dark: 'rgba(255, 255, 255, 0.1)'
}
}
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.primary.light,
background: themeColors.background.light,
card: themeColors.background.light || 'rgba(249, 249, 249, 0.94)',
text: themeColors.primary.light,
border: themeColors.border.light,
notification: 'rgb(255, 59, 48)'
}
},
dark: {
...DarkTheme,
colors: {
...DarkTheme.colors,
primary: themeColors.primary.dark,
background: themeColors.background.dark,
card: themeColors.background.dark || 'rgba(22, 22, 22, 0.94)',
text: themeColors.primary.dark,
border: themeColors.border.dark,
notification: 'rgb(255, 69, 58)'
}
}
}
export { themeColors, getTheme, themes }