[{"data":1,"prerenderedAt":2524},["ShallowReactive",2],{"api-blog-how-to-extract-design-tokens-from-any-website-in-python":3,"api-blog-related-how-to-extract-design-tokens-from-any-website-in-python":784},{"id":4,"title":5,"author":6,"body":7,"category":756,"date":757,"dateModified":758,"description":759,"extension":760,"faqs":761,"image":758,"meta":771,"navigation":91,"path":772,"readingTime":119,"relatedSlugs":773,"seo":777,"stem":778,"tags":779,"__hash__":783},"apiBlog/api-blog/how-to-extract-design-tokens-from-any-website-in-python.md","How to Extract Design Tokens from Any Website in Python","Soraia",{"type":8,"value":9,"toc":740},"minimark",[10,19,22,27,30,66,69,270,273,281,296,300,303,342,345,349,352,393,397,400,464,468,555,562,566,569,609,639,652,656,666,670,675,678,682,695,699,702,706,709,713,736],[11,12,13,14,18],"p",{},"The fastest way to extract design tokens from a website in Python is Playwright plus ",[15,16,17],"code",{},"getComputedStyle()",": load the page in a real browser, collect the computed styles of every element, and count what repeats. The counting is the important part. A site's design system is whatever it uses everywhere, not every value that appears once in a forgotten footer.",[11,20,21],{},"Parsing CSS files without a browser is the approach most tutorials suggest, and it is the one that works worst on modern sites. More on that below.",[23,24,26],"h2",{"id":25},"extract-colors-with-playwright","Extract colors with Playwright",[11,28,29],{},"First, install Playwright and a browser:",[31,32,37],"pre",{"className":33,"code":34,"language":35,"meta":36,"style":36},"language-bash shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","pip install playwright\nplaywright install chromium\n","bash","",[15,38,39,55],{"__ignoreMap":36},[40,41,44,48,52],"span",{"class":42,"line":43},"line",1,[40,45,47],{"class":46},"sBMFI","pip",[40,49,51],{"class":50},"sfazB"," install",[40,53,54],{"class":50}," playwright\n",[40,56,58,61,63],{"class":42,"line":57},2,[40,59,60],{"class":46},"playwright",[40,62,51],{"class":50},[40,64,65],{"class":50}," chromium\n",[11,67,68],{},"Then collect styles from every element and count them:",[31,70,74],{"className":71,"code":72,"language":73,"meta":36,"style":36},"language-python shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","from collections import Counter\nfrom playwright.sync_api import sync_playwright\n\nCOLLECT = \"\"\"\n() => {\n  const els = [...document.querySelectorAll('body *')].slice(0, 5000);\n  const out = { colors: [], fonts: [], sizes: [], radii: [], shadows: [] };\n  for (const el of els) {\n    const s = getComputedStyle(el);\n    out.colors.push(s.color, s.backgroundColor, s.borderTopColor);\n    out.fonts.push(s.fontFamily);\n    out.sizes.push(s.fontSize);\n    out.radii.push(s.borderTopLeftRadius);\n    out.shadows.push(s.boxShadow);\n  }\n  return out;\n}\n\"\"\"\n\ndef top(values, n=8, skip=(\"\", \"none\", \"normal\", \"auto\", \"0px\", \"rgba(0, 0, 0, 0)\")):\n    return Counter(v for v in values if v not in skip).most_common(n)\n\nwith sync_playwright() as p:\n    browser = p.chromium.launch()\n    page = browser.new_page(viewport={\"width\": 1440, \"height\": 900})\n    page.goto(\"https://stripe.com\", wait_until=\"networkidle\")\n    raw = page.evaluate(COLLECT)\n    browser.close()\n\nfor name in (\"colors\", \"fonts\", \"sizes\", \"radii\", \"shadows\"):\n    print(f\"\\n== {name} ==\")\n    for value, count in top(raw[name]):\n        print(f\"{count:>5}  {value}\")\n","python",[15,75,76,81,86,93,99,105,111,117,123,129,135,141,147,153,159,165,171,177,183,188,194,200,205,211,217,223,229,235,241,246,252,258,264],{"__ignoreMap":36},[40,77,78],{"class":42,"line":43},[40,79,80],{},"from collections import Counter\n",[40,82,83],{"class":42,"line":57},[40,84,85],{},"from playwright.sync_api import sync_playwright\n",[40,87,89],{"class":42,"line":88},3,[40,90,92],{"emptyLinePlaceholder":91},true,"\n",[40,94,96],{"class":42,"line":95},4,[40,97,98],{},"COLLECT = \"\"\"\n",[40,100,102],{"class":42,"line":101},5,[40,103,104],{},"() => {\n",[40,106,108],{"class":42,"line":107},6,[40,109,110],{},"  const els = [...document.querySelectorAll('body *')].slice(0, 5000);\n",[40,112,114],{"class":42,"line":113},7,[40,115,116],{},"  const out = { colors: [], fonts: [], sizes: [], radii: [], shadows: [] };\n",[40,118,120],{"class":42,"line":119},8,[40,121,122],{},"  for (const el of els) {\n",[40,124,126],{"class":42,"line":125},9,[40,127,128],{},"    const s = getComputedStyle(el);\n",[40,130,132],{"class":42,"line":131},10,[40,133,134],{},"    out.colors.push(s.color, s.backgroundColor, s.borderTopColor);\n",[40,136,138],{"class":42,"line":137},11,[40,139,140],{},"    out.fonts.push(s.fontFamily);\n",[40,142,144],{"class":42,"line":143},12,[40,145,146],{},"    out.sizes.push(s.fontSize);\n",[40,148,150],{"class":42,"line":149},13,[40,151,152],{},"    out.radii.push(s.borderTopLeftRadius);\n",[40,154,156],{"class":42,"line":155},14,[40,157,158],{},"    out.shadows.push(s.boxShadow);\n",[40,160,162],{"class":42,"line":161},15,[40,163,164],{},"  }\n",[40,166,168],{"class":42,"line":167},16,[40,169,170],{},"  return out;\n",[40,172,174],{"class":42,"line":173},17,[40,175,176],{},"}\n",[40,178,180],{"class":42,"line":179},18,[40,181,182],{},"\"\"\"\n",[40,184,186],{"class":42,"line":185},19,[40,187,92],{"emptyLinePlaceholder":91},[40,189,191],{"class":42,"line":190},20,[40,192,193],{},"def top(values, n=8, skip=(\"\", \"none\", \"normal\", \"auto\", \"0px\", \"rgba(0, 0, 0, 0)\")):\n",[40,195,197],{"class":42,"line":196},21,[40,198,199],{},"    return Counter(v for v in values if v not in skip).most_common(n)\n",[40,201,203],{"class":42,"line":202},22,[40,204,92],{"emptyLinePlaceholder":91},[40,206,208],{"class":42,"line":207},23,[40,209,210],{},"with sync_playwright() as p:\n",[40,212,214],{"class":42,"line":213},24,[40,215,216],{},"    browser = p.chromium.launch()\n",[40,218,220],{"class":42,"line":219},25,[40,221,222],{},"    page = browser.new_page(viewport={\"width\": 1440, \"height\": 900})\n",[40,224,226],{"class":42,"line":225},26,[40,227,228],{},"    page.goto(\"https://stripe.com\", wait_until=\"networkidle\")\n",[40,230,232],{"class":42,"line":231},27,[40,233,234],{},"    raw = page.evaluate(COLLECT)\n",[40,236,238],{"class":42,"line":237},28,[40,239,240],{},"    browser.close()\n",[40,242,244],{"class":42,"line":243},29,[40,245,92],{"emptyLinePlaceholder":91},[40,247,249],{"class":42,"line":248},30,[40,250,251],{},"for name in (\"colors\", \"fonts\", \"sizes\", \"radii\", \"shadows\"):\n",[40,253,255],{"class":42,"line":254},31,[40,256,257],{},"    print(f\"\\n== {name} ==\")\n",[40,259,261],{"class":42,"line":260},32,[40,262,263],{},"    for value, count in top(raw[name]):\n",[40,265,267],{"class":42,"line":266},33,[40,268,269],{},"        print(f\"{count:>5}  {value}\")\n",[11,271,272],{},"Run it and you get something like:",[31,274,279],{"className":275,"code":277,"language":278},[276],"language-text","== colors ==\n 3021  rgb(255, 255, 255)\n 1204  rgb(26, 27, 37)\n  412  rgb(99, 91, 255)\n  118  rgb(66, 84, 102)\n","text",[15,280,277],{"__ignoreMap":36},[11,282,283,284,287,288,291,292,295],{},"That third line is the brand color, found by nothing smarter than counting. ",[15,285,286],{},"getComputedStyle"," has already done the hard work for you: it resolved every CSS variable chain, every ",[15,289,290],{},"var(--a, var(--b))"," fallback, every cascade conflict, and turned Tailwind utility soup into plain ",[15,293,294],{},"rgb()"," values.",[23,297,299],{"id":298},"fonts-and-the-type-scale","Fonts and the type scale",[11,301,302],{},"The same collection already has them. Font families come back as full stacks, so take the first entry:",[31,304,306],{"className":71,"code":305,"language":73,"meta":36,"style":36},"families = Counter(f.split(\",\")[0].strip('\"\\' ') for f in raw[\"fonts\"])\nprint(families.most_common(5))\n\nsizes = sorted(\n    {float(s.replace(\"px\", \"\")) for s, c in top(raw[\"sizes\"], n=20)},\n)\nprint(sizes)  # e.g. [12.0, 14.0, 16.0, 18.0, 20.0, 24.0, 36.0, 56.0]\n",[15,307,308,313,318,322,327,332,337],{"__ignoreMap":36},[40,309,310],{"class":42,"line":43},[40,311,312],{},"families = Counter(f.split(\",\")[0].strip('\"\\' ') for f in raw[\"fonts\"])\n",[40,314,315],{"class":42,"line":57},[40,316,317],{},"print(families.most_common(5))\n",[40,319,320],{"class":42,"line":88},[40,321,92],{"emptyLinePlaceholder":91},[40,323,324],{"class":42,"line":95},[40,325,326],{},"sizes = sorted(\n",[40,328,329],{"class":42,"line":101},[40,330,331],{},"    {float(s.replace(\"px\", \"\")) for s, c in top(raw[\"sizes\"], n=20)},\n",[40,333,334],{"class":42,"line":107},[40,335,336],{},")\n",[40,338,339],{"class":42,"line":113},[40,340,341],{},"print(sizes)  # e.g. [12.0, 14.0, 16.0, 18.0, 20.0, 24.0, 36.0, 56.0]\n",[11,343,344],{},"That sorted list is the site's type scale. If it has fifteen entries instead of seven, you are looking at a site without a design system, which is also useful to know.",[23,346,348],{"id":347},"from-raw-values-to-actual-tokens","From raw values to actual tokens",[11,350,351],{},"Raw counts are not tokens yet. Three cleanup steps matter:",[353,354,355,367,380],"ol",{},[356,357,358,362,363,366],"li",{},[359,360,361],"strong",{},"Drop the defaults."," ",[15,364,365],{},"rgb(0, 0, 0)"," near the top does not mean the brand is black. Browser resets and inherited defaults pollute every element, so check whether a value actually appears on visible, styled elements before promoting it.",[356,368,369,362,372,375,376,379],{},[359,370,371],{},"Merge near-duplicates.",[15,373,374],{},"rgb(99, 91, 255)"," and ",[15,377,378],{},"rgb(99, 92, 255)"," are the same token with a rounding disagreement. Snap channels to a small tolerance before counting, or you will split one token's count across five entries.",[356,381,382,385,386,389,390,392],{},[359,383,384],{},"Name by role, not by value."," The most frequent saturated color on buttons and links is ",[15,387,388],{},"primary",". The dominant text color is ",[15,391,278],{},". Frequency plus element context gets you there; k-means clustering is overkill for this and I would skip it.",[23,394,396],{"id":395},"common-problems","Common problems",[11,398,399],{},"Real gotchas, in the order they will bite you:",[401,402,403,413,419,436,450],"ul",{},[356,404,405,408,409,412],{},[359,406,407],{},"Your viewport is a filter."," Computed styles reflect the current viewport only. A ",[15,410,411],{},"@media (max-width: 640px)"," override is invisible at 1440px. Extract at two viewports (mobile and desktop) if you care about responsive tokens.",[356,414,415,418],{},[359,416,417],{},"Cookie banners poison the palette."," Consent overlays and chat widgets bring their own colors and fonts, and they are often thousands of DOM nodes. Dismiss them or exclude their containers before collecting.",[356,420,421,362,424,427,428,431,432,435],{},[359,422,423],{},"Fonts can lie.",[15,425,426],{},"font-family"," lists what CSS asked for, not what loaded. With ",[15,429,430],{},"font-display: swap"," the brand font may never arrive in a headless run. Await ",[15,433,434],{},"document.fonts.ready"," before collecting if exact loaded fonts matter.",[356,437,438,445,446,449],{},[359,439,440,441,444],{},"Gradients are not in ",[15,442,443],{},"backgroundColor","."," They live in ",[15,447,448],{},"backgroundImage",". If a brand is gradient-heavy, collect that property too or you will report their hero as plain white.",[356,451,452,455,456,459,460,463],{},[359,453,454],{},"Shadow DOM and iframes are invisible"," to ",[15,457,458],{},"querySelectorAll",". Web-component-heavy sites need you to walk ",[15,461,462],{},"shadowRoot","s explicitly.",[23,465,467],{"id":466},"diy-vs-parsing-css-vs-an-api","DIY vs parsing CSS vs an API",[469,470,471,496],"table",{},[472,473,474],"thead",{},[475,476,477,481,484,487,490,493],"tr",{},[478,479,480],"th",{},"Approach",[478,482,483],{},"Tailwind / utility CSS",[478,485,486],{},"Runtime CSS-in-JS",[478,488,489],{},"Resolves var() and cascade",[478,491,492],{},"Media queries",[478,494,495],{},"Maintenance",[497,498,499,518,537],"tbody",{},[475,500,501,505,508,510,512,515],{},[502,503,504],"td",{},"Playwright + computed styles (this guide)",[502,506,507],{},"Yes",[502,509,507],{},[502,511,507],{},[502,513,514],{},"Current viewport only",[502,516,517],{},"Browser infra is yours to run",[475,519,520,523,526,529,531,534],{},[502,521,522],{},"Parse CSS files yourself (tinycss2, no browser)",[502,524,525],{},"Painful",[502,527,528],{},"No",[502,530,528],{},[502,532,533],{},"Declared, but unused values included",[502,535,536],{},"Low, but wrong on modern sites",[475,538,539,542,544,547,549,552],{},[502,540,541],{},"MiroMiro extract API",[502,543,507],{},[502,545,546],{},"No (static HTML + CSS, no JS execution)",[502,548,507],{},[502,550,551],{},"Yes, all declared breakpoints",[502,553,554],{},"None",[11,556,557,558,561],{},"Use the Playwright approach if you are extracting from a handful of sites, need runtime-injected styles, and want full control. Skip the hand-rolled CSS-parsing route: resolving the cascade, specificity, and nested ",[15,559,560],{},"var()"," fallbacks yourself is a project, not a script.",[23,563,565],{"id":564},"or-use-one-api-call","Or use one API call",[11,567,568],{},"The dedupe, the ranking, the var() chains, the resets, and every declared breakpoint - that is what our extract endpoint does for a living:",[31,570,572],{"className":33,"code":571,"language":35,"meta":36,"style":36},"curl \"https://miromiro.app/api/v1/extract?url=stripe.com\" \\\n  -H \"Authorization: Bearer $MIROMIRO_API_KEY\"\n",[15,573,574,593],{"__ignoreMap":36},[40,575,576,579,583,586,589],{"class":42,"line":43},[40,577,578],{"class":46},"curl",[40,580,582],{"class":581},"sMK4o"," \"",[40,584,585],{"class":50},"https://miromiro.app/api/v1/extract?url=stripe.com",[40,587,588],{"class":581},"\"",[40,590,592],{"class":591},"sTEyZ"," \\\n",[40,594,595,598,600,603,606],{"class":42,"line":57},[40,596,597],{"class":50},"  -H",[40,599,582],{"class":581},[40,601,602],{"class":50},"Authorization: Bearer ",[40,604,605],{"class":591},"$MIROMIRO_API_KEY",[40,607,608],{"class":581},"\"\n",[11,610,611,612,615,616,615,619,615,622,615,625,615,628,615,631,634,635,638],{},"The JSON response has ",[15,613,614],{},"colors",", ",[15,617,618],{},"fontFamilies",[15,620,621],{},"fontSizes",[15,623,624],{},"fontWeights",[15,626,627],{},"spacing",[15,629,630],{},"borderRadiuses",[15,632,633],{},"boxShadows",", and more, already deduped and ranked. Trim it with ",[15,636,637],{},"?fields=colors,spacing"," if you only need part of it.",[11,640,641,642,647,648,444],{},"If your script from this guide breaks on some site's cookie banner at 2am, that is roughly the moment an API earns its keep. You can ",[643,644,646],"a",{"href":645},"/api/dashboard/keys","get a free API key"," with 100 credits a month, no card, or try it without signing up in the ",[643,649,651],{"href":650},"/api/demo","playground",[23,653,655],{"id":654},"summary","Summary",[11,657,658,659,661,662,665],{},"Playwright plus ",[15,660,286],{}," plus a ",[15,663,664],{},"Counter"," is the honest way to extract design tokens in Python, and the frequency counting matters more than any clever clustering. Parse-the-CSS approaches are not worth your time on modern sites. I hope this saved you a debugging evening.",[23,667,669],{"id":668},"frequently-asked-questions","Frequently asked questions",[671,672,674],"h3",{"id":673},"can-i-extract-design-tokens-without-a-headless-browser","Can I extract design tokens without a headless browser?",[11,676,677],{},"You can parse the site's CSS with a library like tinycss2, but on modern sites this works badly: CSS-in-JS generates styles at runtime, Tailwind buries the palette in utility classes, and you cannot tell which declared values are actually used. Computed styles from a real browser are the ground truth.",[671,679,681],{"id":680},"how-do-i-extract-tokens-from-a-tailwind-site-where-everything-is-utility-classes","How do I extract tokens from a Tailwind site where everything is utility classes?",[11,683,684,685,687,688,455,691,694],{},"Ignore the class names entirely and read computed styles. ",[15,686,286],{}," resolves ",[15,689,690],{},"bg-indigo-600",[15,692,693],{},"rgb(79, 70, 229)"," like any other CSS, so nothing in this guide changes.",[671,696,698],{"id":697},"why-do-my-extracted-colors-include-values-the-site-never-visibly-uses","Why do my extracted colors include values the site never visibly uses?",[11,700,701],{},"Three usual suspects: browser defaults on elements you collected, cookie banners and chat widgets injecting their own palette, and transparent or inherited values you forgot to filter.",[671,703,705],{"id":704},"how-many-pages-should-i-sample","How many pages should I sample?",[11,707,708],{},"One landing page is usually enough for brand color and typography. Add one product or app page for functional colors (success, error, info). More than three pages rarely changes the top tokens.",[23,710,712],{"id":711},"related-reading","Related reading",[401,714,715,722,729],{},[356,716,717,721],{},[643,718,720],{"href":719},"/api/design-tokens-api","Design tokens API"," - the endpoint this post's shortcut uses",[356,723,724,728],{},[643,725,727],{"href":726},"/api/docs/design-tokens","Design tokens docs"," - full response shape and field list",[356,730,731,735],{},[643,732,734],{"href":733},"/api/use-cases/ai-agent-ground-truth","Ground truth for AI agents"," - why agents need real tokens instead of guessing from screenshots",[737,738,739],"style",{},"html pre.shiki code .sBMFI, html code.shiki .sBMFI{--shiki-light:#E2931D;--shiki-default:#FFCB6B;--shiki-dark:#FFCB6B}html pre.shiki code .sfazB, html code.shiki .sfazB{--shiki-light:#91B859;--shiki-default:#C3E88D;--shiki-dark:#C3E88D}html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html pre.shiki code .sMK4o, html code.shiki .sMK4o{--shiki-light:#39ADB5;--shiki-default:#89DDFF;--shiki-dark:#89DDFF}html pre.shiki code .sTEyZ, html code.shiki .sTEyZ{--shiki-light:#90A4AE;--shiki-default:#EEFFFF;--shiki-dark:#BABED8}",{"title":36,"searchDepth":57,"depth":57,"links":741},[742,743,744,745,746,747,748,749,755],{"id":25,"depth":57,"text":26},{"id":298,"depth":57,"text":299},{"id":347,"depth":57,"text":348},{"id":395,"depth":57,"text":396},{"id":466,"depth":57,"text":467},{"id":564,"depth":57,"text":565},{"id":654,"depth":57,"text":655},{"id":668,"depth":57,"text":669,"children":750},[751,752,753,754],{"id":673,"depth":88,"text":674},{"id":680,"depth":88,"text":681},{"id":697,"depth":88,"text":698},{"id":704,"depth":88,"text":705},{"id":711,"depth":57,"text":712},"Tutorials","2026-07-18",null,"Extract colors, fonts, spacing, and shadows from any website with Playwright in Python - working code, the gotchas that bite, and the one-API-call shortcut.","md",[762,764,766,768],{"question":674,"answer":763},"You can parse the site's CSS files with a library like tinycss2, but on modern sites this works badly. CSS-in-JS generates styles at runtime, utility-class sites like Tailwind bury the palette in thousands of class rules, and you cannot tell which declared values are actually used. Computed styles from a real browser are the ground truth.",{"question":681,"answer":765},"Ignore the class names entirely and read computed styles. getComputedStyle resolves bg-indigo-600 to rgb(79, 70, 229) the same way it resolves any other CSS, so the frequency-counting approach in this guide works unchanged.",{"question":698,"answer":767},"Three usual suspects: browser default styles on elements you collected, cookie banners and chat widgets injecting their own palette, and transparent or inherited values you forgot to filter. Count frequency, filter defaults, and dismiss overlays before collecting.",{"question":769,"answer":770},"How many pages should I sample to get a reliable palette?","One page is usually enough for brand color and typography if it is the homepage or a landing page. Add one product or app page for the functional palette (success, error, info states). More than three pages rarely changes the top tokens.",{},"/api-blog/how-to-extract-design-tokens-from-any-website-in-python",[774,775,776],"best-design-token-extraction-tools-2026","design-token-types-reference","how-to-extract-website-color-palette-programmatically",{"title":5,"description":759},"api-blog/how-to-extract-design-tokens-from-any-website-in-python",[780,73,60,781,782],"design tokens","css","web extraction","L5qnHk0I6Xw2LZ4KpLx52C6CU18QlatcV45aNNbr8F0",[785,1224,1822],{"id":786,"title":787,"author":6,"body":788,"category":1198,"date":757,"dateModified":758,"description":1199,"extension":760,"faqs":1200,"image":758,"meta":1212,"navigation":91,"path":1213,"readingTime":113,"relatedSlugs":1214,"seo":1217,"stem":1218,"tags":1219,"__hash__":1223},"apiBlog/api-blog/best-design-token-extraction-tools-2026.md","Best Design Token Extraction Tools in 2026",{"type":8,"value":789,"toc":1182},[790,793,797,806,826,830,838,855,859,867,884,888,897,914,918,926,943,947,950,980,1000,1004,1118,1122,1131,1133,1137,1140,1144,1158,1162,1168,1172,1179],[11,791,792],{},"There are six honest ways to get design tokens out of a live website in 2026, and the right one depends on whether you are doing this once, weekly, or inside a product. Here is the list, with the tradeoffs stated plainly. Yes, our own API is on it - ranked where I would rank it if it were not ours.",[23,794,796],{"id":795},"_1-css-stats-fastest-free-look","1. CSS Stats - fastest free look",[11,798,799,805],{},[643,800,804],{"href":801,"rel":802},"https://cssstats.com",[803],"nofollow","cssstats.com"," has been the \"paste a URL, see the CSS\" tool for a decade. It reports every color, font size, and font family the stylesheet declares, plus specificity graphs nobody asks for but everyone screenshots.",[401,807,808,814,820],{},[356,809,810,813],{},[359,811,812],{},"Good:"," free, no signup, instant.",[356,815,816,819],{},[359,817,818],{},"Bad:"," it reads declared CSS, not used CSS. A site shipping a big framework stylesheet reports hundreds of colors that never render. There is no export worth automating against.",[356,821,822,825],{},[359,823,824],{},"Use it when:"," you want a two-minute overview of a site's CSS health, not a token set.",[23,827,829],{"id":828},"_2-project-wallace-the-analyzer-that-kept-evolving","2. Project Wallace - the analyzer that kept evolving",[11,831,832,837],{},[643,833,836],{"href":834,"rel":835},"https://www.projectwallace.com",[803],"Project Wallace"," does what CSS Stats does but deeper: color counts, typography breakdowns, and change tracking over time if you create an account.",[401,839,840,845,850],{},[356,841,842,844],{},[359,843,812],{}," the most thorough free CSS analysis on the web, actively maintained.",[356,846,847,849],{},[359,848,818],{}," same fundamental limit - declared, not rendered. Still a report you read, not a token file you use.",[356,851,852,854],{},[359,853,824],{}," auditing your own CSS over time, or studying how a site's stylesheet is put together.",[23,856,858],{"id":857},"_3-superposition-tokens-on-your-desktop","3. Superposition - tokens on your desktop",[11,860,861,866],{},[643,862,865],{"href":863,"rel":864},"https://superposition.design",[803],"Superposition"," is a desktop app that crawls a page and exports design tokens to CSS variables, Sass, JS, and even Adobe XD. It was ahead of its time.",[401,868,869,874,879],{},[356,870,871,873],{},[359,872,812],{}," genuine token export formats, one-click, offline app.",[356,875,876,878],{},[359,877,818],{}," desktop-only, so there is nothing to call from code or CI. Development has been quiet for a while - check that the export you need still works.",[356,880,881,883],{},[359,882,824],{}," you are a designer who wants tokens from a reference site without touching a terminal.",[23,885,887],{"id":886},"_4-a-diy-playwright-script-full-control","4. A DIY Playwright script - full control",[11,889,890,891,893,894,444],{},"Load the page in a headless browser, read ",[15,892,286],{}," off every element, count what repeats. We wrote the complete walkthrough in ",[643,895,5],{"href":896},"/api/blog/how-to-extract-design-tokens-from-any-website-in-python",[401,898,899,904,909],{},[356,900,901,903],{},[359,902,812],{}," free, sees exactly what renders (including runtime CSS-in-JS), infinitely customizable.",[356,905,906,908],{},[359,907,818],{}," you now run browser infrastructure. Cookie banners, lazy fonts, and viewport-dependent styles are your problem, and the script that worked in April breaks in July.",[356,910,911,913],{},[359,912,824],{}," one-off extractions, research, or when you need something no tool exposes.",[23,915,917],{"id":916},"_5-miromiro-browser-extension-point-and-click","5. MiroMiro browser extension - point and click",[11,919,920,921,925],{},"Our ",[643,922,924],{"href":923},"/features/design-tokens","extension"," shows a site's tokens live as you browse: colors, typography, spacing, assets. Click an element, see its resolved styles, export what you want.",[401,927,928,933,938],{},[356,929,930,932],{},[359,931,812],{}," zero setup, visual, great for picking tokens from a specific component rather than the whole page.",[356,934,935,937],{},[359,936,818],{}," it is a human tool. Nothing to automate, no JSON endpoint, and it extracts what you look at, not a thousand URLs.",[356,939,940,942],{},[359,941,824],{}," hand-picking design decisions from reference sites during design or build.",[23,944,946],{"id":945},"_6-miromiro-extract-api-tokens-as-an-endpoint","6. MiroMiro extract API - tokens as an endpoint",[11,948,949],{},"One GET request returns the ranked token set as JSON, CSS variables, or a Tailwind theme block:",[31,951,953],{"className":33,"code":952,"language":35,"meta":36,"style":36},"curl \"https://miromiro.app/api/v1/extract?url=stripe.com&format=tailwind\" \\\n  -H \"Authorization: Bearer $MIROMIRO_API_KEY\"\n",[15,954,955,968],{"__ignoreMap":36},[40,956,957,959,961,964,966],{"class":42,"line":43},[40,958,578],{"class":46},[40,960,582],{"class":581},[40,962,963],{"class":50},"https://miromiro.app/api/v1/extract?url=stripe.com&format=tailwind",[40,965,588],{"class":581},[40,967,592],{"class":591},[40,969,970,972,974,976,978],{"class":42,"line":57},[40,971,597],{"class":50},[40,973,582],{"class":581},[40,975,602],{"class":50},[40,977,605],{"class":591},[40,979,608],{"class":581},[401,981,982,990,995],{},[356,983,984,986,987,989],{},[359,985,812],{}," deduped and ranked (not raw declared values), covers colors, type scale, spacing, radii, shadows, gradients, and motion, resolves ",[15,988,560],{}," chains and every declared breakpoint. It is the only option on this list you can put inside a product.",[356,991,992,994],{},[359,993,818],{}," it parses static HTML + CSS and does not execute JavaScript, so a fully client-rendered app can come back thin. Costs credits past the free 100 a month.",[356,996,997,999],{},[359,998,824],{}," tokens need to arrive programmatically - agent pipelines, onboarding flows, bulk analysis.",[23,1001,1003],{"id":1002},"the-comparison-in-one-table","The comparison in one table",[469,1005,1006,1025],{},[472,1007,1008],{},[475,1009,1010,1013,1016,1019,1022],{},[478,1011,1012],{},"Tool",[478,1014,1015],{},"Output",[478,1017,1018],{},"Rendered or declared?",[478,1020,1021],{},"Automatable",[478,1023,1024],{},"Price",[497,1026,1027,1043,1058,1072,1088,1102],{},[475,1028,1029,1032,1035,1038,1040],{},[502,1030,1031],{},"CSS Stats",[502,1033,1034],{},"Web report",[502,1036,1037],{},"Declared",[502,1039,528],{},[502,1041,1042],{},"Free",[475,1044,1045,1047,1050,1052,1055],{},[502,1046,836],{},[502,1048,1049],{},"Web report + tracking",[502,1051,1037],{},[502,1053,1054],{},"Partially",[502,1056,1057],{},"Free tier",[475,1059,1060,1062,1065,1068,1070],{},[502,1061,865],{},[502,1063,1064],{},"Token files (CSS/Sass/JS)",[502,1066,1067],{},"Rendered",[502,1069,528],{},[502,1071,1042],{},[475,1073,1074,1077,1080,1082,1085],{},[502,1075,1076],{},"DIY Playwright",[502,1078,1079],{},"Whatever you build",[502,1081,1067],{},[502,1083,1084],{},"Yes, you maintain it",[502,1086,1087],{},"Your time",[475,1089,1090,1093,1096,1098,1100],{},[502,1091,1092],{},"MiroMiro extension",[502,1094,1095],{},"Visual + export",[502,1097,1067],{},[502,1099,528],{},[502,1101,1057],{},[475,1103,1104,1107,1110,1113,1115],{},[502,1105,1106],{},"MiroMiro API",[502,1108,1109],{},"JSON / CSS vars / Tailwind",[502,1111,1112],{},"Parsed + resolved",[502,1114,507],{},[502,1116,1117],{},"100 credits/mo free, then from €19/mo",[23,1119,1121],{"id":1120},"the-verdict","The verdict",[11,1123,1124,1125,1127,1128,1130],{},"For a quick look, Project Wallace. For hand-picking from a reference site, the extension. For anything that runs on a schedule or inside a product, the API - and I would say that even if it were someone else's, because it is the only entry here that returns a token file over HTTP. You can ",[643,1126,646],{"href":645}," (100 credits a month, no card) or poke it in the ",[643,1129,651],{"href":650}," first.",[23,1132,669],{"id":668},[671,1134,1136],{"id":1135},"what-is-the-fastest-free-way-to-extract-design-tokens-from-a-website","What is the fastest free way to extract design tokens from a website?",[11,1138,1139],{},"Paste the URL into CSS Stats or Project Wallace. Seconds, no signup. Expect raw declared values, not a cleaned token set.",[671,1141,1143],{"id":1142},"can-i-get-tokens-as-css-variables-or-a-tailwind-config-directly","Can I get tokens as CSS variables or a Tailwind config directly?",[11,1145,1146,1147,1150,1151,1154,1155,444],{},"Yes - ",[15,1148,1149],{},"format=css"," returns custom properties, ",[15,1152,1153],{},"format=tailwind"," returns a theme block. Details in the ",[643,1156,1157],{"href":726},"design tokens docs",[671,1159,1161],{"id":1160},"do-these-tools-work-on-tailwind-sites","Do these tools work on Tailwind sites?",[11,1163,1164,1165,1167],{},"The ones reading real CSS or computed styles do; ",[15,1166,690],{}," is just CSS once shipped. Tools that only look for CSS custom properties miss most of a Tailwind site's system.",[671,1169,1171],{"id":1170},"what-is-the-difference-between-a-token-set-and-a-color-palette","What is the difference between a token set and a color palette?",[11,1173,1174,1175,444],{},"A palette is one token group. A full token set adds the type scale, spacing, radii, shadows, motion, and z-index layers - see the ",[643,1176,1178],{"href":1177},"/api/blog/design-token-types-reference","design token types reference",[737,1180,1181],{},"html pre.shiki code .sBMFI, html code.shiki .sBMFI{--shiki-light:#E2931D;--shiki-default:#FFCB6B;--shiki-dark:#FFCB6B}html pre.shiki code .sMK4o, html code.shiki .sMK4o{--shiki-light:#39ADB5;--shiki-default:#89DDFF;--shiki-dark:#89DDFF}html pre.shiki code .sfazB, html code.shiki .sfazB{--shiki-light:#91B859;--shiki-default:#C3E88D;--shiki-dark:#C3E88D}html pre.shiki code .sTEyZ, html code.shiki .sTEyZ{--shiki-light:#90A4AE;--shiki-default:#EEFFFF;--shiki-dark:#BABED8}html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"title":36,"searchDepth":57,"depth":57,"links":1183},[1184,1185,1186,1187,1188,1189,1190,1191,1192],{"id":795,"depth":57,"text":796},{"id":828,"depth":57,"text":829},{"id":857,"depth":57,"text":858},{"id":886,"depth":57,"text":887},{"id":916,"depth":57,"text":917},{"id":945,"depth":57,"text":946},{"id":1002,"depth":57,"text":1003},{"id":1120,"depth":57,"text":1121},{"id":668,"depth":57,"text":669,"children":1193},[1194,1195,1196,1197],{"id":1135,"depth":88,"text":1136},{"id":1142,"depth":88,"text":1143},{"id":1160,"depth":88,"text":1161},{"id":1170,"depth":88,"text":1171},"Comparisons","Six real ways to pull design tokens from a live website in 2026 - free analyzers, a DIY script, a browser extension, and an API - honestly ranked.",[1201,1203,1206,1209],{"question":1136,"answer":1202},"Paste the URL into a CSS analyzer like CSS Stats or Project Wallace. You get colors, font sizes, and specificity data in seconds with no signup. The output is raw declared values rather than a cleaned token set, so expect to filter it by hand.",{"question":1204,"answer":1205},"Can I get design tokens as CSS variables or a Tailwind config directly?","Yes. The MiroMiro extract endpoint takes format=css to return CSS custom properties or format=tailwind to return a theme config block, so the tokens drop straight into a codebase without a conversion step.",{"question":1207,"answer":1208},"Do design token extractors work on Tailwind sites?","Tools that read the site's actual CSS or computed styles do, because bg-indigo-600 is just CSS once shipped. Tools that look for CSS variables only will miss most of a Tailwind site's system, since utility-first sites often define few custom properties.",{"question":1210,"answer":1211},"What is the difference between extracting design tokens and extracting a color palette?","A palette is one token group. A design token set also covers the type scale, spacing, radii, shadows, motion, and z-index layers - the full set of decisions you need to rebuild UI in the site's style.",{},"/api-blog/best-design-token-extraction-tools-2026",[1215,775,1216],"how-to-extract-design-tokens-from-any-website-in-python","best-design-to-code-apis-2026",{"title":787,"description":1199},"api-blog/best-design-token-extraction-tools-2026",[780,1220,1221,1222],"tools","comparison","css analysis","GhGcQEA8Q7VmKm_mMFRSpL45k0PaBwatHPzBRiFUK9g",{"id":1225,"title":1226,"author":6,"body":1227,"category":1799,"date":757,"dateModified":758,"description":1800,"extension":760,"faqs":1801,"image":758,"meta":1812,"navigation":91,"path":1813,"readingTime":107,"relatedSlugs":1814,"seo":1816,"stem":1817,"tags":1818,"__hash__":1821},"apiBlog/api-blog/design-token-types-reference.md","Design Token Types: Every Token a Website Exposes (Reference)",{"type":8,"value":1228,"toc":1788},[1229,1232,1239,1243,1605,1609,1615,1627,1633,1642,1646,1653,1683,1741,1743,1747,1750,1754,1757,1761,1764,1768,1786],[11,1230,1231],{},"This is the reference we wish had existed when we built our extraction engine: every token type a live website exposes, the CSS properties each one comes from, and the gotcha that silently corrupts it. Seventeen groups, one table each way.",[11,1233,1234,1235,1238],{},"If you want the extraction code itself, that is in the ",[643,1236,1237],{"href":896},"Python tokens guide",". This page is the map.",[23,1240,1242],{"id":1241},"the-complete-token-table","The complete token table",[469,1244,1245,1261],{},[472,1246,1247],{},[475,1248,1249,1252,1255,1258],{},[478,1250,1251],{},"Token group",[478,1253,1254],{},"CSS sources",[478,1256,1257],{},"What good output looks like",[478,1259,1260],{},"The gotcha",[497,1262,1263,1291,1317,1332,1352,1376,1392,1414,1436,1458,1474,1490,1506,1522,1544,1569,1588],{},[475,1264,1265,1268,1285,1288],{},[502,1266,1267],{},"Colors",[502,1269,1270,615,1273,615,1276,615,1279,615,1282],{},[15,1271,1272],{},"color",[15,1274,1275],{},"background-color",[15,1277,1278],{},"border-*-color",[15,1280,1281],{},"fill",[15,1283,1284],{},"stroke",[502,1286,1287],{},"5-12 ranked values, not 200",[502,1289,1290],{},"Browser defaults and cookie banners pollute counts",[475,1292,1293,1296,1304,1311],{},[502,1294,1295],{},"Gradients",[502,1297,1298,615,1301],{},[15,1299,1300],{},"background-image",[15,1302,1303],{},"mask-image",[502,1305,1306,1307,1310],{},"Full ",[15,1308,1309],{},"linear-gradient(...)"," strings",[502,1312,1313,1314,1316],{},"Not in ",[15,1315,1275],{}," - miss this and gradient brands report as white",[475,1318,1319,1322,1326,1329],{},[502,1320,1321],{},"Font families",[502,1323,1324],{},[15,1325,426],{},[502,1327,1328],{},"1-3 families with roles (heading/body/mono)",[502,1330,1331],{},"The stack lists what CSS asked for, not what loaded",[475,1333,1334,1337,1342,1345],{},[502,1335,1336],{},"Font sizes",[502,1338,1339],{},[15,1340,1341],{},"font-size",[502,1343,1344],{},"A scale: 12, 14, 16, 20, 24, 36, 56",[502,1346,1347,1348,1351],{},"Fluid ",[15,1349,1350],{},"clamp()"," values resolve differently per viewport",[475,1353,1354,1357,1362,1365],{},[502,1355,1356],{},"Font weights",[502,1358,1359],{},[15,1360,1361],{},"font-weight",[502,1363,1364],{},"3-5 weights actually used",[502,1366,1367,1368,1371,1372,1375],{},"Keyword values (",[15,1369,1370],{},"bold",") and numbers (",[15,1373,1374],{},"700",") need normalizing",[475,1377,1378,1381,1386,1389],{},[502,1379,1380],{},"Line heights",[502,1382,1383],{},[15,1384,1385],{},"line-height",[502,1387,1388],{},"Unitless ratios per size tier",[502,1390,1391],{},"Computed styles return px; divide by font-size to recover the ratio",[475,1393,1394,1397,1402,1409],{},[502,1395,1396],{},"Letter spacing",[502,1398,1399],{},[15,1400,1401],{},"letter-spacing",[502,1403,1404,1405,1408],{},"Tight values on headings, ",[15,1406,1407],{},"normal"," elsewhere",[502,1410,1411,1413],{},[15,1412,1407],{}," is a value, not an absence",[475,1415,1416,1419,1430,1433],{},[502,1417,1418],{},"Spacing",[502,1420,1421,615,1424,615,1427],{},[15,1422,1423],{},"margin",[15,1425,1426],{},"padding",[15,1428,1429],{},"gap",[502,1431,1432],{},"A grid: 4, 8, 12, 16, 24, 32, 48, 64",[502,1434,1435],{},"Snap to the base unit or you get 40 near-duplicates",[475,1437,1438,1441,1446,1449],{},[502,1439,1440],{},"Border radii",[502,1442,1443],{},[15,1444,1445],{},"border-radius",[502,1447,1448],{},"2-4 values (subtle, card, pill)",[502,1450,1451,375,1454,1457],{},[15,1452,1453],{},"9999px",[15,1455,1456],{},"50%"," are the same intent, different strings",[475,1459,1460,1463,1468,1471],{},[502,1461,1462],{},"Border widths",[502,1464,1465],{},[15,1466,1467],{},"border-width",[502,1469,1470],{},"1-2 values",[502,1472,1473],{},"Mostly 1px everywhere; the outliers are the signal",[475,1475,1476,1479,1484,1487],{},[502,1477,1478],{},"Box shadows",[502,1480,1481],{},[15,1482,1483],{},"box-shadow",[502,1485,1486],{},"2-4 elevation levels",[502,1488,1489],{},"Multi-layer shadows are one token, not four",[475,1491,1492,1495,1500,1503],{},[502,1493,1494],{},"Text shadows",[502,1496,1497],{},[15,1498,1499],{},"text-shadow",[502,1501,1502],{},"Usually empty; notable when not",[502,1504,1505],{},"Rare enough that any hit is worth keeping",[475,1507,1508,1511,1516,1519],{},[502,1509,1510],{},"Opacities",[502,1512,1513],{},[15,1514,1515],{},"opacity",[502,1517,1518],{},"Disabled/overlay/hover steps",[502,1520,1521],{},"Transition intermediate values sneak in if you sample mid-animation",[475,1523,1524,1527,1535,1538],{},[502,1525,1526],{},"Durations",[502,1528,1529,615,1532],{},[15,1530,1531],{},"transition-duration",[15,1533,1534],{},"animation-duration",[502,1536,1537],{},"150ms/300ms/500ms tiers",[502,1539,1540,1543],{},[15,1541,1542],{},"0s"," is a default, not a token",[475,1545,1546,1549,1557,1563],{},[502,1547,1548],{},"Easings",[502,1550,1551,615,1554],{},[15,1552,1553],{},"transition-timing-function",[15,1555,1556],{},"animation-timing-function",[502,1558,1559,1560],{},"The brand's ",[15,1561,1562],{},"cubic-bezier(...)",[502,1564,1565,1568],{},[15,1566,1567],{},"ease"," defaults drown the custom curves - filter them",[475,1570,1571,1574,1579,1582],{},[502,1572,1573],{},"Z-index layers",[502,1575,1576],{},[15,1577,1578],{},"z-index",[502,1580,1581],{},"The layering scale: 10, 50, 100, 9999",[502,1583,1584,1587],{},[15,1585,1586],{},"auto"," everywhere except the 5 values that matter",[475,1589,1590,1593,1599,1602],{},[502,1591,1592],{},"Breakpoints",[502,1594,1595,1598],{},[15,1596,1597],{},"@media"," conditions",[502,1600,1601],{},"3-5 widths: 640, 768, 1024, 1280",[502,1603,1604],{},"Only visible in stylesheets - computed styles never expose them",[23,1606,1608],{"id":1607},"the-same-table-by-extraction-difficulty","The same table, by extraction difficulty",[11,1610,1611,1614],{},[359,1612,1613],{},"Free (one property read):"," colors, font families, font sizes, font weights, opacities, z-index.",[11,1616,1617,1620,1621,1623,1624,1626],{},[359,1618,1619],{},"Needs normalizing:"," line heights (px to ratio), spacing (grid snapping), radii (",[15,1622,1453],{}," = ",[15,1625,1456],{}," = pill), weights (keywords to numbers), shadows (multi-layer grouping).",[11,1628,1629,1632],{},[359,1630,1631],{},"Needs the stylesheet, not computed styles:"," breakpoints, and any media-query variant of everything else. This is the structural reason a computed-styles-only extractor reports one viewport and calls it the design system.",[11,1634,1635,1638,1639,1641],{},[359,1636,1637],{},"Needs judgment:"," which color is ",[15,1640,388],{}," (frequency plus element context - what is on the buttons), which durations are intentional vs defaults, which fonts actually loaded.",[23,1643,1645],{"id":1644},"how-this-maps-to-the-api","How this maps to the API",[11,1647,1648,1649,1652],{},"Every group in the table is a field on our extract endpoint, selectable with ",[15,1650,1651],{},"?fields=",":",[31,1654,1656],{"className":33,"code":1655,"language":35,"meta":36,"style":36},"curl \"https://miromiro.app/api/v1/extract?url=stripe.com&fields=colors,spacing,easings\" \\\n  -H \"Authorization: Bearer $MIROMIRO_API_KEY\"\n",[15,1657,1658,1671],{"__ignoreMap":36},[40,1659,1660,1662,1664,1667,1669],{"class":42,"line":43},[40,1661,578],{"class":46},[40,1663,582],{"class":581},[40,1665,1666],{"class":50},"https://miromiro.app/api/v1/extract?url=stripe.com&fields=colors,spacing,easings",[40,1668,588],{"class":581},[40,1670,592],{"class":591},[40,1672,1673,1675,1677,1679,1681],{"class":42,"line":57},[40,1674,597],{"class":50},[40,1676,582],{"class":581},[40,1678,602],{"class":50},[40,1680,605],{"class":591},[40,1682,608],{"class":581},[11,1684,1685,1686,615,1688,615,1691,615,1693,615,1695,615,1697,615,1700,615,1703,615,1705,615,1707,615,1710,615,1712,615,1715,615,1718,615,1721,615,1724,615,1727,1730,1731,1733,1734,1736,1737,1740],{},"The full field list: ",[15,1687,614],{},[15,1689,1690],{},"gradients",[15,1692,618],{},[15,1694,621],{},[15,1696,624],{},[15,1698,1699],{},"lineHeights",[15,1701,1702],{},"letterSpacings",[15,1704,627],{},[15,1706,630],{},[15,1708,1709],{},"borderWidths",[15,1711,633],{},[15,1713,1714],{},"textShadows",[15,1716,1717],{},"opacities",[15,1719,1720],{},"durations",[15,1722,1723],{},"easings",[15,1725,1726],{},"zIndexes",[15,1728,1729],{},"breakpoints",". Add ",[15,1732,1149],{}," or ",[15,1735,1153],{}," to get the same data as custom properties or a theme block instead of JSON. One call is 10 credits; ",[643,1738,1739],{"href":645},"100 credits a month are free",", no card.",[23,1742,669],{"id":668},[671,1744,1746],{"id":1745},"what-are-the-main-types-of-design-tokens","What are the main types of design tokens?",[11,1748,1749],{},"Color, typography (families/sizes/weights/line heights/letter spacing), spacing, borders (radii/widths), effects (shadows/gradients/opacities), motion (durations/easings), and structure (z-index, breakpoints). Seventeen groups in total from a live site.",[671,1751,1753],{"id":1752},"are-css-custom-properties-the-same-as-design-tokens","Are CSS custom properties the same as design tokens?",[11,1755,1756],{},"No. Custom properties are one storage format. Tailwind and CSS-in-JS sites often ship almost none while having rigorous token systems. Extract resolved values, not variable names.",[671,1758,1760],{"id":1759},"which-tokens-matter-most","Which tokens matter most?",[11,1762,1763],{},"Colors, type scale, spacing - in that order. They carry the identity. Radii, shadows, and motion are what make a rebuild feel like the original instead of a wireframe of it.",[671,1765,1767],{"id":1766},"can-i-extract-motion-tokens-from-a-website","Can I extract motion tokens from a website?",[11,1769,1770,1771,615,1773,1775,1776,1778,1779,1781,1782,375,1784,444],{},"Yes: ",[15,1772,1531],{},[15,1774,1534],{},", and their timing functions. Filter out ",[15,1777,1542],{}," and default ",[15,1780,1567],{}," or the real values drown. Our extract endpoint returns them as ",[15,1783,1720],{},[15,1785,1723],{},[737,1787,1181],{},{"title":36,"searchDepth":57,"depth":57,"links":1789},[1790,1791,1792,1793],{"id":1241,"depth":57,"text":1242},{"id":1607,"depth":57,"text":1608},{"id":1644,"depth":57,"text":1645},{"id":668,"depth":57,"text":669,"children":1794},[1795,1796,1797,1798],{"id":1745,"depth":88,"text":1746},{"id":1752,"depth":88,"text":1753},{"id":1759,"depth":88,"text":1760},{"id":1766,"depth":88,"text":1767},"Reference","All 17 design token types a website exposes - the CSS properties each comes from, what good output looks like, and the gotcha that silently corrupts it.",[1802,1804,1807,1809],{"question":1746,"answer":1803},"Color tokens, typography tokens (families, sizes, weights, line heights, letter spacing), spacing tokens, border tokens (radii, widths), effect tokens (shadows, gradients, opacities), motion tokens (durations, easings), and structural tokens (z-index layers, breakpoints). A complete extraction from a live site covers around 17 distinct groups.",{"question":1805,"answer":1806},"Which CSS properties do design tokens come from?","Each token group maps to specific CSS properties: colors from color, background-color and border-color; the type scale from font-size; spacing from margin, padding and gap; radii from border-radius; shadows from box-shadow; motion from transition-duration, animation-duration and their timing functions; breakpoints from media query conditions.",{"question":1753,"answer":1808},"No. Custom properties are one way a site stores tokens. Many production sites - especially Tailwind and CSS-in-JS codebases - ship few or no custom properties while still having a rigorous token system. Extract from resolved values, not variable names, or you will miss most real-world systems.",{"question":1810,"answer":1811},"What order should I extract tokens in?","Colors, type scale, and spacing first - they carry most of a site's identity and are enough to theme a rough UI. Radii, shadows, and motion are the polish layer that makes a rebuild feel like the original.",{},"/api-blog/design-token-types-reference",[1215,774,1815],"how-to-detect-fonts-a-website-uses",{"title":1226,"description":1800},"api-blog/design-token-types-reference",[780,1819,781,1820],"reference","cheatsheet","Q2H5fOPEU9oXwkGDkaF1v9diKxKTdrdCh3xo9PqdAaM",{"id":1823,"title":1824,"author":6,"body":1825,"category":756,"date":757,"dateModified":758,"description":2501,"extension":760,"faqs":2502,"image":758,"meta":2514,"navigation":91,"path":2515,"readingTime":107,"relatedSlugs":2516,"seo":2517,"stem":2518,"tags":2519,"__hash__":2523},"apiBlog/api-blog/how-to-extract-website-color-palette-programmatically.md","How to Extract a Website's Color Palette Programmatically",{"type":8,"value":1826,"toc":2487},[1827,1838,1841,1845,1848,1873,1935,1938,1942,1945,2039,2045,2049,2052,2298,2301,2305,2399,2401,2431,2443,2445,2448,2450,2454,2459,2463,2466,2470,2473,2477,2484],[11,1828,1829,1830,1837],{},"There are two fundamentally different ways to extract a color palette from a website in code: quantize the pixels of a screenshot, or read the colors out of the CSS. They give different answers, and one of them is usually wrong for what you want. The short version: ",[359,1831,1832,1833,444],{},"pixel methods find what a page looks like; CSS methods find what the brand ",[1834,1835,1836],"em",{},"is"," If you want brand colors, read the CSS.",[11,1839,1840],{},"Here are both, working, then the comparison.",[23,1842,1844],{"id":1843},"method-1-quantize-a-screenshot-fast-misleading","Method 1: quantize a screenshot (fast, misleading)",[11,1846,1847],{},"The classic approach - screenshot the page, run color quantization:",[31,1849,1851],{"className":33,"code":1850,"language":35,"meta":36,"style":36},"pip install playwright colorthief\nplaywright install chromium\n",[15,1852,1853,1865],{"__ignoreMap":36},[40,1854,1855,1857,1859,1862],{"class":42,"line":43},[40,1856,47],{"class":46},[40,1858,51],{"class":50},[40,1860,1861],{"class":50}," playwright",[40,1863,1864],{"class":50}," colorthief\n",[40,1866,1867,1869,1871],{"class":42,"line":57},[40,1868,60],{"class":46},[40,1870,51],{"class":50},[40,1872,65],{"class":50},[31,1874,1876],{"className":71,"code":1875,"language":73,"meta":36,"style":36},"from io import BytesIO\nfrom colorthief import ColorThief\nfrom playwright.sync_api import sync_playwright\n\nwith sync_playwright() as p:\n    browser = p.chromium.launch()\n    page = browser.new_page(viewport={\"width\": 1440, \"height\": 900})\n    page.goto(\"https://stripe.com\", wait_until=\"networkidle\")\n    shot = page.screenshot()\n    browser.close()\n\npalette = ColorThief(BytesIO(shot)).get_palette(color_count=6)\nprint(['#%02x%02x%02x' % c for c in palette])\n",[15,1877,1878,1883,1888,1892,1896,1900,1904,1908,1912,1917,1921,1925,1930],{"__ignoreMap":36},[40,1879,1880],{"class":42,"line":43},[40,1881,1882],{},"from io import BytesIO\n",[40,1884,1885],{"class":42,"line":57},[40,1886,1887],{},"from colorthief import ColorThief\n",[40,1889,1890],{"class":42,"line":88},[40,1891,85],{},[40,1893,1894],{"class":42,"line":95},[40,1895,92],{"emptyLinePlaceholder":91},[40,1897,1898],{"class":42,"line":101},[40,1899,210],{},[40,1901,1902],{"class":42,"line":107},[40,1903,216],{},[40,1905,1906],{"class":42,"line":113},[40,1907,222],{},[40,1909,1910],{"class":42,"line":119},[40,1911,228],{},[40,1913,1914],{"class":42,"line":125},[40,1915,1916],{},"    shot = page.screenshot()\n",[40,1918,1919],{"class":42,"line":131},[40,1920,240],{},[40,1922,1923],{"class":42,"line":137},[40,1924,92],{"emptyLinePlaceholder":91},[40,1926,1927],{"class":42,"line":143},[40,1928,1929],{},"palette = ColorThief(BytesIO(shot)).get_palette(color_count=6)\n",[40,1931,1932],{"class":42,"line":149},[40,1933,1934],{},"print(['#%02x%02x%02x' % c for c in palette])\n",[11,1936,1937],{},"Works in ten lines. The problem is that a screenshot has no idea what is UI and what is content. A hero photo dominates the pixel math, anti-aliased text contributes hundreds of blend colors that exist nowhere in the stylesheet, and the accent color that defines the brand might be forty pixels of button. Use this method for artwork and photos; do not use it for brand palettes.",[23,1939,1941],{"id":1940},"method-2-read-the-css-the-right-answer","Method 2: read the CSS (the right answer)",[11,1943,1944],{},"Ask the browser what colors the stylesheet actually applies:",[31,1946,1948],{"className":71,"code":1947,"language":73,"meta":36,"style":36},"from collections import Counter\nfrom playwright.sync_api import sync_playwright\n\nCOLLECT = \"\"\"\n() => [...document.querySelectorAll('body *')].slice(0, 5000).flatMap(el => {\n  const s = getComputedStyle(el);\n  return [s.color, s.backgroundColor, s.borderTopColor];\n})\n\"\"\"\n\nwith sync_playwright() as p:\n    browser = p.chromium.launch()\n    page = browser.new_page()\n    page.goto(\"https://stripe.com\", wait_until=\"networkidle\")\n    values = page.evaluate(COLLECT)\n    browser.close()\n\nskip = {\"rgba(0, 0, 0, 0)\", \"rgb(0, 0, 0)\", \"rgb(255, 255, 255)\"}\nfor color, count in Counter(v for v in values if v not in skip).most_common(8):\n    print(f\"{count:>5}  {color}\")\n",[15,1949,1950,1954,1958,1962,1966,1971,1976,1981,1986,1990,1994,1998,2002,2007,2011,2016,2020,2024,2029,2034],{"__ignoreMap":36},[40,1951,1952],{"class":42,"line":43},[40,1953,80],{},[40,1955,1956],{"class":42,"line":57},[40,1957,85],{},[40,1959,1960],{"class":42,"line":88},[40,1961,92],{"emptyLinePlaceholder":91},[40,1963,1964],{"class":42,"line":95},[40,1965,98],{},[40,1967,1968],{"class":42,"line":101},[40,1969,1970],{},"() => [...document.querySelectorAll('body *')].slice(0, 5000).flatMap(el => {\n",[40,1972,1973],{"class":42,"line":107},[40,1974,1975],{},"  const s = getComputedStyle(el);\n",[40,1977,1978],{"class":42,"line":113},[40,1979,1980],{},"  return [s.color, s.backgroundColor, s.borderTopColor];\n",[40,1982,1983],{"class":42,"line":119},[40,1984,1985],{},"})\n",[40,1987,1988],{"class":42,"line":125},[40,1989,182],{},[40,1991,1992],{"class":42,"line":131},[40,1993,92],{"emptyLinePlaceholder":91},[40,1995,1996],{"class":42,"line":137},[40,1997,210],{},[40,1999,2000],{"class":42,"line":143},[40,2001,216],{},[40,2003,2004],{"class":42,"line":149},[40,2005,2006],{},"    page = browser.new_page()\n",[40,2008,2009],{"class":42,"line":155},[40,2010,228],{},[40,2012,2013],{"class":42,"line":161},[40,2014,2015],{},"    values = page.evaluate(COLLECT)\n",[40,2017,2018],{"class":42,"line":167},[40,2019,240],{},[40,2021,2022],{"class":42,"line":173},[40,2023,92],{"emptyLinePlaceholder":91},[40,2025,2026],{"class":42,"line":179},[40,2027,2028],{},"skip = {\"rgba(0, 0, 0, 0)\", \"rgb(0, 0, 0)\", \"rgb(255, 255, 255)\"}\n",[40,2030,2031],{"class":42,"line":185},[40,2032,2033],{},"for color, count in Counter(v for v in values if v not in skip).most_common(8):\n",[40,2035,2036],{"class":42,"line":190},[40,2037,2038],{},"    print(f\"{count:>5}  {color}\")\n",[11,2040,2041,2042,444],{},"Frequency ranking does the rest: the most-used saturated color is almost always the brand primary. For the full version with fonts, spacing, and the cleanup steps, see the ",[643,2043,2044],{"href":896},"design tokens guide",[23,2046,2048],{"id":2047},"checking-one-site-by-hand-use-the-console","Checking one site by hand? Use the console",[11,2050,2051],{},"Paste this in DevTools on any page:",[31,2053,2057],{"className":2054,"code":2055,"language":2056,"meta":36,"style":36},"language-js shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","Object.entries([...document.querySelectorAll('body *')].reduce((acc, el) => {\n  const c = getComputedStyle(el).backgroundColor;\n  if (c !== 'rgba(0, 0, 0, 0)') acc[c] = (acc[c] || 0) + 1;\n  return acc;\n}, {})).sort((a, b) => b[1] - a[1]).slice(0, 8)\n","js",[15,2058,2059,2126,2155,2221,2231],{"__ignoreMap":36},[40,2060,2061,2064,2066,2070,2073,2076,2079,2081,2083,2086,2089,2092,2094,2097,2099,2102,2104,2106,2110,2113,2116,2119,2123],{"class":42,"line":43},[40,2062,2063],{"class":591},"Object",[40,2065,444],{"class":581},[40,2067,2069],{"class":2068},"s2Zo4","entries",[40,2071,2072],{"class":591},"([",[40,2074,2075],{"class":581},"...",[40,2077,2078],{"class":591},"document",[40,2080,444],{"class":581},[40,2082,458],{"class":2068},[40,2084,2085],{"class":591},"(",[40,2087,2088],{"class":581},"'",[40,2090,2091],{"class":50},"body *",[40,2093,2088],{"class":581},[40,2095,2096],{"class":591},")]",[40,2098,444],{"class":581},[40,2100,2101],{"class":2068},"reduce",[40,2103,2085],{"class":591},[40,2105,2085],{"class":581},[40,2107,2109],{"class":2108},"sHdIc","acc",[40,2111,2112],{"class":581},",",[40,2114,2115],{"class":2108}," el",[40,2117,2118],{"class":581},")",[40,2120,2122],{"class":2121},"spNyl"," =>",[40,2124,2125],{"class":581}," {\n",[40,2127,2128,2131,2134,2137,2140,2143,2146,2148,2150,2152],{"class":42,"line":57},[40,2129,2130],{"class":2121},"  const",[40,2132,2133],{"class":591}," c",[40,2135,2136],{"class":581}," =",[40,2138,2139],{"class":2068}," getComputedStyle",[40,2141,2085],{"class":2142},"swJcz",[40,2144,2145],{"class":591},"el",[40,2147,2118],{"class":2142},[40,2149,444],{"class":581},[40,2151,443],{"class":591},[40,2153,2154],{"class":581},";\n",[40,2156,2157,2161,2164,2167,2170,2173,2176,2178,2181,2183,2186,2188,2191,2194,2196,2198,2200,2202,2204,2207,2211,2213,2216,2219],{"class":42,"line":88},[40,2158,2160],{"class":2159},"s7zQu","  if",[40,2162,2163],{"class":2142}," (",[40,2165,2166],{"class":591},"c",[40,2168,2169],{"class":581}," !==",[40,2171,2172],{"class":581}," '",[40,2174,2175],{"class":50},"rgba(0, 0, 0, 0)",[40,2177,2088],{"class":581},[40,2179,2180],{"class":2142},") ",[40,2182,2109],{"class":591},[40,2184,2185],{"class":2142},"[",[40,2187,2166],{"class":591},[40,2189,2190],{"class":2142},"] ",[40,2192,2193],{"class":581},"=",[40,2195,2163],{"class":2142},[40,2197,2109],{"class":591},[40,2199,2185],{"class":2142},[40,2201,2166],{"class":591},[40,2203,2190],{"class":2142},[40,2205,2206],{"class":581},"||",[40,2208,2210],{"class":2209},"sbssI"," 0",[40,2212,2180],{"class":2142},[40,2214,2215],{"class":581},"+",[40,2217,2218],{"class":2209}," 1",[40,2220,2154],{"class":581},[40,2222,2223,2226,2229],{"class":42,"line":95},[40,2224,2225],{"class":2159},"  return",[40,2227,2228],{"class":591}," acc",[40,2230,2154],{"class":581},[40,2232,2233,2236,2239,2242,2244,2247,2249,2251,2253,2255,2258,2260,2262,2265,2268,2270,2273,2276,2278,2281,2283,2286,2288,2291,2293,2296],{"class":42,"line":101},[40,2234,2235],{"class":581},"},",[40,2237,2238],{"class":581}," {}",[40,2240,2241],{"class":591},"))",[40,2243,444],{"class":581},[40,2245,2246],{"class":2068},"sort",[40,2248,2085],{"class":591},[40,2250,2085],{"class":581},[40,2252,643],{"class":2108},[40,2254,2112],{"class":581},[40,2256,2257],{"class":2108}," b",[40,2259,2118],{"class":581},[40,2261,2122],{"class":2121},[40,2263,2264],{"class":591}," b[",[40,2266,2267],{"class":2209},"1",[40,2269,2190],{"class":591},[40,2271,2272],{"class":581},"-",[40,2274,2275],{"class":591}," a[",[40,2277,2267],{"class":2209},[40,2279,2280],{"class":591},"])",[40,2282,444],{"class":581},[40,2284,2285],{"class":2068},"slice",[40,2287,2085],{"class":591},[40,2289,2290],{"class":2209},"0",[40,2292,2112],{"class":581},[40,2294,2295],{"class":2209}," 8",[40,2297,336],{"class":591},[11,2299,2300],{},"Fastest palette check that exists. It just does not scale past the tab you are in.",[23,2302,2304],{"id":2303},"screenshot-vs-css-vs-api","Screenshot vs CSS vs API",[469,2306,2307,2321],{},[472,2308,2309],{},[475,2310,2311,2313,2316,2319],{},[478,2312],{},[478,2314,2315],{},"Screenshot quantization",[478,2317,2318],{},"CSS computed styles",[478,2320,1106],{},[497,2322,2323,2335,2347,2358,2374,2388],{},[475,2324,2325,2328,2331,2333],{},[502,2326,2327],{},"Finds brand accent colors",[502,2329,2330],{},"Poorly (pixel-count bias)",[502,2332,507],{},[502,2334,507],{},[475,2336,2337,2340,2343,2345],{},[502,2338,2339],{},"Affected by photos in the page",[502,2341,2342],{},"Badly",[502,2344,528],{},[502,2346,528],{},[475,2348,2349,2352,2354,2356],{},[502,2350,2351],{},"Invents colors (anti-aliasing)",[502,2353,507],{},[502,2355,528],{},[502,2357,528],{},[475,2359,2360,2362,2365,2371],{},[502,2361,1295],{},[502,2363,2364],{},"Sort of (as pixels)",[502,2366,2367,2368,2370],{},"Needs ",[15,2369,448],{}," too",[502,2372,2373],{},"Yes, as gradient strings",[475,2375,2376,2379,2382,2385],{},[502,2377,2378],{},"Output format",[502,2380,2381],{},"RGB tuples",[502,2383,2384],{},"rgb() strings",[502,2386,2387],{},"Hex, ranked, plus the rest of the token set",[475,2389,2390,2393,2395,2397],{},[502,2391,2392],{},"Runs without your own browser infra",[502,2394,528],{},[502,2396,528],{},[502,2398,507],{},[23,2400,565],{"id":564},[31,2402,2404],{"className":33,"code":2403,"language":35,"meta":36,"style":36},"curl \"https://miromiro.app/api/v1/extract?url=stripe.com&fields=colors,gradients\" \\\n  -H \"Authorization: Bearer $MIROMIRO_API_KEY\"\n",[15,2405,2406,2419],{"__ignoreMap":36},[40,2407,2408,2410,2412,2415,2417],{"class":42,"line":43},[40,2409,578],{"class":46},[40,2411,582],{"class":581},[40,2413,2414],{"class":50},"https://miromiro.app/api/v1/extract?url=stripe.com&fields=colors,gradients",[40,2416,588],{"class":581},[40,2418,592],{"class":591},[40,2420,2421,2423,2425,2427,2429],{"class":42,"line":57},[40,2422,597],{"class":50},[40,2424,582],{"class":581},[40,2426,602],{"class":50},[40,2428,605],{"class":591},[40,2430,608],{"class":581},[11,2432,2433,2434,2438,2439,2442],{},"Ranked palette with gradients included, normalized, 10 credits a call. There is also a ",[643,2435,2437],{"href":2436},"/api/tools/color-palette-extractor","free color palette extractor"," that runs the same engine in the browser if you want to eyeball a site before writing any code. ",[643,2440,2441],{"href":645},"Free key here"," - 100 credits a month, no card.",[23,2444,655],{"id":654},[11,2446,2447],{},"Read the CSS, not the pixels. Screenshot quantization answers \"what does this image look like\", which is the wrong question for a brand palette, and it will confidently hand you the colors of a stock photo. The console snippet for one site, Playwright for a script, the API when it needs to run inside something.",[23,2449,669],{"id":668},[671,2451,2453],{"id":2452},"how-do-i-get-a-websites-color-palette-in-python","How do I get a website's color palette in Python?",[11,2455,658,2456,2458],{},[15,2457,286],{}," counting (code above). Skip ColorThief-on-screenshot for brand work - it measures content, not identity.",[671,2460,2462],{"id":2461},"why-does-screenshot-extraction-give-wrong-brand-colors","Why does screenshot extraction give wrong brand colors?",[11,2464,2465],{},"Pixel counts reward photos and anti-aliasing blends, not the forty pixels of button that carry the actual accent color.",[671,2467,2469],{"id":2468},"can-i-do-this-in-the-browser-console","Can I do this in the browser console?",[11,2471,2472],{},"Yes - the snippet above ranks background colors on any page you have open.",[671,2474,2476],{"id":2475},"how-do-i-get-hex-instead-of-rgb-strings","How do I get hex instead of rgb() strings?",[11,2478,2479,2480,2483],{},"Three ",[15,2481,2482],{},"parseInt"," calls per channel, or use an API that normalizes for you.",[737,2485,2486],{},"html pre.shiki code .sBMFI, html code.shiki .sBMFI{--shiki-light:#E2931D;--shiki-default:#FFCB6B;--shiki-dark:#FFCB6B}html pre.shiki code .sfazB, html code.shiki .sfazB{--shiki-light:#91B859;--shiki-default:#C3E88D;--shiki-dark:#C3E88D}html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html pre.shiki code .sTEyZ, html code.shiki .sTEyZ{--shiki-light:#90A4AE;--shiki-default:#EEFFFF;--shiki-dark:#BABED8}html pre.shiki code .sMK4o, html code.shiki .sMK4o{--shiki-light:#39ADB5;--shiki-default:#89DDFF;--shiki-dark:#89DDFF}html pre.shiki code .s2Zo4, html code.shiki .s2Zo4{--shiki-light:#6182B8;--shiki-default:#82AAFF;--shiki-dark:#82AAFF}html pre.shiki code .sHdIc, html code.shiki .sHdIc{--shiki-light:#90A4AE;--shiki-light-font-style:italic;--shiki-default:#EEFFFF;--shiki-default-font-style:italic;--shiki-dark:#BABED8;--shiki-dark-font-style:italic}html pre.shiki code .spNyl, html code.shiki .spNyl{--shiki-light:#9C3EDA;--shiki-default:#C792EA;--shiki-dark:#C792EA}html pre.shiki code .swJcz, html code.shiki .swJcz{--shiki-light:#E53935;--shiki-default:#F07178;--shiki-dark:#F07178}html pre.shiki code .s7zQu, html code.shiki .s7zQu{--shiki-light:#39ADB5;--shiki-light-font-style:italic;--shiki-default:#89DDFF;--shiki-default-font-style:italic;--shiki-dark:#89DDFF;--shiki-dark-font-style:italic}html pre.shiki code .sbssI, html code.shiki .sbssI{--shiki-light:#F76D47;--shiki-default:#F78C6C;--shiki-dark:#F78C6C}",{"title":36,"searchDepth":57,"depth":57,"links":2488},[2489,2490,2491,2492,2493,2494,2495],{"id":1843,"depth":57,"text":1844},{"id":1940,"depth":57,"text":1941},{"id":2047,"depth":57,"text":2048},{"id":2303,"depth":57,"text":2304},{"id":564,"depth":57,"text":565},{"id":654,"depth":57,"text":655},{"id":668,"depth":57,"text":669,"children":2496},[2497,2498,2499,2500],{"id":2452,"depth":88,"text":2453},{"id":2461,"depth":88,"text":2462},{"id":2468,"depth":88,"text":2469},{"id":2475,"depth":88,"text":2476},"Two working ways to get a site's color palette in code - screenshot quantization vs reading the CSS - and which one returns the actual brand colors.",[2503,2505,2508,2511],{"question":2453,"answer":2504},"Two ways: quantize a screenshot with Pillow or ColorThief (fast, but photos in the page skew the result), or load the page with Playwright and count computed color and background-color values across elements (slower, but returns the actual CSS colors the brand uses). For brand palettes, use the CSS approach.",{"question":2506,"answer":2507},"Why does screenshot color extraction give wrong brand colors?","Because a screenshot has no idea what is UI and what is content. A hero photo of a sunset dominates the pixel counts, anti-aliasing invents hundreds of blend colors that exist nowhere in the CSS, and the true accent color of buttons and links can occupy very few pixels.",{"question":2509,"answer":2510},"Can I extract a color palette in the browser console?","Yes - a few lines of JavaScript over getComputedStyle gives you ranked colors for the page you are on. It is the fastest way to check one site by hand; it just is not automatable across many URLs without a headless browser around it.",{"question":2512,"answer":2513},"How do I get hex values instead of rgb() strings?","Computed styles always return rgb()/rgba(). Convert with three parseInt calls, or use an extraction API that normalizes to hex for you.",{},"/api-blog/how-to-extract-website-color-palette-programmatically",[1215,1815,775],{"title":1824,"description":2501},"api-blog/how-to-extract-website-color-palette-programmatically",[2520,73,2521,614,2522],"color palette","javascript","extraction","ZuBrzYUURU-j3lr-muPvdPr3xAzZrFGkvJ17zfbtBkg",1784751617523]