2023-12-06 14:44:13 -05:00
|
|
|
const plugin = require('tailwindcss/plugin')
|
|
|
|
|
2023-07-13 07:22:08 -04:00
|
|
|
const themeColorRamps = [
|
|
|
|
{ name: 'chalkboard', stops: 12 },
|
|
|
|
{ name: 'energy', stops: 12 },
|
|
|
|
{ name: 'liquid', stops: 12 },
|
|
|
|
{ name: 'fern', stops: 12 },
|
|
|
|
{ name: 'cool', stops: 12 },
|
|
|
|
{ name: 'river', stops: 12 },
|
|
|
|
{ name: 'berry', stops: 12 },
|
|
|
|
{ name: 'destroy', stops: 8 },
|
|
|
|
{ name: 'warn', stops: 8 },
|
|
|
|
{ name: 'succeed', stops: 8 },
|
|
|
|
]
|
2023-12-06 14:44:13 -05:00
|
|
|
const toOKLCHVar = (val) => `oklch(var(${val}) / <alpha-value>) `
|
2023-07-13 07:22:08 -04:00
|
|
|
|
|
|
|
const themeColors = Object.fromEntries(
|
2023-12-06 14:44:13 -05:00
|
|
|
themeColorRamps.map(({ name, stops }) => [
|
|
|
|
name,
|
|
|
|
Object.fromEntries(
|
|
|
|
new Array(stops)
|
|
|
|
.fill(0)
|
|
|
|
.map((_, i) => [(i + 1) * 10, toOKLCHVar(`--_${name}-${(i + 1) * 10}`)])
|
|
|
|
),
|
2023-07-13 07:22:08 -04:00
|
|
|
])
|
|
|
|
)
|
|
|
|
|
2022-11-22 09:06:08 +11:00
|
|
|
/** @type {import('tailwindcss').Config} */
|
|
|
|
module.exports = {
|
2023-12-06 14:44:13 -05:00
|
|
|
mode: 'jit',
|
|
|
|
content: ['./src/**/*.{js,jsx,ts,tsx}'],
|
2022-11-22 09:06:08 +11:00
|
|
|
theme: {
|
2023-07-13 07:22:08 -04:00
|
|
|
extend: {
|
|
|
|
colors: {
|
2024-04-05 00:59:02 -04:00
|
|
|
primary: `oklch(var(--_primary) / <alpha-value>)`,
|
2025-05-06 15:07:22 -04:00
|
|
|
'ml-green': '#29FFA4',
|
|
|
|
'ml-black': 'var(--chalkboard-100)',
|
|
|
|
'ml-white': '#FFFFFF',
|
|
|
|
'ml-grey': 'var(--chalkboard-80)',
|
2023-07-13 07:22:08 -04:00
|
|
|
...themeColors,
|
|
|
|
},
|
2023-12-19 14:19:34 -05:00
|
|
|
fontFamily: {
|
2024-09-11 16:57:54 -04:00
|
|
|
sans: `'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
|
2023-12-19 14:19:34 -05:00
|
|
|
'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
|
|
|
|
sans-serif`,
|
|
|
|
},
|
2025-02-20 13:53:35 -05:00
|
|
|
/**
|
|
|
|
* We want the z-index of major UI areas
|
|
|
|
* to be consolidated in this one spot,
|
|
|
|
* so we can make sure they coordinate.
|
|
|
|
*/
|
|
|
|
zIndex: {
|
|
|
|
// TODO change use of `z-<number>` to use these instead
|
|
|
|
// underlay: '-1',
|
|
|
|
// tooltip: '1',
|
|
|
|
// commandBar: '2',
|
|
|
|
// modal: '3',
|
|
|
|
sketchSegmentIndicators: '5',
|
|
|
|
sketchOverlayDropdown: '6',
|
|
|
|
// top: '99',
|
|
|
|
},
|
2023-07-13 07:22:08 -04:00
|
|
|
},
|
2022-11-22 09:06:08 +11:00
|
|
|
},
|
2023-07-31 06:33:10 -04:00
|
|
|
darkMode: 'class',
|
2023-08-28 20:31:49 -04:00
|
|
|
plugins: [
|
|
|
|
require('@headlessui/tailwindcss'),
|
2023-12-06 14:44:13 -05:00
|
|
|
// custom plugin to add variants for aria-pressed
|
|
|
|
// To use, just add a class of 'group-pressed:<some-tailwind-class>' or 'pressed:<some-tailwind-class>'
|
|
|
|
// to your element. Based on https://dev.to/philw_/tying-tailwind-styling-to-aria-attributes-502f
|
|
|
|
plugin(function ({ addVariant, e }) {
|
|
|
|
addVariant('group-pressed', ({ modifySelectors, separator }) => {
|
|
|
|
modifySelectors(({ className }) => {
|
|
|
|
return `.group[aria-pressed='true'] .${e(
|
|
|
|
`group-pressed${separator}${className}`
|
|
|
|
)}`
|
|
|
|
})
|
|
|
|
})
|
|
|
|
addVariant('pressed', ({ modifySelectors, separator }) => {
|
|
|
|
modifySelectors(({ className }) => {
|
|
|
|
return `.${e(`pressed${separator}${className}`)}[aria-pressed='true']`
|
|
|
|
})
|
|
|
|
})
|
|
|
|
}),
|
2023-08-28 20:31:49 -04:00
|
|
|
],
|
2022-11-22 09:06:08 +11:00
|
|
|
}
|