/
githubmirror
/
tabler
Обзор
Документация
Войти
/
githubmirror
/
tabler
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
dev
core/js/src/tabler.ts
17 строк
565 B
Paweł Kuna
Migrate core JavaScript to TypeScript (#2582)
09 янв 2026, 23:49
Не верифицирован
09 янв 2026, 23:49
857988d
Код
Авторство
О чём код?
export const prefix: string = 'tblr-' export const hexToRgba = (hex: string, opacity: number): string | null => { const result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex) return result ? `rgba(${parseInt(result[1], 16)}, ${parseInt(result[2], 16)}, ${parseInt(result[3], 16)}, ${opacity})` : null } export const getColor = (color: string, opacity: number = 1): string | null => { const c = getComputedStyle(document.body).getPropertyValue(`--${prefix}${color}`).trim() if (opacity !== 1) { return hexToRgba(c, opacity) } return c }