
ABOUT / CONTACT
INKHEAD HAT LAB
Explore the recovered catalog and imprint planner. Embroidery • Screen Print • DTF • Patches.
#ih-hat-lab-v2{--ink:#182235;--muted:#5c6b80;--line:#d8e0ea;--paper:#fff;--soft:#f3f6fa;--navy:#111a29;--orange:#ff632d;--blue:#245ca8;--front:#191d28;--back:#191d28;--bill:#191d28;font-family:Arial,Helvetica,sans-serif;color:var(--ink);max-width:1100px;margin:auto}
#ih-hat-lab-v2 *{box-sizing:border-box}
#ih-hat-lab-v2 .shell{background:var(--paper);border:1px solid var(--line);border-radius:18px;overflow:hidden;box-shadow:0 14px 36px #111a2914}
#ih-hat-lab-v2 .bar{background:var(--navy);color:#fff;padding:18px 24px;display:flex;justify-content:space-between;align-items:center;gap:10px}
#ih-hat-lab-v2 .bar strong{font-weight:900;font-size:20px;letter-spacing:.025em}#ih-hat-lab-v2 .bar b{color:var(--orange)}#ih-hat-lab-v2 .bar small{font-size:11px;letter-spacing:.12em;color:#bac9de}
#ih-hat-lab-v2 .heading{padding:25px 24px 15px}#ih-hat-lab-v2 .kicker{font-weight:900;font-size:11px;color:var(--blue);letter-spacing:.18em}#ih-hat-lab-v2 h2{font-size:29px;line-height:1.12;margin:8px 0 7px;font-weight:900}#ih-hat-lab-v2 p{margin:0;line-height:1.45;color:var(--muted);font-size:13px}
#ih-hat-lab-v2 .workspace{display:grid;grid-template-columns:minmax(0,1fr) minmax(290px,.75fr);gap:22px;padding:0 24px 24px}
#ih-hat-lab-v2 .section{border:1px solid var(--line);border-radius:14px;padding:16px;margin-bottom:15px}#ih-hat-lab-v2 .section h3{font-size:16px;margin:0 0 13px;font-weight:900}#ih-hat-lab-v2 .section small{color:var(--muted)}
#ih-hat-lab-v2 .guided{max-width:360px}#ih-hat-lab-v2 label{font-size:11px;font-weight:800;letter-spacing:.025em;display:flex;flex-direction:column;gap:5px}#ih-hat-lab-v2 input,#ih-hat-lab-v2 select{width:100%;min-width:0;min-height:40px;padding:8px 10px;border:1px solid #c8d2e0;border-radius:8px;background:var(--soft);font:inherit;font-size:13px;color:var(--ink)}#ih-hat-lab-v2 input:focus,#ih-hat-lab-v2 select:focus{outline:2px solid var(--blue);outline-offset:1px}#ih-hat-lab-v2 .guided-note{margin-top:8px!important;font-size:11px!important}
#ih-hat-lab-v2 .choice-window{margin-top:10px;padding:12px;border:1px solid var(--line);border-radius:10px;background:var(--soft)}#ih-hat-lab-v2 .choice-window[hidden]{display:none}#ih-hat-lab-v2 .choice-head{display:flex;justify-content:space-between;align-items:center;gap:10px;font-size:13px;margin-bottom:10px}#ih-hat-lab-v2 .choice-close{border:0;background:transparent;color:var(--blue);font:inherit;font-size:12px;padding:5px}#ih-hat-lab-v2 .choice-list{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:7px}#ih-hat-lab-v2 .choice{border:1px solid var(--line);background:var(--paper);color:var(--ink);border-radius:7px;padding:10px;text-align:left;font:inherit;font-size:12px;min-height:44px}#ih-hat-lab-v2 .choice:hover{border-color:var(--blue)}
#ih-hat-lab-v2 .active-filters{display:flex;flex-wrap:wrap;gap:6px;margin-top:10px}#ih-hat-lab-v2 .filter-chip,#ih-hat-lab-v2 .clear-filters{border:1px solid var(--line);border-radius:20px;padding:6px 10px;background:#eaf0f7;color:var(--ink);font:inherit;font-size:11px;min-height:32px}#ih-hat-lab-v2 .clear-filters{background:transparent;text-decoration:underline;border-color:transparent}
#ih-hat-lab-v2 .results-head{display:flex;justify-content:space-between;align-items:baseline;margin:16px 0 8px;gap:12px}#ih-hat-lab-v2 .results-head b{font-size:12px}#ih-hat-lab-v2 .results{display:grid;grid-template-columns:1fr 1fr;gap:8px;max-height:230px;overflow:auto}#ih-hat-lab-v2 .item{border:1px solid var(--line);background:var(--soft);color:var(--ink);border-radius:9px;text-align:left;padding:10px;cursor:pointer;min-height:68px}#ih-hat-lab-v2 .item[aria-pressed="true"]{border:2px solid var(--orange);background:#fff4ef;padding:9px}#ih-hat-lab-v2 .item strong{font-size:13px;display:block}#ih-hat-lab-v2 .item span{font-size:11px;color:var(--muted)}#ih-hat-lab-v2 .empty{grid-column:1/-1;background:#fff8f2;padding:13px;border-radius:8px;font-size:12px}
#ih-hat-lab-v2 .color-row{display:flex;align-items:center;gap:9px;margin:13px 0 7px}#ih-hat-lab-v2 .pair{width:36px;height:36px;border:1px solid #9daabc;border-radius:50%;background:linear-gradient(90deg,var(--a) 50%,var(--b) 50%);flex:none}#ih-hat-lab-v2 .selected-detail{font-size:11px;color:var(--muted);line-height:1.4}
#ih-hat-lab-v2 .imprint{border:1px solid var(--line);border-radius:9px;padding:10px;margin-top:9px}#ih-hat-lab-v2 .imprint-title{font-weight:900;font-size:12px;margin-bottom:8px;color:var(--blue)}#ih-hat-lab-v2 .imprint-fields{display:grid;grid-template-columns:1fr 1fr;gap:7px}#ih-hat-lab-v2 .imprint-fields .full{grid-column:1/-1}#ih-hat-lab-v2 .small-note{font-size:11px;color:var(--muted);line-height:1.4;margin-top:11px}
#ih-hat-lab-v2 .preview{background:#eaf0f7;min-height:366px;border-radius:14px;position:relative;display:flex;align-items:center;justify-content:center;overflow:hidden}#ih-hat-lab-v2 .preview:before{content:"";position:absolute;width:420px;height:160px;border-radius:50%;background:#d8e3f0;bottom:-91px}#ih-hat-lab-v2 .hat{height:270px;width:330px;position:relative;transform:translateY(17px)}#ih-hat-lab-v2 .crown{position:absolute;left:34px;top:17px;width:262px;height:187px;background:linear-gradient(90deg,var(--front) 0 55%,var(--back) 55%);border-radius:48% 48% 15% 15% / 60% 60% 14% 14%;border:2px solid #0002;box-shadow:inset -20px -10px 30px #0002,inset 12px 6px 23px #fff2,0 10px 20px #0002;overflow:hidden}#ih-hat-lab-v2 .crown:before{content:"";position:absolute;left:50%;top:6px;height:171px;border-left:2px solid #ffffff55}#ih-hat-lab-v2 .hat.five .crown:before{display:none}#ih-hat-lab-v2 .bill{position:absolute;left:7px;top:180px;width:316px;height:77px;background:var(--bill);border-radius:12% 12% 54% 54% / 20% 20% 95% 95%;transform:perspective(220px) rotateX(24deg);box-shadow:inset 0 10px 14px #fff2,inset 0 -12px 20px #0004,0 12px 14px #0002;border:2px solid #0002}#ih-hat-lab-v2 .hat.rope .bill:before{content:"";position:absolute;left:16px;right:16px;top:2px;border-top:5px solid #e7e8e4;border-radius:50%}#ih-hat-lab-v2 .hat.bucket .crown{top:41px;height:146px;left:59px;width:212px;border-radius:37% 37% 9% 9% / 25% 25% 9% 9%}#ih-hat-lab-v2 .hat.bucket .bill{top:176px;left:13px;width:304px;height:72px;border-radius:15% 15% 50% 50%}#ih-hat-lab-v2 .hat.visor .crown{top:91px;height:90px;border-radius:48% 48% 12% 12%;background:var(--front)}#ih-hat-lab-v2 .hat.visor .bill{top:169px}#ih-hat-lab-v2 .art{position:absolute;z-index:2;left:69px;top:98px;width:192px;height:64px;display:flex;justify-content:center;align-items:center;text-align:center;font-weight:900;font-size:23px;color:#fff;line-height:1.1;word-break:break-word;text-shadow:0 1px 2px #0008;overflow:hidden}#ih-hat-lab-v2 .art.patch{background:#ffffff22;border:2px solid currentColor;border-radius:7px;font-size:17px}#ih-hat-lab-v2 .art.ink{font-size:20px}#ih-hat-lab-v2 .hat.visor .art{top:111px;font-size:16px;height:42px}#ih-hat-lab-v2 .hat.bucket .art{top:92px;font-size:18px}#ih-hat-lab-v2 .badge{position:absolute;bottom:12px;left:12px;background:#142035;color:#fff;padding:7px 9px;font-size:10px;font-weight:800;border-radius:5px}
#ih-hat-lab-v2 .views{display:grid;grid-template-columns:repeat(4,1fr);gap:5px;margin:0 0 9px}#ih-hat-lab-v2 .view-button{min-height:40px;border:1px solid var(--line);border-radius:7px;background:var(--soft);color:var(--ink);font:inherit;font-size:11px}#ih-hat-lab-v2 .view-button[aria-pressed="true"]{background:var(--navy);color:#fff;border-color:var(--navy)}
#ih-hat-lab-v2 .hat.view-left .crown,#ih-hat-lab-v2 .hat.view-right .crown{left:29px;top:49px;width:247px;height:157px;border-radius:58% 35% 15% 17% / 64% 62% 13% 15%;background:linear-gradient(90deg,var(--back) 0 40%,var(--front) 40%)}
#ih-hat-lab-v2 .hat.view-left .bill,#ih-hat-lab-v2 .hat.view-right .bill{left:218px;top:175px;width:110px;height:61px;border-radius:10% 74% 68% 28% / 19% 45% 56% 23%;transform:rotate(-4deg)}
#ih-hat-lab-v2 .hat.view-left .crown:before,#ih-hat-lab-v2 .hat.view-right .crown:before{left:42%;height:140px}
#ih-hat-lab-v2 .hat.view-right{transform:translateY(17px) scaleX(-1)}#ih-hat-lab-v2 .hat.view-right .mark{transform:scaleX(-1)}
#ih-hat-lab-v2 .hat.view-back .crown{background:var(--back)}#ih-hat-lab-v2 .hat.view-back .bill{display:none}#ih-hat-lab-v2 .hat.view-back .crown:before{display:none}
#ih-hat-lab-v2 .opening{display:none;position:absolute;z-index:2;left:110px;top:159px;width:110px;height:53px;border-radius:55% 55% 12% 12% / 92% 92% 10% 10%;background:#1e2631;border:5px solid var(--back);box-shadow:inset 0 4px 8px #0005}#ih-hat-lab-v2 .hat.view-back .opening{display:block}#ih-hat-lab-v2 .hat.bucket.view-back .opening{display:none}#ih-hat-lab-v2 .hat.visor.view-back .opening{top:135px}
#ih-hat-lab-v2 .safe-zone{position:absolute;z-index:2;border:2px dashed #ffffffa8;border-radius:8px;box-shadow:0 0 0 1px #18223555;pointer-events:none}#ih-hat-lab-v2 .safe-zone:after{content:"PREVIEW SAFE AREA";position:absolute;left:0;bottom:-18px;font-size:8px;white-space:nowrap;color:#fff;text-shadow:0 1px 3px #000}
#ih-hat-lab-v2 .marks{position:absolute;inset:0;z-index:3;pointer-events:none}#ih-hat-lab-v2 .mark{position:absolute;left:88px;width:154px;height:34px;display:flex;align-items:center;justify-content:center;text-align:center;padding:2px 5px;font-size:15px;font-weight:900;line-height:1.05;color:#fff;text-shadow:0 1px 2px #0008;overflow:hidden;word-break:break-word}#ih-hat-lab-v2 .mark.patch{border:2px solid currentColor;border-radius:5px;background:#ffffff20;font-size:13px}#ih-hat-lab-v2 .mark.embroidery{font-style:italic}#ih-hat-lab-v2 .hat.view-left .mark,#ih-hat-lab-v2 .hat.view-right .mark{left:123px;width:105px;font-size:11px}#ih-hat-lab-v2 .hat.view-back .mark{left:95px;width:140px;font-size:12px}#ih-hat-lab-v2 .hat.visor .mark{height:27px;font-size:11px}#ih-hat-lab-v2 .hat.bucket .mark{font-size:12px}
#ih-hat-lab-v2 .size-note{font-size:11px;color:var(--muted);line-height:1.4;margin-top:9px}#ih-hat-lab-v2 .size-alert{color:#aa381e;font-weight:800}
@media(max-width:790px){#ih-hat-lab-v2 .hat.view-right{transform:translateY(22px) scale(-.85,.85)}}
#ih-hat-lab-v2 .chosen{padding:15px 2px 6px}#ih-hat-lab-v2 .chosen h3{margin:0 0 5px;font-size:17px}#ih-hat-lab-v2 .summary{font-size:12px;color:var(--muted);line-height:1.55;margin-top:8px}#ih-hat-lab-v2 .location-list{display:flex;flex-direction:column;gap:5px;margin-top:12px}#ih-hat-lab-v2 .location-list div{background:var(--soft);border-left:3px solid var(--orange);padding:8px 10px;border-radius:3px;font-size:11px}#ih-hat-lab-v2 .foot{background:var(--navy);color:#cbd5e5;padding:13px 24px;font-size:11px;line-height:1.45}#ih-hat-lab-v2 .foot b{color:var(--orange)}
@media(max-width:790px){#ih-hat-lab-v2 .workspace{grid-template-columns:1fr}#ih-hat-lab-v2 .preview-col{grid-row:1}#ih-hat-lab-v2 .preview{min-height:300px}#ih-hat-lab-v2 .hat{transform:translateY(22px) scale(.85)}}
@media(max-width:420px){#ih-hat-lab-v2 .results{grid-template-columns:1fr}#ih-hat-lab-v2 .bar,#ih-hat-lab-v2 .heading,#ih-hat-lab-v2 .workspace,#ih-hat-lab-v2 .foot{padding-left:15px;padding-right:15px}#ih-hat-lab-v2 h2{font-size:25px}}
Start with the right blank.
Search by brand or style number, narrow by fit and colorway, then plan up to three imprint locations.
1 · Find a hat
Choose another search category to narrow the results further.
2 · Plan artwork locations
Location 1 is ready. Add a second or third only if you need it.
ILLUSTRATIVE RENDER · NOT A PRODUCT PHOTO
Selected hat
(()=>{
const root=document.getElementById('ih-hat-lab-v2');
const $=s=>root.querySelector(s);
const hats=[
{brand:'Richardson',style:'112',name:'Trucker',closure:'snapback',type:'6',rope:false,colors:[
'Amber Gold','Black','Charcoal','Coffee','Columbia Blue','Cream','Dark Green','Kelly','Light Blue','Light Grey','Loden','Maroon','Navy','Orange','Quarry','Red','Royal','Smoke Blue','White',
'Biscuit/True Blue','Black/Charcoal','Black/Gold','Black/Vegas Gold','Black/White','Brown/Dk Khaki','Caramel/Black','Cardinal/Black','Cardinal/White','Charcoal/Black','Charcoal/Columbia Blue','Charcoal/Kelly','Charcoal/Navy','Charcoal/Neon Blue','Charcoal/Neon Green','Charcoal/Neon Orange','Charcoal/Neon Pink','Charcoal/Neon Yellow','Charcoal/Orange','Charcoal/Red','Charcoal/Royal','Charcoal/White','Chocolate Chip/Birch','Columbia Blue/White','Cyan/White','Dark Green/White','Heather Grey/Black','Heather Grey/Dark Green','Heather Grey/Light Grey','Heather Grey/Navy','Heather Grey/Royal','Heather Grey/White','Hot Pink/Black','Hot Pink/White','Kelly/White','Khaki/Coffee','Khaki/White','Loden/Black','Maroon/White','Navy/Caramel','Navy/Charcoal','Navy/Dk Khaki','Navy/Orange','Navy/White','Orange/Black','Orange/White','Purple/White','Red/Black','Red/White','Royal/Black','Royal/White',
'Black/Grey','Brown/Khaki','Gunmetal/Chocolate Chip','Khaki/Black','Khaki/Chocolate Chip','Khaki/Legion Blue','Khaki/Loden','Khaki/Navy','Light Blue/Light Grey','Light Grey/Gunmetal','Navy/Khaki','White/Black','White/Charcoal','White/Columbia Blue','White/Kelly','White/Navy','White/Red','White/Royal',
'Black/White/Heather Grey','Black/White/Red','Blue Teal/Birch/Navy','Columbia Blue/White/Navy','Cream/Black/Loden','Cream/Grey Brown/Brown','Cream/Navy/Amber Gold','Grey/Charcoal/Black','Grey/Charcoal/Navy','Heather Grey/Birch/Amber Gold','Heather Grey/Birch/Army Olive','Heather Grey/Cardinal/Navy','Heather Grey/Charcoal/Dark Orange','Heather Grey/Charcoal/Maroon','Heather Grey/Red/Black','Mink Beige/Charcoal/Amber Gold','Navy/White/Heather Grey','Navy/White/Red','Orange/White/Black','Red/White/Black','Red/White/Heather Grey','Red/White/Navy','Royal/White/Heather Grey','Royal/White/Red','White/Aluminum/Black','White/Aluminum/Navy','White/Columbia Blue/Yellow'
],source:'https://richardsonsports.com/product/112-trucker-hat'},
{brand:'Richardson',style:'112FP',name:'Five Panel Trucker',closure:'snapback',type:'5',rope:false,colors:['Black','Navy','White','Black/White','Charcoal/White','Navy/White','Army Olive/Tan','Heather Grey/Black'],source:'https://richardsonsports.com/product/112fp-five-panel-trucker-hat'},
{brand:'Richardson',style:'112FPR',name:'Five Panel Trucker with Rope',closure:'snapback',type:'5',rope:true,colors:['Black-White','Navy-White','White-Black','Columbia Blue-Navy','Black/Charcoal-Charcoal','Loden/Black-Black'],source:'https://richardsonsports.com/product/112fpr-five-panel-trucker-hat-with-rope'},
{brand:'Richardson',style:'225',name:'Casual Performance Lite',closure:'hook-loop',type:'6',rope:false,colors:['Black','Navy','White','Charcoal','Red','Dark Green','Charcoal/White'],source:'https://richardsonsports.com/product/225-casual-performance-lite-hat'},
{brand:'Richardson',style:'PTS65',name:'Surge Fitted',closure:'fitted',type:'6',rope:false,colors:['Black','Maroon','Navy','Red','Royal'],source:'https://richardsonsports.com/product/pts65-surge-fitted-hat'},
{brand:'Richardson',style:'160',name:'Lite Performance Visor',closure:'hook-loop',type:'visor',rope:false,colors:['Black','Charcoal','Navy','White'],source:'https://richardsonsports.com/product/160-lite-performance-visor'},
{brand:'Port Authority',style:'PWSH2',name:'Bucket Hat',closure:'none',type:'bucket',rope:false,colors:['Black','Khaki','Navy','Red','Royal','White'],source:'https://www.sanmar.com/p/7677_White/specSheetMeasurements'},
{brand:'Port Authority',style:'C937',name:'Flexfit 110 Foam Outdoor',closure:'buckle',type:'5',rope:false,colors:['Army Green/Black','Black/Black','Graphite/Black'],source:'https://www.sanmar.com/p/9435_BlkBlk/specSheetMeasurements'},
{brand:'OGIO',style:'OE653',name:'Stride Mesh Cap',closure:'buckle',type:'5',rope:false,colors:['Blacktop','White'],source:'https://www.sanmar.com/p/7277_White/specSheetMeasurements'}
];
const hex={'black':'#191d28','blacktop':'#191d28','white':'#edf0f3','navy':'#193965','charcoal':'#4c525c','grey':'#989da2','heather grey':'#9ea4aa','red':'#bb2b38','royal':'#2352a3','loden':'#6c7655','orange':'#ef7936','dark green':'#245441','army green':'#53674a','khaki':'#c8b688','tan':'#c6b68e','gold':'#d5a73b','graphite':'#444950','columbia blue':'#72a6cf','true blue':'#3575b6'};
const saved={};
const state={selected:saved.selected||'112',color:saved.color||'Black/White',view:['front','left','right','back'].includes(saved.view)?saved.view:'front',filters:saved.filters||{},imprints:saved.imprints||[{location:'front',method:'embroidery',size:'medium',text:''},{location:'none',method:'embroidery',size:'small',text:''},{location:'none',method:'embroidery',size:'small',text:''}]};
state.imprints=[0,1,2].map(n=>({location:n===0?'front':'none',method:'embroidery',size:n===0?'medium':'small',text:'',...(state.imprints[n]||{})}));
const occupied=new Set();for(const imprint of state.imprints){if(imprint.location==='none')continue;if(occupied.has(imprint.location))imprint.location='none';else occupied.add(imprint.location)}
const categories={brand:{label:'Brand',options:[['Richardson','Richardson'],['Port Authority','Port Authority'],['OGIO','OGIO']]},style:{label:'Style number',options:hats.map(h=>[h.style,`${h.brand} ${h.style}`])},closure:{label:'Closure',options:[['snapback','Snapback'],['hook-loop','Hook-and-loop (Velcro-style)'],['buckle','Buckle'],['fitted','Fitted'],['none','No closure']]},type:{label:'Hat type',options:[['5','5 panel'],['6','6 panel'],['bucket','Bucket'],['visor','Visor']]},family:{label:'Color',options:['Black','Navy','White','Red','Green','Khaki','Grey'].map(c=>[c,c])},rope:{label:'Rope front',options:[['yes','Yes'],['no','No']]}};
const searchBy=$('#ih-search-by');let openCategory='';
function colorPart(name){const key=name.trim().toLowerCase();return hex[key]||Object.entries(hex).find(([k])=>key.includes(k))?.[1]||'#84909e'}
function parts(name){const bits=name.split(/[\/-]/);return [colorPart(bits[0]),colorPart(bits[1]||bits[0])]}
function familyMatch(name,fam){if(!fam)return true;const n=name.toLowerCase(),f=fam.toLowerCase();if(f==='green')return /green|loden|olive|kelly/.test(n);if(f==='grey')return /grey|gray|charcoal|graphite/.test(n);return n.includes(f)}
function safeArea(h,view){if(h.type==='visor')return view==='front'?{x:88,y:111,w:154,h:42}:view==='back'?{x:98,y:114,w:134,h:37}:{x:118,y:123,w:96,h:35};if(h.type==='bucket')return view==='front'?{x:86,y:82,w:158,h:88}:view==='back'?{x:89,y:84,w:152,h:82}:{x:115,y:91,w:112,h:77};return view==='front'?{x:76,y:73,w:178,h:102}:view==='back'?{x:90,y:78,w:150,h:74}:{x:117,y:86,w:108,h:91}}
function maxSize(h,location){return location==='front'&&h.type!=='visor'&&h.type!=='bucket'?'large':'medium'}
function contrast(hexColor){const n=Number.parseInt(hexColor.slice(1),16),r=(n>>16)&255,g=(n>>8)&255,b=n&255;return .2126*r+.7152*g+.0722*b>150?'#182235':'#fff'}
function matching(){const f=state.filters;return hats.filter(h=>(!f.brand||h.brand===f.brand)&&(!f.style||h.style===f.style)&&(!f.closure||h.closure===f.closure)&&(!f.type||h.type===f.type)&&(!f.rope||(h.rope?'yes':'no')===f.rope)&&h.colors.some(c=>familyMatch(c,f.family)))}
function save(){}
function render(){
searchBy.value=openCategory;const window=$('#ih-choice-window'),choices=$('#ih-choices');window.hidden=!openCategory;choices.replaceChildren();
if(openCategory){const category=categories[openCategory];$('#ih-choice-title').textContent=`Choose ${category.label.toLowerCase()}`;for(const [value,label] of category.options){const button=document.createElement('button');button.type='button';button.className='choice cursor-interaction';button.textContent=label;button.setAttribute('aria-pressed',String(state.filters[openCategory]===value));button.addEventListener('click',()=>{state.filters[openCategory]=value;openCategory='';render();save();searchBy.focus()});choices.append(button)}}
const active=$('#ih-active-filters');active.replaceChildren();for(const [key,value] of Object.entries(state.filters)){if(!value||!categories[key])continue;const match=categories[key].options.find(([v])=>v===value);const chip=document.createElement('button');chip.type='button';chip.className='filter-chip cursor-interaction';chip.textContent=`${categories[key].label}: ${match?.[1]||value} ×`;chip.setAttribute('aria-label',`Remove ${categories[key].label} filter ${match?.[1]||value}`);chip.addEventListener('click',()=>{delete state.filters[key];render();save()});active.append(chip)}if(active.childElementCount){const clear=document.createElement('button');clear.type='button';clear.className='clear-filters cursor-interaction';clear.textContent='Clear all';clear.addEventListener('click',()=>{state.filters={};render();save()});active.append(clear)}
const matches=matching(),results=$('#ih-results');results.replaceChildren();$('#ih-count').textContent=`${matches.length} sample style${matches.length===1?'':'s'}`;
if(!matches.length){const empty=document.createElement('div');empty.className='empty';empty.textContent='No sample style matches all filters. Clear one filter to see more.';results.append(empty)}
if(matches.length&&!matches.some(h=>h.style===state.selected)){state.selected=matches[0].style;state.color=matches[0].colors.find(c=>familyMatch(c,state.filters.family))||matches[0].colors[0]}
for(const h of matches){const b=document.createElement('button');b.type='button';b.className='item cursor-interaction';b.setAttribute('aria-pressed',String(h.style===state.selected));const title=document.createElement('strong');title.textContent=`${h.brand} ${h.style}`;const sub=document.createElement('span');sub.textContent=`${h.name} · ${h.type==='bucket'||h.type==='visor'?h.type:h.type+' panel'}`;b.append(title,sub);b.addEventListener('click',()=>{state.selected=h.style;state.color=h.colors.find(c=>familyMatch(c,state.filters.family))||h.colors[0];render();save()});results.append(b)}
if(!matches.length){$('#ih-hat').style.display='none';$('#ih-chosen-name').textContent='No matching blank';$('#ih-chosen-meta').textContent='Remove a filter to see a hat.';$('#ih-chosen-color').textContent='';$('#ih-style-detail').textContent='';$('#ih-colorway').replaceChildren();$('#ih-colorway').disabled=true;$('#ih-location-list').replaceChildren();root.querySelectorAll('.view-button').forEach(b=>b.disabled=true);return}
$('#ih-hat').style.display='block';
const h=hats.find(x=>x.style===state.selected)||hats[0],available=h.colors.filter(c=>familyMatch(c,state.filters.family));if(!available.includes(state.color))state.color=available[0]||h.colors[0];
const colors=$('#ih-colorway');colors.replaceChildren();for(const c of available){const o=document.createElement('option');o.textContent=c;o.value=c;colors.append(o)}colors.value=state.color;colors.disabled=!matches.length;
const [a,b]=parts(state.color);root.style.setProperty('--front',a);root.style.setProperty('--back',b);root.style.setProperty('--bill',a);$('#ih-color-chip').style.setProperty('--a',a);$('#ih-color-chip').style.setProperty('--b',b);
const shape=h.type==='bucket'?'bucket':h.type==='visor'?'visor':h.type==='5'?'five':'six';$('#ih-hat').className=`hat ${shape} view-${state.view}${h.rope?' rope':''}`;
$('#ih-chosen-name').textContent=`${h.brand} ${h.style} · ${h.name}`;$('#ih-chosen-meta').textContent=`${h.type==='bucket'||h.type==='visor'?h.type.toUpperCase():h.type+' PANEL'} · ${h.closure==='hook-loop'?'HOOK-AND-LOOP':h.closure.toUpperCase().replace('-',' ')}${h.rope?' · ROPE FRONT':''}`;$('#ih-chosen-color').textContent=`Colorway: ${state.color}${h.closure==='fitted'?' · size must be selected before quote':''}`;$('#ih-style-detail').textContent=`Example colorways for ${h.brand} ${h.style}. Color names are style-specific; not every color is offered on every blank.`;
root.querySelectorAll('.view-button').forEach(button=>{button.disabled=false;button.setAttribute('aria-pressed',String(button.dataset.view===state.view))});
const area=safeArea(h,state.view),zone=$('#ih-safe-zone');for(const [key,value] of Object.entries({left:area.x,top:area.y,width:area.w,height:area.h}))zone.style[key]=`${value}px`;
const marks=$('#ih-marks');marks.replaceChildren();const guardrail=[];
for(const [n,i] of state.imprints.entries()){
if(i.location==='none')continue;
if(!['small','medium','large'].includes(i.size))i.size='medium';
if(i.size==='large'&&maxSize(h,i.location)!=='large'){i.size='medium';guardrail.push(`Location ${n+1} was reduced to Medium for this hat area.`)}
if(i.location!==state.view)continue;
const factor={small:.43,medium:.65,large:.88}[i.size];const width=Math.round(area.w*factor),height=Math.min(Math.round(area.h*factor),i.size==='large'?56:i.size==='medium'?43:32);
const mark=document.createElement('div');mark.className=`mark ${i.method}`;mark.textContent=i.text.trim()||`ART ${n+1}`;mark.style.left=`${Math.round(area.x+(area.w-width)/2)}px`;mark.style.top=`${Math.round(area.y+(area.h-height)/2)}px`;mark.style.width=`${width}px`;mark.style.height=`${height}px`;mark.style.fontSize=`${Math.max(9,Math.min(19,Math.floor(width/Math.max(5,mark.textContent.length*.62))))}px`;mark.style.color=contrast(state.view==='back'?b:state.view==='front'?a:b);mark.setAttribute('aria-label',`Imprint ${n+1}, ${i.size} ${i.method}`);marks.append(mark)
}
const note=$('#ih-size-note');note.textContent=guardrail.length?guardrail.join(' '):'Preview safety limits: Large is available only on cap fronts. Exact artwork limits must come from the selected supplier style and decoration method.';note.classList.toggle('size-alert',guardrail.length>0);
const list=$('#ih-location-list');list.replaceChildren();state.imprints.forEach((i,n)=>{if(i.location==='none')return;const d=document.createElement('div');d.textContent=`Location ${n+1}: ${i.location} · ${i.size} ${i.method}${i.text.trim()?` · “${i.text.trim()}”`:' · artwork to be supplied'}`;list.append(d)});$('#ih-preview').setAttribute('aria-label',`Illustrative ${state.color} ${h.brand} ${h.style} ${state.view} view with ${marks.childElementCount} imprint area`);
for(let n=1;n{openCategory=searchBy.value;render();if(openCategory)$('#ih-choices button')?.focus()});$('#ih-choice-close').addEventListener('click',()=>{openCategory='';render();searchBy.focus()});$('#ih-colorway').addEventListener('change',e=>{state.color=e.target.value;render();save()});
root.querySelectorAll('.view-button').forEach(button=>button.addEventListener('click',()=>{state.view=button.dataset.view;render();save()}));
for(let n=1;n{const value=e.target.value;if(key==='location'&&value!=='none'&&state.imprints.some((imprint,index)=>index!==n-1&&imprint.location===value)){render();const note=$('#ih-size-note');note.textContent=`${value} already has an imprint. Choose a different placement so the artwork does not overlap.`;note.classList.add('size-alert');return}state.imprints[n-1][key]=value;if(state.imprints[n-1].location!=='none')state.view=state.imprints[n-1].location;render();save()})}}
render();
})();
Design your concept
This local editor saves files on your computer. V7 pricing, approved vendor templates, cloud artwork and orders are not connected.
