一键导入
css-styling
Apply DjangoSpire app CSS variables in templates instead of inline styles
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Apply DjangoSpire app CSS variables in templates instead of inline styles
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Best practices for writing Django tests (updated template)
GlueFetchHelper patterns for making AJAX calls in templates
Advanced seeding patterns for linking specific foreign keys
Django URL configuration patterns, namespaces, and nested structure conventions
Best practices for AI bots, prompts, and intel in scope_of_work
Examples on how we build our form views.
| name | css-styling |
| description | Apply DjangoSpire app CSS variables in templates instead of inline styles |
DjangoSpire provides a layered CSS system that allows your project to define a theme, and DjangoSpire components automatically adapt.
Never use:
style attributes for colors/backgrounds#198754 or rgba(0,0,0,0.1)<!-- DO -->
<div class="card shadow border-0 rounded-3 bg-app-layer-two text-center text-app-default-text-color p-4">
Content
</div>
<!-- DON'T -->
<div class="card" style="background-color: #FBFCF8; color: #2C3E36;">
Content
</div>
DjangoSpire defines CSS classes that reference theme variables. To find what classes exist:
DjangoSpire Core (built-in classes):
.venv/Lib/site-packages/django_spire/core/static/django_spire/css/app-background.css → bg-app-* classesapp-text.css → text-app-* classesapp-border.css → border-app-* classesYour Project Theme (custom variables):
static_files/django_spire/css/themes/default/app-light.cssstatic_files/django_spire/css/themes/default/app-dark.cssAll app-* classes automatically use your theme's CSS variables, so they work in both light and dark modes.
<!-- Text colors -->
<span class="text-app-primary">Primary</span>
<span class="text-app-success">Success</span>
<span class="text-app-danger">Danger</span>
<span class="text-app-default-text-color">Default text</span>
<!-- Backgrounds -->
<div class="bg-app-layer-one">...</div>
<div class="bg-app-layer-two">...</div>
<div class="bg-app-primary-soft">Soft primary</div>
<!-- Borders -->
<div class="border-app-primary">...</div>
<div class="border-0">No border</div>
<!-- Combined -->
<div class="card shadow bg-app-layer-two text-app-default-text-color rounded-3">
max-height: calc(100vh - 120px)style="background-color: #000" for labels# hex codes, rgb(, rgba( in HTMLstyle="color: ...", it should be a classbg-app-layer-two over custom CSSvar(--app-border-color, rgba(0,0,0,0.1))