ワンクリックで
styles-and-css-variables
Guidelines for styling components and using CSS variables
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
メニュー
Guidelines for styling components and using CSS variables
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
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 availableCreate and update instructions, skills, and prompts for GitHub Copilot
Create a new feature
How to create a new type of game object
How to create a new type of affect
How to create a new type of affector
How to create a new event