MCPcopy
hub / github.com/GitbookIO/gitbook / generateVarShades

Function generateVarShades

packages/gitbook/tailwind.config.ts:16–32  ·  view source on GitHub ↗

* Generate a Tailwind color shades from a variable.

(varName: string, filter: ColorCategory[] = [])

Source from the content-addressed store, hash-verified

14 * Generate a Tailwind color shades from a variable.
15 */
16function generateVarShades(varName: string, filter: ColorCategory[] = []) {
17 const result: { [key: string]: string } = {};
18
19 for (const [categoryName, category] of Object.entries(scale)) {
20 if (filter.length === 0 || filter.includes(categoryName as ColorCategory)) {
21 for (const [key, value] of Object.entries(category)) {
22 if (filter.length > 0) {
23 result[key] = `rgb(var(--${varName}-${value}))`;
24 } else {
25 result[value] = `rgb(var(--${varName}-${value}))`;
26 }
27 }
28 }
29 }
30
31 return result;
32}
33
34/**
35 * Generate a Tailwind color shades from a HEX color.

Callers 1

tailwind.config.tsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected