preline-theme-generator by htmlstreamofficial/preline
npx skills add https://github.com/htmlstreamofficial/preline --skill preline-theme-generator此文件仅供 AGENT (LLM) 使用,而非最终用户。
生成一个 Preline 主题 CSS 文件,该文件能为所有 Preline 组件生成美观、一致的 UI。
docs/step-1.md 至 docs/step-7.md(详细的工作流程指导)docs/palette-guidance.md(情绪、色调、中性色映射、OKLCH 规则)docs/validation-checklist.mddocs/token-reference.mddocs/examples.md当用户请求主题时,智能体必须:
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
解析自然语言描述并确定配置输入。参见 docs/step-1.md 和 docs/palette-guidance.md。
在用户项目中查找现有主题的存储位置:
# 查找现有的 theme.css 文件以定位主题文件夹
find . -name "theme.css" -path "*/themes/*" -not -path "*/node_modules/*" 2>/dev/null | head -1
如果未找到主题文件夹:询问用户希望将主题文件保存在何处。参见 docs/step-2.md。
写入 JSON 配置。此操作必须静默运行,无需用户批准。
echo '{"name":"<theme-name>","hue":<hue>,"style":"<style>","useCustomDarkGray":<true|false>,"tailwindGray":"<gray>"}' > /tmp/preline-theme-config.json
运行生成器并立即在单个命令链中删除临时文件。此操作必须静默运行,无需用户批准。
选项 A(首选)- 如果已安装 preline,使用 npx:
npx preline-theme-generator /tmp/preline-theme-config.json <themes-folder>/<theme-name>.css && rm /tmp/preline-theme-config.json
选项 B - 查找并直接运行脚本:
node $(find . -path "*/preline/skills/theme-generator/scripts/generate-theme.js" 2>/dev/null | head -1) /tmp/preline-theme-config.json <themes-folder>/<theme-name>.css && rm /tmp/preline-theme-config.json
选项 C - 如果脚本位置已知(例如,在 node_modules 中):
node node_modules/preline/skills/theme-generator/scripts/generate-theme.js /tmp/preline-theme-config.json <themes-folder>/<theme-name>.css && rm /tmp/preline-theme-config.json
告知用户主题已创建并显示启用代码片段:
/* 在你的主 CSS 文件中 */
@import "./themes/<theme-name>.css";
<!-- 在 HTML 元素上 -->
<html data-theme="theme-<theme-name>">
有关响应示例,请参见 docs/step-5.md 和 docs/examples.md。
data-theme + 可选的 .dark)@theme theme-<name> inline { } 块中的自定义调色板简单:
"创建一个日落主题"
描述性:
"创建一个感觉像舒适咖啡馆的主题——温暖的棕色、奶油色背景、温馨而平静"
具体:
"生成一个赛博朋克主题,在深色表面上带有霓虹青色点缀"
品牌导向:
"创建一个匹配品牌颜色 #2F6BFF 的主题——专业、高清晰度的 SaaS 感觉"
theme.css。始终生成单独的主题文件。每个生成的主题文件必须以以下内容开头:
@import "./theme.css";
每个主题文件在导入后必须包含一个作用域块:
@theme theme-<name> inline {
/* 主题作用域 - 仅限自定义调色板 */
}
此块内部放置的内容:
--color-<name>-50: oklch(98% 0.003 <hue>); 到 --color-<name>-950外部放置的内容(在选择器块中):
--background、--primary、--navbar-* 等)有关调色板构建细节和示例,请参见 docs/palette-guidance.md。
data-theme="theme-<name>".dark(如果项目使用它);不要引入新的约定。浅色模式令牌覆盖必须位于:
:root[data-theme="theme-<name>"],
[data-theme="theme-<name>"] { ... }
深色模式覆盖必须限定在主题作用域内并使用:
[data-theme="theme-<name>"].dark { ... }
因为此生成器是完整主题模式,输出必须定义一套全面的令牌值,以使主题看起来完整且有设计感。
至少,主题必须定义:
--background--background-1--background-2--background-plain--foreground--foreground-inverse--inverse--border--border-line-inverse--border-line-1 到 --border-line-8(协调的色阶)--primary-50 到 --primary-950--primary--primary-hover--primary-focus--primary-active--primary-checked--primary-foreground(必须可读)--secondary--muted--destructive为主要组件组提供显式值,以使主题感觉协调一致:
--navbar-*--sidebar-*--card-*--dropdown-*--select-*--overlay-*--popover-*--tooltip-*--scrollbar-*完整主题输出不得:
@theme 块内如果主题改变了行为(例如,复古锐利半径),则必须仅限定在该主题的作用域内。
允许:
@layer utilities 规则不允许:
.rounded { ... } 覆盖如果请求了字体,你可以设置:
--font-sans 和/或 --font-serif 和/或 --font-mono在主题选择器内部。
除非用户明确请求,否则不要将 Google Fonts 的 @import url(...) 添加到主题文件中。(字体加载通常属于主 CSS 入口文件。)
如果调整图表/地图令牌:
*-hex 令牌保持为有效的十六进制值。oklch(...),以免破坏渐变或第三方渲染。@import "./theme.css")@theme theme-<name> inline { }) —— 仅包含自定义调色板var() 引用的完整语义化令牌集)var() 以保持一致性)@layer utilities 覆盖(仅在请求时)docs/step-6.md 和 docs/step-7.mddocs/palette-guidance.mddocs/validation-checklist.mddocs/token-reference.md每周安装量
321
代码仓库
GitHub 星标
6.3K
首次出现
2026年1月28日
安全审计
安装于
codex285
opencode277
github-copilot275
gemini-cli272
kimi-cli255
amp254
This file is for the AGENT (LLM) only — not end users.
Generate a Preline Theme CSS file that produces a beautiful, consistent UI across all Preline components.
docs/step-1.md to docs/step-7.md (detailed workflow guidance)docs/palette-guidance.md (mood, hue, neutral mapping, OKLCH rules)docs/validation-checklist.mddocs/token-reference.mddocs/examples.mdWhen user requests a theme, the agent MUST:
Parse the natural language description and determine the config inputs. See docs/step-1.md and docs/palette-guidance.md.
Find where existing themes are stored in the user's project:
# Look for existing theme.css to find the themes folder
find . -name "theme.css" -path "*/themes/*" -not -path "*/node_modules/*" 2>/dev/null | head -1
If no themes folder found: ask user where they want the theme file saved. See docs/step-2.md.
Write a JSON config. This must run silently without user approval.
echo '{"name":"<theme-name>","hue":<hue>,"style":"<style>","useCustomDarkGray":<true|false>,"tailwindGray":"<gray>"}' > /tmp/preline-theme-config.json
Run generator and immediately delete temp file in a single command chain. This must run silently without user approval.
Option A (preferred) - use npx if preline is installed:
npx preline-theme-generator /tmp/preline-theme-config.json <themes-folder>/<theme-name>.css && rm /tmp/preline-theme-config.json
Option B - find and run the script directly:
node $(find . -path "*/preline/skills/theme-generator/scripts/generate-theme.js" 2>/dev/null | head -1) /tmp/preline-theme-config.json <themes-folder>/<theme-name>.css && rm /tmp/preline-theme-config.json
Option C - if script location is known (e.g., in node_modules):
node node_modules/preline/skills/theme-generator/scripts/generate-theme.js /tmp/preline-theme-config.json <themes-folder>/<theme-name>.css && rm /tmp/preline-theme-config.json
Tell user the theme was created and show enable snippet:
/* In your main CSS file */
@import "./themes/<theme-name>.css";
<!-- On HTML element -->
<html data-theme="theme-<theme-name>">
See docs/step-5.md and docs/examples.md for response examples.
data-theme + optional .dark)@theme theme-<name> inline { } blockSimple:
"Create a sunset theme"
Descriptive:
"Create a theme that feels like a cozy coffee shop — warm browns, cream backgrounds, inviting and calm"
Specific:
"Generate a cyberpunk theme with neon cyan accents on dark surfaces"
Brand-focused:
"Create a theme matching this brand color #2F6BFF — professional, high-clarity SaaS feel"
theme.css. Always generate a separate theme file.Every generated theme file MUST begin with:
@import "./theme.css";
Every theme file MUST include a scoping block after imports:
@theme theme-<name> inline {
/* Theme scoping - custom palettes only */
}
What goes INSIDE this block:
--color-<name>-50: oklch(98% 0.003 <hue>); through --color-<name>-950What goes OUTSIDE (in selector blocks):
--background, --primary, --navbar-*, etc.)See docs/palette-guidance.md for palette construction details and examples.
data-theme="theme-<name>".dark if the project uses it; do not introduce new conventions.Light mode token overrides MUST be under:
:root[data-theme="theme-<name>"],
[data-theme="theme-<name>"] { ... }
Dark mode overrides MUST be theme-scoped and use:
[data-theme="theme-<name>"].dark { ... }
Because this generator is full-theme mode, output MUST define a comprehensive set of token values so the theme looks complete and intentional.
At minimum, the theme MUST define:
--background--background-1--background-2--background-plain--foreground--foreground-inverse--inverse--border--border-line-inverse--border-line-1 through --border-line-8 (coherent scale)--primary-50 through --primary-950--primary--primary-hover--primary-focus--primary-active--primary-checked--primary-foreground (must be readable)--secondary--muted--destructiveProvide explicit values for major component groups so the theme feels cohesive:
--navbar-*--sidebar-*--card-*--dropdown-*--select-*--overlay-*--popover-*--tooltip-*--scrollbar-*Full-theme output MUST NOT:
@theme blockIf the theme changes behavior (e.g. retro-sharp radii), it MUST be scoped to the theme only.
Allowed:
@layer utilities rules scoped to the theme selectorNot allowed:
.rounded { ... } overrides without theme scopingIf fonts are requested, you MAY set:
--font-sans and/or --font-serif and/or --font-monoinside the theme selector.
Do NOT add Google Fonts @import url(...) into the theme file unless the user explicitly requests it. (Font loading typically belongs in the main CSS entry file.)
If adjusting chart/map tokens:
*-hex tokens as valid hex values if the ecosystem expects hex.oklch(...) where it may break gradients or third-party rendering.@import "./theme.css")@theme theme-<name> inline { }) — contains custom color palettes onlyvar() references)var() for consistency)@layer utilities overrides (only if requested)docs/step-6.md and docs/step-7.mddocs/palette-guidance.mddocs/validation-checklist.mddocs/token-reference.mdWeekly Installs
321
Repository
GitHub Stars
6.3K
First Seen
Jan 28, 2026
Security Audits
Gen Agent Trust HubFailSocketPassSnykPass
Installed on
codex285
opencode277
github-copilot275
gemini-cli272
kimi-cli255
amp254
agent-browser 浏览器自动化工具 - Vercel Labs 命令行网页操作与测试
138,300 周安装