import ContextDev from 'context.dev';
const client = new ContextDev({
apiKey: process.env['CONTEXT_DEV_API_KEY'], // This is the default and can be omitted
});
const response = await client.style.extractStyleguide();
console.log(response.styleguide);{
"status": "<string>",
"domain": "<string>",
"styleguide": {
"mode": "light",
"colors": {
"accent": "<string>",
"background": "<string>",
"text": "<string>"
},
"typography": {
"headings": {
"h1": {
"fontFamily": "<string>",
"fontSize": "<string>",
"fontWeight": 123,
"lineHeight": "<string>",
"letterSpacing": "<string>"
},
"h2": {
"fontFamily": "<string>",
"fontSize": "<string>",
"fontWeight": 123,
"lineHeight": "<string>",
"letterSpacing": "<string>"
},
"h3": {
"fontFamily": "<string>",
"fontSize": "<string>",
"fontWeight": 123,
"lineHeight": "<string>",
"letterSpacing": "<string>"
},
"h4": {
"fontFamily": "<string>",
"fontSize": "<string>",
"fontWeight": 123,
"lineHeight": "<string>",
"letterSpacing": "<string>"
}
},
"p": {
"fontFamily": "<string>",
"fontSize": "<string>",
"fontWeight": 123,
"lineHeight": "<string>",
"letterSpacing": "<string>"
}
},
"elementSpacing": {
"xs": "<string>",
"sm": "<string>",
"md": "<string>",
"lg": "<string>",
"xl": "<string>"
},
"shadows": {
"sm": "<string>",
"md": "<string>",
"lg": "<string>",
"xl": "<string>",
"inner": "<string>"
},
"components": {
"button": {
"primary": {
"backgroundColor": "<string>",
"color": "<string>",
"borderColor": "<string>",
"borderRadius": "<string>",
"borderWidth": "<string>",
"borderStyle": "<string>",
"padding": "<string>",
"fontSize": "<string>",
"fontWeight": 123,
"textDecoration": "<string>",
"boxShadow": "<string>"
},
"secondary": {
"backgroundColor": "<string>",
"color": "<string>",
"borderColor": "<string>",
"borderRadius": "<string>",
"borderWidth": "<string>",
"borderStyle": "<string>",
"padding": "<string>",
"fontSize": "<string>",
"fontWeight": 123,
"textDecoration": "<string>",
"boxShadow": "<string>"
},
"link": {
"backgroundColor": "<string>",
"color": "<string>",
"borderColor": "<string>",
"borderRadius": "<string>",
"borderWidth": "<string>",
"borderStyle": "<string>",
"padding": "<string>",
"fontSize": "<string>",
"fontWeight": 123,
"textDecoration": "<string>",
"boxShadow": "<string>"
}
},
"card": {
"backgroundColor": "<string>",
"borderColor": "<string>",
"borderRadius": "<string>",
"borderWidth": "<string>",
"borderStyle": "<string>",
"padding": "<string>",
"boxShadow": "<string>",
"textColor": "<string>"
}
}
},
"code": 123
}Automatically extract comprehensive design system information from a brandās website including colors, typography, spacing, shadows, and UI components. Either ādomainā or ādirectUrlā must be provided as a query parameter, but not both.
import ContextDev from 'context.dev';
const client = new ContextDev({
apiKey: process.env['CONTEXT_DEV_API_KEY'], // This is the default and can be omitted
});
const response = await client.style.extractStyleguide();
console.log(response.styleguide);{
"status": "<string>",
"domain": "<string>",
"styleguide": {
"mode": "light",
"colors": {
"accent": "<string>",
"background": "<string>",
"text": "<string>"
},
"typography": {
"headings": {
"h1": {
"fontFamily": "<string>",
"fontSize": "<string>",
"fontWeight": 123,
"lineHeight": "<string>",
"letterSpacing": "<string>"
},
"h2": {
"fontFamily": "<string>",
"fontSize": "<string>",
"fontWeight": 123,
"lineHeight": "<string>",
"letterSpacing": "<string>"
},
"h3": {
"fontFamily": "<string>",
"fontSize": "<string>",
"fontWeight": 123,
"lineHeight": "<string>",
"letterSpacing": "<string>"
},
"h4": {
"fontFamily": "<string>",
"fontSize": "<string>",
"fontWeight": 123,
"lineHeight": "<string>",
"letterSpacing": "<string>"
}
},
"p": {
"fontFamily": "<string>",
"fontSize": "<string>",
"fontWeight": 123,
"lineHeight": "<string>",
"letterSpacing": "<string>"
}
},
"elementSpacing": {
"xs": "<string>",
"sm": "<string>",
"md": "<string>",
"lg": "<string>",
"xl": "<string>"
},
"shadows": {
"sm": "<string>",
"md": "<string>",
"lg": "<string>",
"xl": "<string>",
"inner": "<string>"
},
"components": {
"button": {
"primary": {
"backgroundColor": "<string>",
"color": "<string>",
"borderColor": "<string>",
"borderRadius": "<string>",
"borderWidth": "<string>",
"borderStyle": "<string>",
"padding": "<string>",
"fontSize": "<string>",
"fontWeight": 123,
"textDecoration": "<string>",
"boxShadow": "<string>"
},
"secondary": {
"backgroundColor": "<string>",
"color": "<string>",
"borderColor": "<string>",
"borderRadius": "<string>",
"borderWidth": "<string>",
"borderStyle": "<string>",
"padding": "<string>",
"fontSize": "<string>",
"fontWeight": 123,
"textDecoration": "<string>",
"boxShadow": "<string>"
},
"link": {
"backgroundColor": "<string>",
"color": "<string>",
"borderColor": "<string>",
"borderRadius": "<string>",
"borderWidth": "<string>",
"borderStyle": "<string>",
"padding": "<string>",
"fontSize": "<string>",
"fontWeight": 123,
"textDecoration": "<string>",
"boxShadow": "<string>"
}
},
"card": {
"backgroundColor": "<string>",
"borderColor": "<string>",
"borderRadius": "<string>",
"borderWidth": "<string>",
"borderStyle": "<string>",
"padding": "<string>",
"boxShadow": "<string>",
"textColor": "<string>"
}
}
},
"code": 123
}Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Domain name to extract styleguide from (e.g., 'example.com', 'google.com'). The domain will be automatically normalized and validated.
A specific URL to fetch the styleguide from directly, bypassing domain resolution (e.g., 'https://example.com/design-system').
Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes).
1000 <= x <= 300000Optional parameter to prioritize screenshot capture for styleguide extraction. If 'speed', optimizes for faster capture with basic quality. If 'quality', optimizes for higher quality with longer wait times. Defaults to 'quality' if not provided.
speed, quality Was this page helpful?