tailwind-color-mapper
Version:
OKLCH-first Tailwind color mapping utilities with comprehensive format support
1 lines • 22.6 kB
Source Map (JSON)
{"version":3,"file":"core.cjs","sources":["../src/functions.ts"],"sourcesContent":["import tailwindMapperData from \"../tailwindMapper.json\";\nimport {\n CSSVariables,\n ColorCode,\n ColorData,\n ColorFormat,\n ColorSearchResult,\n MapperStats,\n TailwindColor,\n TailwindConfig,\n TailwindMapper,\n TailwindShade,\n} from \"./types\";\n\nconst tailwindMapper: TailwindMapper =\n tailwindMapperData as unknown as TailwindMapper;\n\n// Constants\nconst VALID_COLORS: readonly TailwindColor[] = [\n \"red\",\n \"orange\",\n \"amber\",\n \"yellow\",\n \"lime\",\n \"green\",\n \"emerald\",\n \"teal\",\n \"cyan\",\n \"sky\",\n \"blue\",\n \"indigo\",\n \"violet\",\n \"purple\",\n \"fuchsia\",\n \"pink\",\n \"rose\",\n \"slate\",\n \"gray\",\n \"zinc\",\n \"neutral\",\n \"stone\",\n] as const;\n\nconst VALID_SHADES: readonly TailwindShade[] = [\n 50, 100, 200, 300, 400, 500, 600, 700, 800, 900, 950,\n] as const;\n\nconst VALID_FORMATS: readonly ColorFormat[] = [\n \"hex\",\n \"rgb\",\n \"hsl\",\n \"oklch\",\n \"rawrgb\",\n \"raw_rgb\",\n \"rawhsl\",\n \"raw_hsl\",\n \"rawoklch\",\n \"raw_oklch\",\n \"all\",\n] as const;\n\n// Validation functions\nfunction isValidColor(colorName: string): colorName is TailwindColor {\n return VALID_COLORS.includes(colorName as TailwindColor);\n}\n\nfunction isValidShade(shade: number): shade is TailwindShade {\n return VALID_SHADES.includes(shade as TailwindShade);\n}\n\nfunction isValidFormat(format: string): format is ColorFormat {\n return VALID_FORMATS.includes(format.toLowerCase() as ColorFormat);\n}\n\nfunction normalizeColorCode(colorName: string, colorCode: ColorCode): string {\n if (typeof colorCode === \"number\") {\n if (!isValidShade(colorCode)) {\n throw new Error(\n `Invalid shade: ${colorCode}. Valid shades are: ${VALID_SHADES.join(\n \", \"\n )}`\n );\n }\n return `${colorName}-${colorCode}`;\n }\n\n // If it's already a string, validate it matches the expected format\n if (colorCode.includes(\"-\")) {\n // It's already in format \"red-500\"\n return colorCode;\n } else {\n // It's just the number as string \"500\"\n const shadeNum = parseInt(colorCode, 10);\n if (isNaN(shadeNum) || !isValidShade(shadeNum)) {\n throw new Error(\n `Invalid shade: ${colorCode}. Valid shades are: ${VALID_SHADES.join(\n \", \"\n )}`\n );\n }\n return `${colorName}-${shadeNum}`;\n }\n}\n\n// Main function to get color value in specified format\nexport function getColor(\n colorName: string,\n colorCode: ColorCode,\n format: ColorFormat = \"hex\"\n): string | [number, number, number] | ColorData {\n // Validate inputs\n if (!isValidColor(colorName)) {\n throw new Error(\n `Invalid color: \"${colorName}\". Valid colors are: ${VALID_COLORS.join(\n \", \"\n )}`\n );\n }\n\n if (!isValidFormat(format)) {\n throw new Error(\n `Invalid format: \"${format}\". Valid formats are: ${VALID_FORMATS.join(\n \", \"\n )}`\n );\n }\n\n const normalizedColorCode = normalizeColorCode(colorName, colorCode);\n\n if (!tailwindMapper[colorName]) {\n throw new Error(`Color \"${colorName}\" not found in mapper`);\n }\n\n if (!tailwindMapper[colorName][normalizedColorCode]) {\n throw new Error(\n `Color code \"${normalizedColorCode}\" not found for color \"${colorName}\"`\n );\n }\n\n const colorData = tailwindMapper[colorName][normalizedColorCode];\n\n switch (format.toLowerCase()) {\n case \"hex\":\n return colorData.hex;\n case \"rgb\":\n return colorData.rgb;\n case \"hsl\":\n return colorData.hsl;\n case \"oklch\":\n return colorData.oklch;\n case \"rawrgb\":\n case \"raw_rgb\":\n return colorData.rawRgb;\n case \"rawhsl\":\n case \"raw_hsl\":\n return colorData.rawHsl;\n case \"rawoklch\":\n case \"raw_oklch\":\n return colorData.rawOklch;\n case \"all\":\n return colorData;\n default:\n throw new Error(\n `Unsupported format: ${format}. Supported formats: ${VALID_FORMATS.join(\n \", \"\n )}`\n );\n }\n}\n\n// Get all shades for a specific color\nexport function getColorShades(\n colorName: string,\n format: ColorFormat = \"hex\"\n): Record<string, string | [number, number, number] | ColorData> {\n if (!isValidColor(colorName)) {\n throw new Error(\n `Invalid color: \"${colorName}\". Valid colors are: ${VALID_COLORS.join(\n \", \"\n )}`\n );\n }\n\n if (!isValidFormat(format)) {\n throw new Error(\n `Invalid format: \"${format}\". Valid formats are: ${VALID_FORMATS.join(\n \", \"\n )}`\n );\n }\n\n if (!tailwindMapper[colorName]) {\n throw new Error(`Color \"${colorName}\" not found in mapper`);\n }\n\n const shades: Record<string, string | [number, number, number] | ColorData> =\n {};\n\n for (const [shadeCode, colorData] of Object.entries(\n tailwindMapper[colorName]\n )) {\n switch (format.toLowerCase()) {\n case \"hex\":\n shades[shadeCode] = colorData.hex;\n break;\n case \"rgb\":\n shades[shadeCode] = colorData.rgb;\n break;\n case \"hsl\":\n shades[shadeCode] = colorData.hsl;\n break;\n case \"oklch\":\n shades[shadeCode] = colorData.oklch;\n break;\n case \"rawrgb\":\n case \"raw_rgb\":\n shades[shadeCode] = colorData.rawRgb;\n break;\n case \"rawhsl\":\n case \"raw_hsl\":\n shades[shadeCode] = colorData.rawHsl;\n break;\n case \"rawoklch\":\n case \"raw_oklch\":\n shades[shadeCode] = colorData.rawOklch;\n break;\n case \"all\":\n shades[shadeCode] = colorData;\n break;\n default:\n throw new Error(`Unsupported format: ${format}`);\n }\n }\n\n return shades;\n}\n\n// Get all colors in a specific format\nexport function getAllColors(\n format: ColorFormat = \"hex\"\n): Record<\n string,\n Record<string, string | [number, number, number] | ColorData>\n> {\n if (!isValidFormat(format)) {\n throw new Error(\n `Invalid format: \"${format}\". Valid formats are: ${VALID_FORMATS.join(\n \", \"\n )}`\n );\n }\n\n const allColors: Record<\n string,\n Record<string, string | [number, number, number] | ColorData>\n > = {};\n\n for (const [colorName, colorShades] of Object.entries(tailwindMapper)) {\n allColors[colorName] = getColorShades(colorName, format);\n }\n\n return allColors;\n}\n\n// Get available color names\nexport function getAvailableColors(): string[] {\n return Object.keys(tailwindMapper);\n}\n\n// Get available shades for a specific color\nexport function getAvailableShades(colorName: string): string[] {\n if (!isValidColor(colorName)) {\n throw new Error(\n `Invalid color: \"${colorName}\". Valid colors are: ${VALID_COLORS.join(\n \", \"\n )}`\n );\n }\n\n if (!tailwindMapper[colorName]) {\n throw new Error(`Color \"${colorName}\" not found in mapper`);\n }\n\n return Object.keys(tailwindMapper[colorName]);\n}\n\n// Check if a color exists\nexport function colorExists(\n colorName: string,\n colorCode: ColorCode | null = null\n): boolean {\n if (!isValidColor(colorName)) {\n return false;\n }\n\n if (!tailwindMapper[colorName]) {\n return false;\n }\n\n if (colorCode === null) {\n return true;\n }\n\n const normalizedColorCode = normalizeColorCode(colorName, colorCode);\n return tailwindMapper[colorName][normalizedColorCode] !== undefined;\n}\n\n// Get color data in all formats\nexport function getColorData(\n colorName: string,\n colorCode: ColorCode\n): ColorData {\n if (!isValidColor(colorName)) {\n throw new Error(\n `Invalid color: \"${colorName}\". Valid colors are: ${VALID_COLORS.join(\n \", \"\n )}`\n );\n }\n\n const normalizedColorCode = normalizeColorCode(colorName, colorCode);\n\n if (!tailwindMapper[colorName]) {\n throw new Error(`Color \"${colorName}\" not found in mapper`);\n }\n\n if (!tailwindMapper[colorName][normalizedColorCode]) {\n throw new Error(\n `Color code \"${normalizedColorCode}\" not found for color \"${colorName}\"`\n );\n }\n\n return tailwindMapper[colorName][normalizedColorCode];\n}\n\n// Convert between formats (using the raw values)\nexport function convertColor(\n colorName: string,\n colorCode: ColorCode,\n fromFormat: ColorFormat,\n toFormat: ColorFormat\n): string | [number, number, number] | ColorData {\n if (!isValidFormat(fromFormat) || !isValidFormat(toFormat)) {\n throw new Error(\n `Invalid format. Valid formats are: ${VALID_FORMATS.join(\", \")}`\n );\n }\n\n const colorData = getColorData(colorName, colorCode);\n\n const formatMap: Record<\n string,\n string | [number, number, number] | ColorData\n > = {\n hex: colorData.hex,\n rgb: colorData.rgb,\n hsl: colorData.hsl,\n oklch: colorData.oklch,\n rawrgb: colorData.rawRgb,\n rawhsl: colorData.rawHsl,\n rawoklch: colorData.rawOklch,\n };\n\n if (!formatMap[toFormat.toLowerCase()]) {\n throw new Error(`Unsupported target format: ${toFormat}`);\n }\n\n return formatMap[toFormat.toLowerCase()];\n}\n\n// Search for colors by hex value (fuzzy search)\nexport function findColorByHex(\n hexValue: string,\n exact: boolean = false\n): ColorSearchResult[] {\n const results: ColorSearchResult[] = [];\n\n for (const [colorName, colorShades] of Object.entries(tailwindMapper)) {\n for (const [shadeCode, colorData] of Object.entries(colorShades)) {\n if (exact) {\n if (colorData.hex.toLowerCase() === hexValue.toLowerCase()) {\n results.push({\n colorName,\n shadeCode,\n colorData,\n });\n }\n } else {\n if (colorData.hex.toLowerCase().includes(hexValue.toLowerCase())) {\n results.push({\n colorName,\n shadeCode,\n colorData,\n });\n }\n }\n }\n }\n\n return results;\n}\n\n// Get color palette for a specific color (all shades)\nexport function getColorPalette(colorName: string): Record<string, ColorData> {\n return getColorShades(colorName, \"all\") as Record<string, ColorData>;\n}\n\n// Generate CSS custom properties for a color\nexport function generateCSSVariables(\n colorName: string,\n prefix: string = \"\"\n): CSSVariables {\n if (!isValidColor(colorName)) {\n throw new Error(\n `Invalid color: \"${colorName}\". Valid colors are: ${VALID_COLORS.join(\n \", \"\n )}`\n );\n }\n\n const shades = getColorShades(colorName, \"all\") as Record<string, ColorData>;\n const cssVars: CSSVariables = {};\n\n for (const [shadeCode, colorData] of Object.entries(shades)) {\n const varName = prefix ? `${prefix}-${shadeCode}` : shadeCode;\n cssVars[`--${varName}-hex`] = colorData.hex;\n cssVars[`--${varName}-rgb`] = colorData.rgb;\n cssVars[`--${varName}-hsl`] = colorData.hsl;\n cssVars[`--${varName}-oklch`] = colorData.oklch;\n }\n\n return cssVars;\n}\n\n// Generate Tailwind CSS config object\nexport function generateTailwindConfig(): TailwindConfig {\n const config: TailwindConfig = {};\n\n for (const [colorName, colorShades] of Object.entries(tailwindMapper)) {\n config[colorName] = {};\n for (const [shadeCode, colorData] of Object.entries(colorShades)) {\n const shade = shadeCode.split(\"-\")[1]; // Extract just the number\n config[colorName][shade] = colorData.hex;\n }\n }\n\n return config;\n}\n\n// Get statistics about the mapper\nexport function getMapperStats(): MapperStats {\n const stats: MapperStats = {\n totalColors: 0,\n totalShades: 0,\n colors: {},\n };\n\n for (const [colorName, colorShades] of Object.entries(tailwindMapper)) {\n stats.totalColors++;\n const shadeCount = Object.keys(colorShades).length;\n stats.totalShades += shadeCount;\n stats.colors[colorName] = shadeCount;\n }\n\n return stats;\n}\n\n// Export constants for external use\nexport { VALID_COLORS, VALID_FORMATS, VALID_SHADES };\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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