tldraw/styles/stitches.config.ts

80 lines
1.7 KiB
TypeScript
Raw Normal View History

2021-05-09 21:22:25 +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: {
brushFill: "rgba(0,0,0,.1)",
brushStroke: "rgba(0,0,0,.5)",
2021-05-12 11:27:33 +00:00
hint: "rgba(66, 133, 244, 0.200)",
selected: "rgba(66, 133, 244, 1.000)",
2021-05-12 22:08:53 +00:00
bounds: "rgba(65, 132, 244, 1.000)",
boundsBg: "rgba(65, 132, 244, 0.100)",
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: {
0: "10px",
1: "12px",
2: "13px",
3: "16px",
4: "18px",
},
fonts: {
ui: `"Recursive", system-ui, sans-serif`,
},
2021-05-09 12:03:39 +00:00
fontWeights: {},
lineHeights: {},
letterSpacings: {},
sizes: {},
borderWidths: {},
borderStyles: {},
radii: {},
shadows: {},
zIndices: {},
transitions: {},
},
2021-05-12 22:08:53 +00:00
utils: {
zStrokeWidth: () => (value: number | number[]) => {
if (Array.isArray(value)) {
const [val, min, max] = value
return {
strokeWidth:
min !== undefined && max !== undefined
? `clamp(${min}, ${val} / var(--camera-zoom), ${max})`
: min !== undefined
? `max(${min}, ${val} / var(--camera-zoom))`
: `calc(${val} / var(--camera-zoom))`,
}
}
return {
strokeWidth: `calc(${value} / 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({
"*": { boxSizing: "border-box" },
":root": {
"--camera-zoom": 1,
},
2021-05-09 13:04:42 +00:00
"html, body": {
2021-05-09 21:22:25 +00:00
padding: "0px",
margin: "0px",
2021-05-09 13:04:42 +00:00
overscrollBehavior: "none",
2021-05-09 21:22:25 +00:00
fontFamily: "$ui",
fontSize: "$2",
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 }