用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/megazear7/canzeltly --skill styles-and-css-variables命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
正在显示 SKILL.md
基于 SOC 职业分类
| name | styles-and-css-variables |
| description | Guidelines for styling components and using CSS variables |
This skill covers the styling conventions and best practices for the Canzeltly application, including the use of CSS variables and global styles.
All styling in the Canzeltly application uses CSS custom properties (variables) defined in static/app.css. These variables ensure consistent theming and easy maintenance.
Never use CSS variables that do not exist in static/app.css. Always check the file for available variables before using them. Using non-existent variables will result in undefined styling and potential layout issues.
--color-1, --color-1-light, --color-1-dark, --color-2, --color-2-light, --color-2-dark--color-primary-surface, --color-primary-text, --color-primary-text-muted, --color-primary-text-bold--color-secondary-surface, --color-secondary-text, --color-secondary-text-muted, --color-secondary-text-bold--color-accent, --color-error, --color-danger, --color-warning, --color-success--size-nano, --size-tiny, --size-small, --size-medium, --size-large, --size-xl, --size-2x, --size-3x, --size-4x, --size-5x, --size-6x, --size-7x, --size-8x--font-tiny, --font-small, --font-medium, --font-large, --font-xl--font-family: The primary font family (Inter, sans-serif)--line-height: Standard line height (1.6)--content-width: Maximum content width (1280px)--border-radius-medium, --border-radius-large: Border radius values--border-normal, --border-active: Border styles--shadow-normal, --shadow-active, --shadow-hover, --shadow-inverse-normal, --shadow-inverse-active, --shadow-inverse-hover--time-normal, --transition-all, --transition-shadow--transform-hover.my-component {
background-color: var(--color-primary-surface);
color: var(--color-primary-text);
padding: var(--size-medium);
border-radius: var(--border-radius-medium);
box-shadow: var(--shadow-normal);
transition: var(--transition-all);
}
.my-component:hover {
box-shadow: var(--shadow-hover);
transform: var(--transform-hover);
}
Global styles for common HTML elements are defined in src/client/styles.global.ts. This file contains styles for elements like <button>, <a>, <h1>, <p>, etc.
<button>, <a>, and other common HTML elements, styling must be done in src/client/styles.global.ts rather than in individual components, unless there is a specific need for component-level overrides.To add or modify global styles, edit src/client/styles.global.ts:
import { css } from "lit";
export const globalStyles = css`
/* Existing styles... */
/* Add new styles here */
.custom-class {
background-color: var(--color-accent);
}
`;
For styles unique to a component, define them within the component file using the static styles property:
import { css, LitElement } from "lit";
@customElement("my-component")
export class MyComponent extends LitElement {
static override styles = [
globalStyles, // Always include global styles
css`
.component-specific {
/* Component-specific styles using CSS variables */
background-color: var(--color-secondary-surface);
}
`,
];
// Component implementation...
}
static/app.css.If you need a new CSS variable:
static/app.css with an appropriate name and value.Example addition to static/app.css:
/* In static/app.css */
--color-tertiary-surface: #36393f;
--size-huge: 400px;
Then update this document accordingly.
color: red; instead of color: var(--color-error);padding: 10px; instead of padding: var(--size-small);var(--color-blue) when only defined colors are available