export interface ColorMapping { hex: string | string[]; isGradient?: boolean; } export const bambuLabColors: Record = { 'Alpine Green Sparkle': { hex: '#2E7D32' }, 'Apple Green': { hex: '#C6E188' }, 'Arctic Whisper': { hex: '#E0EFF6' }, 'Ash Grey': { hex: '#9B9EA0' }, 'Aurora Purple': { hex: ['#7F3696', '#006EC9'], isGradient: true }, 'Azure': { hex: '#489FDF' }, 'Baby Blue': { hex: '#89CFF0' }, 'Bambu Green': { hex: '#00AE42' }, 'Beige': { hex: '#F7E6DE' }, 'Black': { hex: '#1A1A1A' }, 'Black Walnut': { hex: '#3E2723' }, 'Blaze': { hex: '#FF5722' }, 'Blue': { hex: '#0A2989' }, 'Blue Grey': { hex: '#7B8E97' }, 'Blue Hawaii': { hex: '#00C5CD' }, 'Blueberry Bubblegum': { hex: '#7C4DFF' }, 'Bone White': { hex: '#C8C5B6' }, 'Bright Green': { hex: '#5EC323' }, 'Brick Red': { hex: '#9F332A' }, 'Bronze': { hex: '#847D48' }, 'Brown': { hex: '#9D432C' }, 'Burgundy Red': { hex: '#800020' }, 'Candy Green': { hex: '#66CDAA' }, 'Candy Red': { hex: '#E8505B' }, 'Caramel': { hex: '#A4845C' }, 'Champagne': { hex: '#F7E7CE' }, 'Charcoal': { hex: '#000000' }, 'Cherry Pink': { hex: '#DE3163' }, 'Chocolate': { hex: '#4A3729' }, 'Classic Birch': { hex: '#D7C49E' }, 'Classic Gold Sparkle': { hex: '#CFB53B' }, 'Clay Brown': { hex: '#B08968' }, 'Clear': { hex: '#F0F0F0' }, 'Clear Black': { hex: '#2C2C2C' }, 'Cobalt Blue': { hex: '#0047AB' }, 'Cobalt Blue Metallic': { hex: '#0047AB' }, 'Cocoa Brown': { hex: '#6B4332' }, 'Copper Brown Metallic': { hex: '#B87333' }, 'Cotton Candy Cloud': { hex: '#F8BBD0' }, 'Cream': { hex: '#F5E6C8' }, 'Crimson Red Sparkle': { hex: '#B71C1C' }, 'Cyan': { hex: '#0086D6' }, 'Dark Blue': { hex: '#042F56' }, 'Dark Brown': { hex: '#7D6556' }, 'Dark Chocolate': { hex: '#4A3729' }, 'Dark Gray': { hex: '#515151' }, 'Dark Green': { hex: '#68724D' }, 'Dark Red': { hex: '#BB3D43' }, 'Dawn Radiance': { hex: '#FFDAB9' }, 'Desert Tan': { hex: '#E8DBB7' }, 'Dusk Glare': { hex: '#FF7043' }, 'Forest Green': { hex: '#39541A' }, 'Frozen': { hex: '#E0F7FA' }, 'Gilded Rose': { hex: '#B76E79' }, 'Glow Blue': { hex: '#5DADE2' }, 'Glow Green': { hex: '#82E0AA' }, 'Glow Orange': { hex: '#FFB347' }, 'Glow Pink': { hex: '#FF69B4' }, 'Glow Yellow': { hex: '#FFEB3B' }, 'Gold': { hex: '#E4BD68' }, 'Gray': { hex: '#8E9089' }, 'Green': { hex: '#00AE42' }, 'Hot Pink': { hex: '#FF4F81' }, 'Ice Blue': { hex: '#A5DEE4' }, 'Indigo Blue': { hex: '#324585' }, 'Indigo Purple': { hex: '#3B2D6B' }, 'Iridium Gold Metallic': { hex: '#C5A04D' }, 'Iris Purple': { hex: '#5B3A8C' }, 'Iron Gray Metallic': { hex: '#6E6E6E' }, 'Jade White': { hex: '#FFFFFF' }, 'Jeans Blue': { hex: '#4A6FA5' }, 'Lake Blue': { hex: '#1F79E5' }, 'Latte Brown': { hex: '#D3B7A7' }, 'Lava Gray': { hex: '#5B5B5B' }, 'Lavender': { hex: '#B39DDB' }, 'Lemon Yellow': { hex: '#F7D959' }, 'Light Blue': { hex: '#61B0FF' }, 'Light Cyan': { hex: '#B2EBF2' }, 'Light Gray': { hex: '#C8C8C8' }, 'Light Jade': { hex: '#C8E6C9' }, 'Lilac Purple': { hex: '#AE96D4' }, 'Lime': { hex: '#76FF03' }, 'Lime Green': { hex: '#7EC845' }, 'Magenta': { hex: '#EC008C' }, 'Malachite Green': { hex: '#0BDA51' }, 'Mandarin Orange': { hex: '#F99963' }, 'Marine Blue': { hex: '#0078BF' }, 'Maroon Red': { hex: '#7B2D34' }, 'Matcha Green': { hex: '#7B9B5B' }, 'Mellow Yellow': { hex: '#F8E875' }, 'Midnight Blaze': { hex: '#2C1654' }, 'Mint': { hex: '#98FFB0' }, 'Mint Lime': { hex: '#A5D6A7' }, 'Mistletoe Green': { hex: '#3F8E43' }, 'Nardo Gray': { hex: '#747474' }, 'Navy Blue': { hex: '#0C2340' }, 'Nebulae': { hex: '#4A148C' }, 'Neon City': { hex: '#39FF14' }, 'Neon Green': { hex: '#76FF03' }, 'Neon Orange': { hex: '#FF6D00' }, 'Ochre Yellow': { hex: '#CC7722' }, 'Ocean to Meadow': { hex: '#4DB6AC' }, 'Olive': { hex: '#748C45' }, 'Onyx Black Sparkle': { hex: '#1A1A1A' }, 'Orange': { hex: '#FF6A13' }, 'Oxide Green Metallic': { hex: '#4A6741' }, 'Peanut Brown': { hex: '#A0724A' }, 'Pink': { hex: '#F55A74' }, 'Pink Citrus': { hex: '#FF8A65' }, 'Plum': { hex: '#851A52' }, 'Pumpkin Orange': { hex: '#E87530' }, 'Purple': { hex: '#5E43B7' }, 'Red': { hex: '#C12E1F' }, 'Red Granite': { hex: '#A0522D' }, 'Rose Gold': { hex: '#B76E79' }, 'Rosewood': { hex: '#65000B' }, 'Royal Blue': { hex: '#002FA7' }, 'Royal Purple Sparkle': { hex: '#6A1B9A' }, 'Sakura Pink': { hex: '#E8AFCF' }, 'Scarlet Red': { hex: '#DE4343' }, 'Silver': { hex: '#A6A9AA' }, 'Sky Blue': { hex: '#73B2E5' }, 'Slate Gray Sparkle': { hex: '#708090' }, 'Solar Breeze': { hex: '#FFD54F' }, 'South Beach': { hex: '#00BCD4' }, 'Sunflower Yellow': { hex: '#FEC600' }, 'Tangerine Yellow': { hex: '#FFC72C' }, 'Teal': { hex: '#009FA1' }, 'Terracotta': { hex: '#A25A37' }, 'Titan Gray': { hex: '#8A8D8F' }, 'Transparent': { hex: '#E8E8E8' }, 'Turquoise': { hex: '#00B1B7' }, 'Velvet Eclipse': { hex: '#3B0A45' }, 'Violet Purple': { hex: '#583061' }, 'White': { hex: '#FFFFFF' }, 'White Marble': { hex: '#E8E8E8' }, 'White Oak': { hex: '#C8B88A' }, 'Yellow': { hex: '#F4EE2A' }, // ABS Colors 'ABS Azure': { hex: '#3B7DD8' }, 'ABS Olive': { hex: '#6B7339' }, 'ABS Blue': { hex: '#1A3C8F' }, 'ABS Tangerine Yellow': { hex: '#FFBF00' }, 'ABS Navy Blue': { hex: '#1B2A4A' }, 'ABS Orange': { hex: '#F57C20' }, 'ABS Bambu Green': { hex: '#00AE42' }, 'ABS Red': { hex: '#C0392B' }, 'ABS White': { hex: '#FFFFFF' }, 'ABS Black': { hex: '#1A1A1A' }, 'ABS Silver': { hex: '#B0B0B0' }, // PETG Translucent Colors 'Translucent Gray': { hex: '#A9A9A9' }, 'Translucent Brown': { hex: '#8B4513' }, 'Translucent Purple': { hex: '#800080' }, 'Translucent Orange': { hex: '#FF8C00' }, 'Translucent Olive': { hex: '#808000' }, 'Translucent Pink': { hex: '#FFB6C1' }, 'Translucent Light Blue': { hex: '#ADD8E6' }, 'Translucent Teal': { hex: '#008B8B' }, // PLA Matte Colors 'Matte Ivory White': { hex: '#FFFFFF' }, 'Matte Charcoal': { hex: '#3C3C3C' }, 'Matte Scarlet Red': { hex: '#DE4343' }, 'Matte Marine Blue': { hex: '#0078BF' }, 'Matte Mandarin Orange': { hex: '#F99963' }, 'Matte Ash Gray': { hex: '#9B9EA0' }, 'Matte Desert Tan': { hex: '#E8DBB7' }, 'Matte Nardo Gray': { hex: '#6E6E6E' }, 'Matte Apple Green': { hex: '#8DB600' }, 'Matte Bone White': { hex: '#CBC6B8' }, 'Matte Caramel': { hex: '#AE835B' }, 'Matte Dark Blue': { hex: '#1B3A5C' }, 'Matte Dark Brown': { hex: '#7D6556' }, 'Matte Dark Chocolate': { hex: '#4D3324' }, 'Matte Dark Green': { hex: '#68724D' }, 'Matte Dark Red': { hex: '#8B1A1A' }, 'Matte Grass Green': { hex: '#61C680' }, 'Matte Ice Blue': { hex: '#A3D8E1' }, 'Matte Lemon Yellow': { hex: '#F7D959' }, 'Matte Lilac Purple': { hex: '#AE96D4' }, 'Matte Plum': { hex: '#7D3F6B' }, 'Matte Sakura Pink': { hex: '#E8AFCF' }, 'Matte Sky Blue': { hex: '#7EB6D9' }, 'Matte Latte Brown': { hex: '#D3B7A7' }, 'Matte Terracotta': { hex: '#B15533' }, // PLA Silk Multi-Color 'Phantom Blue': { hex: ['#00629B', '#000000'], isGradient: true }, 'Mystic Magenta': { hex: ['#720062', '#3A913F'], isGradient: true }, // TPU Colors 'Flesh': { hex: '#FFCCB0' }, 'Grape Jelly': { hex: '#6A0DAD' }, 'Crystal Blue': { hex: '#68B8E8' }, 'Quicksilver': { hex: '#A6A6A6' } }; export function getFilamentColor(colorName: string): ColorMapping { // First try exact match if (bambuLabColors[colorName]) { return bambuLabColors[colorName]; } // Try case-insensitive match const lowerColorName = colorName.toLowerCase(); const match = Object.keys(bambuLabColors).find( key => key.toLowerCase() === lowerColorName ); if (match) { return bambuLabColors[match]; } // Try partial match (e.g., "PLA Red" matches "Red") const partialMatch = Object.keys(bambuLabColors).find( key => colorName.includes(key) || key.includes(colorName) ); if (partialMatch) { return bambuLabColors[partialMatch]; } // Return default unknown color return { hex: '#CCCCCC' }; } export function getColorStyle(colorMapping: ColorMapping): React.CSSProperties { if (colorMapping.isGradient && Array.isArray(colorMapping.hex)) { return { background: `linear-gradient(90deg, ${colorMapping.hex[0]} 0%, ${colorMapping.hex[1]} 100%)` }; } return { backgroundColor: Array.isArray(colorMapping.hex) ? colorMapping.hex[0] : colorMapping.hex }; }