tldraw/styles/stitches.config.ts

106 lines
2.5 KiB
TypeScript
Raw Normal View History

2021-05-28 20:30:27 +00:00
import { createCss, defaultThemeMap } from '@stitches/react'
2021-05-09 12:03:39 +00:00
2021-05-09 21:22:25 +00:00
const { styled, global, css, theme, getCssString } = createCss({
themeMap: {
...defaultThemeMap,
},
2021-05-09 12:03:39 +00:00
theme: {
2021-05-10 12:16:57 +00:00
colors: {
2021-06-04 21:21:03 +00:00
brushFill: 'rgba(0,0,0,.05)',
brushStroke: 'rgba(0,0,0,.25)',
2021-06-01 21:49:32 +00:00
hint: 'rgba(216, 226, 249, 1.000)',
2021-05-28 20:30:27 +00:00
selected: 'rgba(66, 133, 244, 1.000)',
bounds: 'rgba(65, 132, 244, 1.000)',
2021-06-10 09:49:16 +00:00
boundsBg: 'rgba(65, 132, 244, 0.05)',
2021-06-20 10:56:43 +00:00
highlight: 'rgba(65, 132, 244, 0.15)',
2021-06-10 09:49:16 +00:00
overlay: 'rgba(0, 0, 0, 0.15)',
2021-05-28 20:30:27 +00:00
border: '#aaa',
2021-05-30 13:49:33 +00:00
canvas: '#fafafa',
2021-05-28 20:30:27 +00:00
panel: '#fefefe',
inactive: '#cccccf',
hover: '#efefef',
text: '#333',
2021-06-20 12:35:47 +00:00
muted: '#777',
2021-05-28 20:30:27 +00:00
input: '#f3f3f3',
inputBorder: '#ddd',
2021-05-10 12:16:57 +00:00
},
2021-05-09 12:03:39 +00:00
space: {},
2021-05-09 21:22:25 +00:00
fontSizes: {
2021-05-28 20:30:27 +00:00
0: '10px',
1: '12px',
2: '13px',
3: '16px',
4: '18px',
2021-05-09 21:22:25 +00:00
},
fonts: {
2021-05-14 22:56:41 +00:00
ui: '"Recursive", system-ui, sans-serif',
2021-05-09 21:22:25 +00:00
},
2021-05-09 12:03:39 +00:00
fontWeights: {},
lineHeights: {},
letterSpacings: {},
sizes: {},
borderWidths: {},
borderStyles: {},
radii: {},
shadows: {},
zIndices: {},
transitions: {},
},
media: {
sm: '(min-width: 640px)',
md: '(min-width: 768px)',
},
2021-05-12 22:08:53 +00:00
utils: {
2021-05-29 12:40:41 +00:00
zDash: () => (value: number) => {
return {
strokeDasharray: `calc(${value}px / var(--camera-zoom)) calc(${value}px / var(--camera-zoom))`,
}
},
zStrokeWidth: () => (value: number | number[]) => {
if (Array.isArray(value)) {
2021-05-28 21:05:40 +00:00
// const [val, min, max] = value
// return {
// strokeWidth:
// min !== undefined && max !== undefined
// ? `clamp(${min}px, (calc(${val}px / var(--camera-zoom))), ${max}px)`
// : min !== undefined
// ? `min(${min}px, calc(${val}px / var(--camera-zoom)))`
// : `calc(${val}px / var(--camera-zoom))`,
// }
return {
2021-05-28 13:08:51 +00:00
strokeWidth: `calc(${value[0]}px / var(--camera-zoom))`,
}
}
return {
2021-05-28 13:08:51 +00:00
strokeWidth: `calc(${value}px / var(--camera-zoom))`,
}
},
2021-05-12 22:08:53 +00:00
},
2021-05-09 12:03:39 +00:00
})
const light = theme({})
const dark = theme({})
const globalStyles = global({
2021-05-28 20:30:27 +00:00
'*': { boxSizing: 'border-box' },
':root': {
'--camera-zoom': 1,
'--scale': 'calc(1 / var(--camera-zoom))',
},
2021-05-28 20:30:27 +00:00
'html, body': {
padding: '0px',
margin: '0px',
overscrollBehavior: 'none',
fontFamily: '$ui',
fontSize: '$2',
2021-06-20 12:35:47 +00:00
backgroundColor: '$canvas',
2021-05-09 13:04:42 +00:00
},
2021-05-09 12:03:39 +00:00
})
export default styled
2021-05-09 21:22:25 +00:00
export { css, getCssString, globalStyles, light, dark }