Skip to content
Open
25 changes: 25 additions & 0 deletions packages/design-system/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,38 @@ For the palette and fonts without the Tailwind layers or icon plugins:
@import '@comfyorg/design-system/css/base.css';
```

## Baseline for other apps

An app with its own Tailwind build and global styles, such as Comfy Desktop,
imports the baseline instead of `style.css`, which adds ComfyUI's app-wide rules:

```css
@import 'tailwindcss';
@import '@comfyorg/design-system/css/baseline.css';

:root {
--background: oklch(0.19 0.003 285);
--primary: var(--foreground);
}
```

The baseline holds the palette, the semantic colors components use, their icon
plugins, stacking layers, text sizes, shadows and scrollbar utilities, and
registers the compiled component sources for Tailwind. Override only the
variables that differ: `--background`, `--foreground`, `--card`, `--popover`,
`--primary`, `--secondary`, `--muted`, `--muted-foreground`, `--accent`,
`--destructive`, `--border`, `--input`, `--ring`, `--warning` and
`--shadow-color`. The host provides fonts. Published consumers still import
`components.css`, as described under [Vue components](#vue-components).

## Exports

| Path | Contents |
| ------------------------------- | -------------------------------------------------------------------------------- |
| `./css/style.css` | Full theme — palette, fonts, Tailwind layers, icon plugins |
| `./css/theme.css` | Full theme without automatic component source registration |
| `./css/base.css` | Palette and fonts only |
| `./css/baseline.css` | Component colors, plugins, tokens and utilities for apps other than ComfyUI |
| `./css/_palette.css` | Color variables |
| `./css/fonts.css` | Font faces |
| `./css/_deprecated-aliases.css` | Deprecated variable names kept for extensions; scheduled for removal |
Expand Down
143 changes: 143 additions & 0 deletions packages/design-system/src/css/_baseline.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
@import './_palette.css';
@import 'tw-animate-css';

@plugin "./iconifyDynamicPlugin.ts";

@plugin "./lucideStrokePlugin.js";

@custom-variant touch (@media (hover: none));

@theme {
--z-index-panel: 1100;
--z-index-education: 1500;
--z-index-onboarding: 1600;
--z-index-overlay: 1700;
--z-index-tour: 1800;
--z-index-toast: 9999;
--z-index-blocking: 10000;

--text-2xs: 0.625rem;
--text-2xs--line-height: calc(1 / 0.625);

--text-3xs: 0.5625rem;
--text-3xs--line-height: calc(1 / 0.5625);

--color-credit: #ddbd31;
--color-warning-foreground: var(--color-charcoal-800);

--shadow-2xs: 0 1px 1px var(--shadow-color);
--shadow-xs: 0 1px 2px var(--shadow-color);
--shadow-sm: 0 1px 4px var(--shadow-color);
--shadow-md: 1px 1px 8px 0 var(--shadow-color);
--shadow-lg: 0 2px 16px 0 var(--shadow-color);
--shadow-xl: 0 8px 24px var(--shadow-color);
--shadow-2xl: 0 24px 80px var(--shadow-color);
--drop-shadow-xs: 0 1px 1px var(--shadow-color);
--drop-shadow-sm: 1px 1px 4px var(--shadow-color);
--drop-shadow-md: 1px 1px 8px var(--shadow-color);
--drop-shadow-lg: 0 9px 7px var(--shadow-color);

--color-success: var(--color-jade-600);
}

:root {
color-scheme: dark;

--background: var(--color-charcoal-800);
--foreground: var(--color-white);
--card: var(--color-charcoal-600);
--primary: var(--color-azure-600);
--secondary: var(--color-charcoal-600);
--muted: var(--color-charcoal-300);
--muted-foreground: var(--color-smoke-800);
--accent: var(--color-charcoal-400);
--destructive: var(--color-coral-700);
--border: var(--color-charcoal-200);
--ring: var(--muted-foreground);
--popover: var(--background);
--input: var(--accent);

--warning: var(--color-gold-600);
--shadow-color: rgb(0 0 0 / 0.4);
}

@theme inline {
--color-background: var(--background);
--color-foreground: var(--foreground);
--color-card: var(--card);
--color-popover: var(--popover);
--color-primary: var(--primary);
--color-secondary: var(--secondary);
--color-muted: var(--muted);
--color-muted-foreground: var(--muted-foreground);
--color-accent: var(--accent);
--color-destructive: var(--destructive);
--color-border: var(--border);
--color-input: var(--input);
--color-ring: var(--ring);
--color-warning: var(--warning);
}

@layer base {
*,
::before,
::after {
box-sizing: border-box;
border-color: var(--border);
}

button,
input,
select,
optgroup,
textarea,
::file-selector-button {
font: inherit;
font-feature-settings: inherit;
font-variation-settings: inherit;
letter-spacing: inherit;
color: inherit;
}
}

@utility highlight {
background-color: color-mix(in srgb, currentColor 20%, transparent);
font-weight: 700;
border-radius: 0.25rem;
}

@utility scrollbar-hide {
scrollbar-width: none;
&::-webkit-scrollbar {
width: 1px;
}
&::-webkit-scrollbar-thumb {
background-color: transparent;
}
}

@utility scrollbar-custom {
overflow-y: auto;
scrollbar-width: thin;
scrollbar-color: var(--muted) transparent;

&::-webkit-scrollbar {
width: 10px;
height: 10px;
background-color: transparent;
}
&::-webkit-scrollbar-track {
background: transparent;
}
&::-webkit-scrollbar-thumb {
background: var(--muted);
border-radius: 9999px;
border: 2px solid transparent;
}
&::-webkit-scrollbar-thumb:hover {
background: var(--muted);
}
&::-webkit-scrollbar-corner {
background: transparent;
}
}
3 changes: 3 additions & 0 deletions packages/design-system/src/css/baseline.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
@import './_baseline.css';

@source '../../dist';
121 changes: 1 addition & 120 deletions packages/design-system/src/css/theme.css
Original file line number Diff line number Diff line change
@@ -1,17 +1,12 @@
@layer theme, base, components, utilities;

@import './fonts.css';
@import './_palette.css';
@import './_baseline.css';
@import './_deprecated-aliases.css';
@import './_legacy-palette.css';
@import 'tailwindcss/theme' layer(theme);
@import 'tailwindcss/preflight' layer(base);
@import 'tailwindcss/utilities' layer(utilities);
@import 'tw-animate-css';

@plugin "./iconifyDynamicPlugin.ts";

@plugin "./lucideStrokePlugin.js";

@layer base {
*,
Expand All @@ -27,50 +22,15 @@
/* Badge icon names are built at runtime, so the scanner cannot find them. */
@source inline("icon-mask-[comfy--{3d-decomp,ai-model,anthropic,batch-images-node,bfl,bria,brightness-contrast,bytedance,canny,canny-to-image,canny-to-video,channels,chromatic-aberration,claude,comfy-c,comfy-logo,credits,depth-to-image,depth-to-video,dial,elevenlabs,extensions-blocks,file-output,frames-to-video,gemini,get-video-components,glow,grain,grok,hitpaw,ideogram,image-ai-edit,image-batch,image-blur,image-canny,image-captioning,image-collage,image-compare,image-depth,image-edit,image-inpaint,image-invert,image-outpaint,image-outpainting,image-remove-background,image-rotate,image-select-object-segmentation,image-shader,image-sharpen,image-to-3d,image-to-image,image-to-layers,image-to-video,image-upscale,image-vectorize,kling,load-3d,load-audio,load-video,lora-loader,ltxv,luma,magnific,mask,meshy,minimax,moonvalley-marey,node,open-ai-chat-node,openai,pin,pixverse,play,pose-to-image,pose-to-video,quiver,recraft,reve,rodin,runway,save-3d,save-audio,save-video,send,sora,stability-ai,template,tencent,text-prompt-enhance,text-to-3d,text-to-audio,text-to-image,text-to-video,topaz,tripo,veo,video-captioning,video-edit,video-enhance,video-extract-frame,video-inpaint,video-interpolation,video-select-object-segmentation,video-slice,video-split-screen,video-trim,video-upscale,vidu,voice-clone,wan,wavespeed,workflow}]");

@custom-variant touch (@media (hover: none));
@custom-variant triangle-icons (@container style(--node-icon-style: triangle));

@theme {
--z-index-panel: 1100;
--z-index-education: 1500;
--z-index-onboarding: 1600;
--z-index-overlay: 1700;
--z-index-tour: 1800;
--z-index-toast: 9999;
--z-index-blocking: 10000;

--shadow-2xs: 0 1px 1px var(--shadow-color);
--shadow-xs: 0 1px 2px var(--shadow-color);
--shadow-sm: 0 1px 4px var(--shadow-color);
--shadow-md: 1px 1px 8px 0 var(--shadow-color);
--shadow-lg: 0 2px 16px 0 var(--shadow-color);
--shadow-xl: 0 8px 24px var(--shadow-color);
--shadow-2xl: 0 24px 80px var(--shadow-color);
--drop-shadow-xs: 0 1px 1px var(--shadow-color);
--drop-shadow-sm: 1px 1px 4px var(--shadow-color);
--drop-shadow-md: 1px 1px 8px var(--shadow-color);
--drop-shadow-lg: 0 9px 7px var(--shadow-color);
--shadow-inset-highlight: inset 0 1px 0 0 rgb(from white r g b / 0.1);

--text-2xs: 0.625rem;
--text-2xs--line-height: calc(1 / 0.625);

--text-3xs: 0.5625rem;
--text-3xs--line-height: calc(1 / 0.5625);

--color-credit: #ddbd31;

--color-bypass: #6a246a;
--color-warning-foreground: var(--color-charcoal-800);
--color-success: var(--color-jade-600);
}

:root {
color-scheme: dark;

--background: var(--color-charcoal-800);
--foreground: var(--color-white);
--card: var(--color-charcoal-600);
--node-foreground: var(--color-smoke-700);
--node-header: var(--color-charcoal-700);
--node-border: var(--color-charcoal-100);
Expand All @@ -81,48 +41,19 @@
--node-widget-radius: 0.375rem;
--node-widget-border-width: 0;
--node-widget-gap: 0.25rem;
--primary: var(--color-azure-600);
--secondary: var(--color-charcoal-600);
--muted: var(--color-charcoal-300);
--muted-foreground: var(--color-smoke-800);
--accent: var(--color-charcoal-400);
--destructive: var(--color-coral-700);
--border: var(--color-charcoal-200);
--ring: var(--muted-foreground);
--popover: var(--background);
--input: var(--accent);
--node: var(--card);

--default-transition-duration: 0.1s;
--comfy-topbar-height: 2.5rem;
--workflow-tabs-height: 2.375rem;
--comfy-textarea-font-size: 10px;

--warning: var(--color-gold-600);
--shadow-color: rgb(0 0 0 / 0.4);
}

@theme inline {
--color-background: var(--background);
--color-foreground: var(--foreground);
--color-card: var(--card);
--color-node: var(--node);
--color-node-foreground: var(--node-foreground);
--color-node-header: var(--node-header);
--color-node-border: var(--node-border);
--color-popover: var(--popover);
--color-primary: var(--primary);
--color-secondary: var(--secondary);
--color-muted: var(--muted);
--color-muted-foreground: var(--muted-foreground);
--color-accent: var(--accent);
--color-destructive: var(--destructive);
--color-border: var(--border);
--color-input: var(--input);
--color-ring: var(--ring);

/* Semantic tokens */
--color-warning: var(--warning);
}

@utility floating-panel {
Expand All @@ -132,56 +63,6 @@
box-shadow: var(--shadow-inset-highlight), theme(boxShadow.lg);
}

@utility highlight {
background-color: color-mix(in srgb, currentColor 20%, transparent);
font-weight: 700;
border-radius: 0.25rem;
}

@utility scrollbar-hide {
scrollbar-width: none;
&::-webkit-scrollbar {
width: 1px;
}
&::-webkit-scrollbar-thumb {
background-color: transparent;
}
}

/* ===================== Scrollbar Utilities (Tailwind) =====================
Usage: Add `scrollbar-custom` class to scrollable containers.
The scrollbar styling adapts to light/dark theme automatically.
============================================================================ */

@utility scrollbar-custom {
overflow-y: auto;
/* Firefox */
scrollbar-width: thin;
scrollbar-color: var(--muted) transparent;

/* WebKit */
&::-webkit-scrollbar {
width: 10px;
height: 10px;
background-color: transparent;
}
&::-webkit-scrollbar-track {
background: transparent;
}
&::-webkit-scrollbar-thumb {
background: var(--muted);
border-radius: 9999px;
border: 2px solid transparent;
}
&::-webkit-scrollbar-thumb:hover {
background: var(--muted);
}
&::-webkit-scrollbar-corner {
background: transparent;
}
}
/* =================== End Custom Scrollbar (cross-browser) =================== */

/* Everthing below here to be cleaned up over time. */

:root[data-palette-switching] * {
Expand Down
6 changes: 6 additions & 0 deletions packages/design-system/tests/css-consumer/baseline-theme.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
@import 'tailwindcss' source(none);
@import '@comfyorg/design-system/css/baseline.css';

:root {
--background: oklch(0.19 0.003 285);
}
Loading
Loading