Skip to content

Commit be3f298

Browse files
committed
Fix theme generator to include Optics installation and stop inventing classes
- Added Optics installation instructions (npm, jsDelivr CDN, unpkg) - Removed made-up CSS examples (button-primary, card, etc) - Direct users to actual Optics documentation for components - Added Mistake 5: Don't invent component classes like .op-button - Emphasize that Optics has specific HTML structure to follow - Version bump to 0.2.4
1 parent 909b78a commit be3f298

File tree

4 files changed

+57
-14
lines changed

4 files changed

+57
-14
lines changed

SYSTEM_OVERVIEW.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,11 @@ When you call `get_component_info` for "Button", you'll see tokens like:
287287
❌ Using arbitrary text colors on colored backgrounds
288288
✅ Using the matching `-on-` token: `--op-color-primary-on-base` on `--op-color-primary-base`
289289

290+
### Mistake 5: Inventing Component Classes
291+
❌ Making up classes like `.button-primary`, `.op-button`, `.card-primary`
292+
✅ Use ONLY the actual Optics component HTML/CSS from https://docs.optics.rolemodel.design
293+
✅ Optics components have specific HTML structure - don't invent your own
294+
290295
## 📚 Token Discovery Workflow
291296

292297
**Step 1: Identify what you need**

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "optics-mcp",
3-
"version": "0.2.3",
3+
"version": "0.2.4",
44
"description": "MCP Server for Optics Design System documentation and token usage with AI-optimized comprehension guide",
55
"main": "dist/index.js",
66
"type": "module",

src/index.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -289,10 +289,15 @@ border-color: var(--op-color-neutral-plus-four); /* Light border */
289289
❌ \`var(--color-primary)\`
290290
✅ \`var(--op-color-primary-base)\`
291291
292-
### Mistake 4: Not Using "On" Tokens for Text
292+
### Mistake 4: Not Using \"On\" Tokens for Text
293293
❌ Using arbitrary text colors on colored backgrounds
294294
✅ Using the matching \`-on-\` token: \`--op-color-primary-on-base\` on \`--op-color-primary-base\`
295295
296+
### Mistake 5: Inventing Component Classes
297+
❌ Making up classes like \`.button-primary\`, \`.op-button\`, \`.card-primary\`
298+
✅ Use ONLY the actual Optics component HTML/CSS from https://docs.optics.rolemodel.design
299+
✅ Optics components have specific HTML structure - don't invent your own
300+
296301
## 🎯 Quick Reference
297302
298303
### Most Common Tokens
@@ -812,7 +817,7 @@ server.setRequestHandler(ListToolsRequestSchema, async () => {
812817
},
813818
{
814819
name: 'generate_theme',
815-
description: 'Generate a custom theme with CSS variables and Figma Variables JSON',
820+
description: 'Generate a custom Optics theme with CSS variable overrides. Includes installation instructions for @rolemodel/optics via npm or CDN (jsDelivr/unpkg). Output includes complete setup guide with actual Optics token names.',
816821
inputSchema: {
817822
type: 'object',
818823
properties: {

src/tools/theme-generator.ts

Lines changed: 44 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,38 @@ function generateDocumentation(themeName: string, tokens: DesignToken[]): string
263263
`# ${themeName} Theme`,
264264
'',
265265
'## Overview',
266-
'This theme was generated by Optics MCP and includes a complete set of design tokens.',
266+
'This theme was generated by Optics MCP and uses the Optics Design System tokens.',
267+
'',
268+
'## Step 1: Install Optics Design System',
269+
'',
270+
'### Option A: Via npm (Recommended)',
271+
'```bash',
272+
'npm install @rolemodel/optics',
273+
'```',
274+
'',
275+
'Then import in your CSS:',
276+
'```css',
277+
'@import "@rolemodel/optics/dist/optics.css";',
278+
'```',
279+
'',
280+
'### Option B: Via CDN (jsDelivr)',
281+
'```html',
282+
'<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@rolemodel/optics@latest/dist/optics.css">',
283+
'```',
284+
'',
285+
'### Option C: Via unpkg',
286+
'```html',
287+
'<link rel="stylesheet" href="https://unpkg.com/@rolemodel/optics@latest/dist/optics.css">',
288+
'```',
289+
'',
290+
'## Step 2: Add Your Custom Theme Overrides',
291+
'',
292+
'Create a `theme.css` file with the custom HSL color values below and load it AFTER Optics:',
293+
'',
294+
'```html',
295+
'<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@rolemodel/optics@latest/dist/optics.css">',
296+
'<link rel="stylesheet" href="./theme.css">',
297+
'```',
267298
'',
268299
'## Token Summary',
269300
''
@@ -274,17 +305,19 @@ function generateDocumentation(themeName: string, tokens: DesignToken[]): string
274305
}
275306

276307
lines.push('');
277-
lines.push('## Usage');
308+
lines.push('## Step 3: Using Optics Components');
278309
lines.push('');
279-
lines.push('### CSS Variables');
280-
lines.push('```css');
281-
lines.push('/* Use tokens with var() */');
282-
lines.push('.button {');
283-
lines.push(' background-color: var(--color-primary);');
284-
lines.push(' padding: var(--spacing-md);');
285-
lines.push(' border-radius: var(--border-radius-md);');
286-
lines.push('}');
287-
lines.push('```');
310+
lines.push('**IMPORTANT:** Optics has pre-built components with specific HTML structure and CSS classes.');
311+
lines.push('');
312+
lines.push('Do NOT make up CSS classes. Use the actual Optics components and their documentation:');
313+
lines.push('');
314+
lines.push('**Component Documentation:** https://docs.optics.rolemodel.design');
315+
lines.push('');
316+
lines.push('Your custom theme will automatically apply to all Optics components through the HSL base values.');
317+
lines.push('');
318+
lines.push('### Example: Using an Optics Button');
319+
lines.push('Refer to the Optics documentation for the actual button HTML structure and CSS classes.');
320+
lines.push('Your theme colors will apply automatically through the `--op-color-primary-*` variables.');
288321
lines.push('');
289322
lines.push('### Figma Variables');
290323
lines.push('Import the `figma-variables.json` file into Figma:');

0 commit comments

Comments
 (0)