2021-02-26 11:57:44 +00:00
|
|
|
const colors = require('tailwindcss/colors')
|
2023-11-06 16:08:57 +00:00
|
|
|
const plugin = require('tailwindcss/plugin')
|
2023-01-19 18:40:04 +00:00
|
|
|
const radix = require('@radix-ui/colors')
|
|
|
|
|
2023-10-16 18:39:04 +00:00
|
|
|
const accent = {
|
2023-12-26 08:31:37 +00:00
|
|
|
'DEFAULT': 'hsl(var(--accent))',
|
|
|
|
'base': 'hsl(var(--accent))',
|
|
|
|
'foreground': 'hsl(var(--accent-foreground))',
|
2024-01-21 10:25:03 +00:00
|
|
|
'01': 'var(--lx-accent-01, --rx-gray-01)',
|
2024-01-22 03:42:38 +00:00
|
|
|
'02': 'var(--lx-accent-02, hsl(var(--accent)/.1))',
|
|
|
|
'03': 'var(--lx-accent-03, hsl(var(--accent)/.15))',
|
|
|
|
'04': 'var(--lx-accent-04, hsl(var(--accent)/.2))',
|
|
|
|
'05': 'var(--lx-accent-05, hsl(var(--accent)/.3))',
|
|
|
|
'06': 'var(--lx-accent-06, hsl(var(--accent)/.4))',
|
|
|
|
'07': 'var(--lx-accent-07, hsl(var(--accent)/.5))',
|
|
|
|
'08': 'var(--lx-accent-08, hsl(var(--accent)/.6))',
|
|
|
|
'09': 'var(--lx-accent-09, hsl(var(--accent)/.7))',
|
|
|
|
'10': 'var(--lx-accent-10, hsl(var(--accent)/.8))',
|
|
|
|
'11': 'var(--lx-accent-11, hsl(var(--accent)/.9))',
|
2024-01-21 10:25:03 +00:00
|
|
|
'12': 'var(--lx-accent-12, --rx-gray-12)',
|
2023-10-16 18:39:04 +00:00
|
|
|
'01-alpha': 'var(--lx-accent-01-alpha)',
|
|
|
|
'02-alpha': 'var(--lx-accent-02-alpha)',
|
|
|
|
'03-alpha': 'var(--lx-accent-03-alpha)',
|
|
|
|
'04-alpha': 'var(--lx-accent-04-alpha)',
|
|
|
|
'05-alpha': 'var(--lx-accent-05-alpha)',
|
|
|
|
'06-alpha': 'var(--lx-accent-06-alpha)',
|
|
|
|
'07-alpha': 'var(--lx-accent-07-alpha)',
|
|
|
|
'08-alpha': 'var(--lx-accent-08-alpha)',
|
|
|
|
'09-alpha': 'var(--lx-accent-09-alpha)',
|
|
|
|
'10-alpha': 'var(--lx-accent-10-alpha)',
|
|
|
|
'11-alpha': 'var(--lx-accent-11-alpha)',
|
|
|
|
'12-alpha': 'var(--lx-accent-12-alpha)',
|
|
|
|
}
|
|
|
|
|
|
|
|
const gray = {
|
2023-11-14 12:40:36 +00:00
|
|
|
...colors.gray,
|
2024-01-31 09:18:09 +00:00
|
|
|
'01': 'var(--lx-gray-01, var(--ls-primary-background-color, var(--rx-gray-01)))',
|
|
|
|
'02': 'var(--lx-gray-02, var(--ls-secondary-background-color, var(--rx-gray-02)))',
|
|
|
|
'03': 'var(--lx-gray-03, var(--ls-tertiary-background-color, var(--rx-gray-03)))',
|
|
|
|
'04': 'var(--lx-gray-04, var(--ls-quaternary-background-color, var(--rx-gray-04)))',
|
2024-02-29 09:31:43 +00:00
|
|
|
'05': 'var(--lx-gray-05, var(--ls-quaternary-background-color, var(--rx-gray-05)))',
|
|
|
|
'06': 'var(--lx-gray-06, var(--ls-quaternary-background-color, var(--rx-gray-06)))',
|
|
|
|
'07': 'var(--lx-gray-07, var(--ls-quaternary-background-color, var(--rx-gray-07)))',
|
2024-01-21 10:25:03 +00:00
|
|
|
'08': 'var(--lx-gray-08, var(--rx-gray-08))',
|
|
|
|
'09': 'var(--lx-gray-09, var(--rx-gray-09))',
|
|
|
|
'10': 'var(--lx-gray-10, var(--rx-gray-10))',
|
|
|
|
'11': 'var(--lx-gray-11, var(--rx-gray-11))',
|
|
|
|
'12': 'var(--lx-gray-12, var(--rx-gray-12))',
|
|
|
|
'01-alpha': 'var(--lx-gray-01-alpha, var(--rx-gray-01-alpha))',
|
|
|
|
'02-alpha': 'var(--lx-gray-02-alpha, var(--rx-gray-02-alpha))',
|
|
|
|
'03-alpha': 'var(--lx-gray-03-alpha, var(--rx-gray-03-alpha))',
|
|
|
|
'04-alpha': 'var(--lx-gray-04-alpha, var(--rx-gray-04-alpha))',
|
|
|
|
'05-alpha': 'var(--lx-gray-05-alpha, var(--rx-gray-05-alpha))',
|
|
|
|
'06-alpha': 'var(--lx-gray-06-alpha, var(--rx-gray-06-alpha))',
|
|
|
|
'07-alpha': 'var(--lx-gray-07-alpha, var(--rx-gray-07-alpha))',
|
|
|
|
'08-alpha': 'var(--lx-gray-08-alpha, var(--rx-gray-08-alpha))',
|
|
|
|
'09-alpha': 'var(--lx-gray-09-alpha, var(--rx-gray-09-alpha))',
|
|
|
|
'10-alpha': 'var(--lx-gray-10-alpha, var(--rx-gray-10-alpha))',
|
|
|
|
'11-alpha': 'var(--lx-gray-11-alpha, var(--rx-gray-11-alpha))',
|
|
|
|
'12-alpha': 'var(--lx-gray-12-alpha, var(--rx-gray-12-alpha))',
|
2023-01-19 18:40:04 +00:00
|
|
|
}
|
2021-02-26 11:57:44 +00:00
|
|
|
|
2022-10-12 02:54:11 +00:00
|
|
|
function exposeColorsToCssVars ({ addBase, theme }) {
|
|
|
|
function extractColorVars (colorObj, colorGroup = '') {
|
2022-10-07 03:54:06 +00:00
|
|
|
return Object.keys(colorObj).reduce((vars, colorKey) => {
|
2022-10-10 04:18:53 +00:00
|
|
|
const value = colorObj[colorKey]
|
2022-10-07 03:54:06 +00:00
|
|
|
|
|
|
|
const newVars =
|
|
|
|
typeof value === 'string'
|
|
|
|
? { [`--color${colorGroup}-${colorKey}`]: value }
|
2022-10-10 04:18:53 +00:00
|
|
|
: extractColorVars(value, `-${colorKey}`)
|
2022-10-07 03:54:06 +00:00
|
|
|
|
2022-10-10 04:18:53 +00:00
|
|
|
return { ...vars, ...newVars }
|
|
|
|
}, {})
|
2022-10-07 03:54:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
addBase({
|
|
|
|
':root': extractColorVars(theme('colors')),
|
2022-10-10 04:18:53 +00:00
|
|
|
})
|
2022-10-07 03:54:06 +00:00
|
|
|
}
|
|
|
|
|
2023-12-26 08:31:37 +00:00
|
|
|
const withOverride = plugin(function ({ matchUtilities }) {
|
2023-11-06 16:08:57 +00:00
|
|
|
matchUtilities({
|
|
|
|
'or': (value, b) => {
|
2023-12-26 08:31:37 +00:00
|
|
|
// check if the value starts with "bg-"
|
|
|
|
if (value.startsWith('bg-')) {
|
|
|
|
return { [`--lx-bg-override`]: `var(--lx-${value})` }
|
|
|
|
}
|
|
|
|
// check if the value starts with "text-"
|
|
|
|
if (value.startsWith('text-')) {
|
|
|
|
return { [`--lx-text-override`]: `var(--lx-${value})` }
|
|
|
|
}
|
|
|
|
// check if the value starts with "border-"
|
|
|
|
if (value.startsWith('border-')) {
|
|
|
|
return { [`--lx-border-override`]: `var(--lx-${value})` }
|
|
|
|
}
|
2023-11-06 16:08:57 +00:00
|
|
|
}
|
2023-11-14 12:40:36 +00:00
|
|
|
}, {
|
|
|
|
values: {}
|
2023-11-06 16:08:57 +00:00
|
|
|
})
|
|
|
|
})
|
|
|
|
|
2023-12-26 08:31:37 +00:00
|
|
|
function mapRadixColorToTailwind (color) {
|
|
|
|
const radixColor = radix[color]
|
|
|
|
if (!radixColor) throw new Error(`[radix color] not exist for ${color}`)
|
|
|
|
const twSteps = [10, 50, 100, 200, 300, 400, 500, 600, 700, 800, 900, 950]
|
|
|
|
const rxSteps = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]
|
|
|
|
const colors = {}
|
2023-01-19 18:40:04 +00:00
|
|
|
|
2023-12-26 08:31:37 +00:00
|
|
|
twSteps.forEach((twStep, index) => {
|
|
|
|
const rxStep = rxSteps[index]
|
|
|
|
// base color
|
|
|
|
colors[twStep] = radixColor[`${color}${rxStep}`]
|
|
|
|
// theme vars color
|
|
|
|
const rxStepName = `${(rxStep < 10) ? '0' : ''}${rxStep}`
|
|
|
|
const rxVarName = `--rx-${color}-${rxStepName}`
|
|
|
|
colors[`rx-${rxStepName}`] = `var(${rxVarName})`
|
|
|
|
colors[`rx-${rxStepName}-alpha`] = `var(${rxVarName}-alpha)`
|
|
|
|
})
|
2023-01-19 18:40:04 +00:00
|
|
|
|
2023-12-26 08:31:37 +00:00
|
|
|
return colors
|
2023-01-19 18:40:04 +00:00
|
|
|
}
|
|
|
|
|
2020-04-17 07:12:26 +00:00
|
|
|
module.exports = {
|
2020-12-13 04:43:36 +00:00
|
|
|
darkMode: 'class',
|
2022-10-10 04:18:53 +00:00
|
|
|
content: [
|
|
|
|
'./src/**/*.js',
|
|
|
|
'./src/**/*.cljs',
|
2023-01-19 18:40:04 +00:00
|
|
|
'./resources/**/*.html',
|
|
|
|
'./deps/shui/src/**/*.cljs',
|
2023-12-26 08:31:37 +00:00
|
|
|
'./packages/ui/@/components/**/*.{ts,tsx}'
|
2022-10-10 04:18:53 +00:00
|
|
|
],
|
|
|
|
safelist: [
|
2023-01-19 18:40:04 +00:00
|
|
|
'bg-black', 'bg-white', 'capitalize-first',
|
2022-10-12 03:14:31 +00:00
|
|
|
{ pattern: /bg-(gray|red|yellow|green|blue|orange|indigo|rose|purple|pink)-(100|200|300|400|500|600|700|800|900)/ },
|
2022-10-12 16:56:54 +00:00
|
|
|
{ pattern: /text-(gray|red|yellow|green|blue|orange|indigo|rose|purple|pink)-(100|200|300|400|500|600|700|800|900)/ },
|
2023-01-19 18:40:04 +00:00
|
|
|
{ pattern: /columns-([1-9]|1[0-2])|(auto|3xs|2xs|xs|sm|md|lg|xl)|([2-7]xl)/ },
|
2022-10-10 04:18:53 +00:00
|
|
|
],
|
|
|
|
plugins: [
|
|
|
|
require('@tailwindcss/forms'),
|
|
|
|
require('@tailwindcss/typography'),
|
|
|
|
require('@tailwindcss/aspect-ratio'),
|
2023-01-19 18:40:04 +00:00
|
|
|
require('tailwind-capitalize-first-letter'),
|
2023-12-26 08:31:37 +00:00
|
|
|
require('tailwindcss-animate'),
|
2024-01-22 10:41:55 +00:00
|
|
|
exposeColorsToCssVars
|
2022-10-10 04:18:53 +00:00
|
|
|
],
|
2021-02-26 11:57:44 +00:00
|
|
|
theme: {
|
2021-07-12 13:57:53 +00:00
|
|
|
extend: {
|
2023-01-19 18:40:04 +00:00
|
|
|
backgroundImage: {
|
|
|
|
'gradient-conic': 'conic-gradient(var(--tw-gradient-stops))',
|
|
|
|
'gradient-conic-bounce': 'conic-gradient(var(--tw-gradient-from), var(--tw-gradient-via), var(--tw-gradient-to), var(--tw-gradient-via), var(--tw-gradient-from))',
|
|
|
|
'gradient-radial': 'radial-gradient(var(--tw-gradient-stops))',
|
|
|
|
},
|
2022-10-07 03:54:06 +00:00
|
|
|
fontSize: {
|
|
|
|
'2xs': ['0.625rem', '0.875rem']
|
|
|
|
},
|
2021-09-13 11:49:51 +00:00
|
|
|
animation: {
|
|
|
|
'spin-reverse': 'spin 2s linear infinite reverse',
|
2023-12-26 08:31:37 +00:00
|
|
|
'accordion-down': 'accordion-down 0.2s ease-out',
|
|
|
|
'accordion-up': 'accordion-up 0.2s ease-out',
|
2021-09-13 11:49:51 +00:00
|
|
|
},
|
2021-07-12 13:57:53 +00:00
|
|
|
spacing: {
|
|
|
|
'128': '32rem',
|
2021-07-15 07:29:44 +00:00
|
|
|
'144': '36rem'
|
2021-09-13 11:49:51 +00:00
|
|
|
},
|
|
|
|
scale: {
|
|
|
|
'200': '2',
|
|
|
|
'250': '2.5',
|
|
|
|
'300': '3',
|
|
|
|
'400': '4',
|
2023-05-05 08:31:34 +00:00
|
|
|
},
|
|
|
|
width: {
|
|
|
|
'lsm': '600px',
|
|
|
|
'lmd': '728px',
|
|
|
|
'llg': '960px'
|
2023-11-06 16:08:57 +00:00
|
|
|
},
|
2024-01-21 10:25:03 +00:00
|
|
|
// backgroundColor: {
|
|
|
|
// ...lx('--lx-bg-override'),
|
|
|
|
// },
|
|
|
|
// textColor: {
|
|
|
|
// ...lx('--lx-text-override'),
|
|
|
|
// },
|
|
|
|
// borderColor: {
|
|
|
|
// ...lx('--lx-border-override'),
|
|
|
|
// },
|
2023-12-26 08:31:37 +00:00
|
|
|
borderRadius: {
|
|
|
|
lg: 'var(--radius)',
|
|
|
|
md: 'calc(var(--radius) - 2px)',
|
|
|
|
sm: 'calc(var(--radius) - 4px)',
|
|
|
|
},
|
|
|
|
keyframes: {
|
|
|
|
'accordion-down': {
|
|
|
|
from: { height: 0 },
|
|
|
|
to: { height: 'var(--radix-accordion-content-height)' },
|
|
|
|
},
|
|
|
|
'accordion-up': {
|
|
|
|
from: { height: 'var(--radix-accordion-content-height)' },
|
|
|
|
to: { height: 0 },
|
|
|
|
},
|
|
|
|
},
|
2021-07-12 13:57:53 +00:00
|
|
|
},
|
2021-02-26 11:57:44 +00:00
|
|
|
colors: {
|
2023-12-26 08:31:37 +00:00
|
|
|
// Theme basic
|
|
|
|
border: 'hsl(var(--border))',
|
|
|
|
input: 'hsl(var(--input))',
|
|
|
|
ring: 'hsl(var(--ring))',
|
|
|
|
background: 'hsl(var(--background))',
|
|
|
|
foreground: 'hsl(var(--foreground))',
|
|
|
|
primary: {
|
|
|
|
DEFAULT: 'hsl(var(--primary))',
|
|
|
|
foreground: 'hsl(var(--primary-foreground))',
|
|
|
|
},
|
|
|
|
secondary: {
|
|
|
|
DEFAULT: 'hsl(var(--secondary))',
|
|
|
|
foreground: 'hsl(var(--secondary-foreground))',
|
|
|
|
},
|
|
|
|
destructive: {
|
|
|
|
DEFAULT: 'hsl(var(--destructive))',
|
|
|
|
foreground: 'hsl(var(--destructive-foreground))',
|
|
|
|
},
|
|
|
|
muted: {
|
|
|
|
DEFAULT: 'hsl(var(--muted))',
|
|
|
|
foreground: 'hsl(var(--muted-foreground))',
|
|
|
|
},
|
|
|
|
popover: {
|
|
|
|
DEFAULT: 'hsl(var(--popover))',
|
|
|
|
foreground: 'hsl(var(--popover-foreground))',
|
|
|
|
},
|
2024-01-05 04:47:31 +00:00
|
|
|
popovelx: {
|
|
|
|
DEFAULT: 'var(--lx-gray-03, hsl(var(--popover)))',
|
|
|
|
},
|
2023-12-26 08:31:37 +00:00
|
|
|
card: {
|
|
|
|
DEFAULT: 'hsl(var(--card))',
|
|
|
|
foreground: 'hsl(var(--card-foreground))',
|
|
|
|
},
|
|
|
|
|
2023-01-19 18:40:04 +00:00
|
|
|
// Tailwind colors
|
2023-10-16 18:39:04 +00:00
|
|
|
gray: gray,
|
|
|
|
accent: accent,
|
2023-09-15 11:30:51 +00:00
|
|
|
current: 'currentColor',
|
2023-01-19 18:40:04 +00:00
|
|
|
transparent: 'transparent',
|
2023-12-26 08:31:37 +00:00
|
|
|
black: colors.black,
|
2021-02-26 11:57:44 +00:00
|
|
|
white: colors.white,
|
2023-12-26 08:31:37 +00:00
|
|
|
|
|
|
|
red: mapRadixColorToTailwind('red'),
|
|
|
|
pink: mapRadixColorToTailwind('pink'),
|
|
|
|
orange: mapRadixColorToTailwind('orange'),
|
|
|
|
yellow: mapRadixColorToTailwind('yellow'),
|
|
|
|
green: mapRadixColorToTailwind('green'),
|
|
|
|
blue: mapRadixColorToTailwind('blue'),
|
|
|
|
indigo: mapRadixColorToTailwind('indigo'),
|
|
|
|
purple: mapRadixColorToTailwind('purple'),
|
|
|
|
|
|
|
|
rose: mapRadixColorToTailwind('red'),
|
|
|
|
amber: mapRadixColorToTailwind('amber'),
|
|
|
|
bronze: mapRadixColorToTailwind('bronze'),
|
|
|
|
brown: mapRadixColorToTailwind('brown'),
|
|
|
|
crimson: mapRadixColorToTailwind('crimson'),
|
|
|
|
cyan: mapRadixColorToTailwind('cyan'),
|
|
|
|
gold: mapRadixColorToTailwind('gold'),
|
|
|
|
grass: mapRadixColorToTailwind('grass'),
|
|
|
|
lime: mapRadixColorToTailwind('lime'),
|
|
|
|
mauve: mapRadixColorToTailwind('mauve'),
|
|
|
|
mint: mapRadixColorToTailwind('mint'),
|
|
|
|
olive: mapRadixColorToTailwind('olive'),
|
|
|
|
plum: mapRadixColorToTailwind('plum'),
|
|
|
|
sage: mapRadixColorToTailwind('sage'),
|
|
|
|
sand: mapRadixColorToTailwind('sand'),
|
|
|
|
sky: mapRadixColorToTailwind('sky'),
|
|
|
|
slate: mapRadixColorToTailwind('slate'),
|
|
|
|
teal: mapRadixColorToTailwind('teal'),
|
|
|
|
tomato: mapRadixColorToTailwind('tomato'),
|
|
|
|
violet: mapRadixColorToTailwind('violet'),
|
2021-02-26 11:57:44 +00:00
|
|
|
}
|
2023-12-26 08:31:37 +00:00
|
|
|
},
|
|
|
|
corePlugins: {
|
|
|
|
preflight: true
|
2021-02-26 11:57:44 +00:00
|
|
|
}
|
2020-12-13 04:43:36 +00:00
|
|
|
}
|