Skip to content

Commit

Permalink
fix(uno): colorPaletteMap missing surface-0 color
Browse files Browse the repository at this point in the history
  • Loading branch information
NamesMT committed Aug 24, 2024
1 parent 784f089 commit ab0ddb3
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion apps/frontend/uno.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,13 @@ import { parseColor } from 'unocss/preset-mini'

const colorsPaletteMap: Record<string, string> = {}
for (const color of ['primary', 'surface']) {
Array.from({ length: 11 }, (_, n) => n + 1).forEach((num) => {
// length 12 = 0-950
Array.from({ length: 12 }, (_, i) => i).forEach((num) => {
const key = `${color}-${colorIndexer(num)}`
colorsPaletteMap[key] = `hsl(var(--${key}))`
})
}
// Generates color index following the pattern: 0 50 100 200..900 950 1000
function colorIndexer(num: number) {
let res = 0
while (num > 0) {
Expand Down

0 comments on commit ab0ddb3

Please sign in to comment.