自定义主题
This guide explains how to match the Casdoor pages to your brand by setting the style, the primary color, the border radius, and the compact mode.
学习成果
- 了解主题的三个层级。
- 设置组织的主题。
- 设置单个应用程序的主题。
所需条件
- 拥有 Casdoor 管理控制台的管理员访问权限
主题层级
| 层级 | Where you set it | Where it applies |
|---|---|---|
| 全局 | In the source code only, in web/src/Conf.ts | Every organization that has no theme of its own |
| 选择组织 | Edit page of the organization | All pages of the admin console for members of the organization, and the entry pages (sign-in, sign-up, forgot password, and so on) of the applications that follow the organization theme |
| 可以访问的应用 | Edit page of the application | The entry pages of that application only |
主题设置
| Setting | Description |
|---|---|
| Theme | 页面样式。Default 遵循访客选择的浅色或深色模式。Dark 始终显示深色模式并将边框半径设置为 2。Document 将主色设置为绿色并将边框半径设置为 4。Blossom 将主色设置为粉色并将边框半径设置为 16。选择样式后,您可以更改主色和边框半径 |
| Primary color | 按钮、链接和其他高亮元素的颜色。可选择预设颜色或输入任意颜色 |
| Border radius | 圆角的圆润程度,单位为像素 |
| Is compact | 以较小的文本和更紧凑的间距显示页面 |
设置组织的主题
- 在 Casdoor 管理控制台中,打开组织的编辑页面。
- 在 Advanced 选项卡中,于 Customize theme 下关闭 Follow global theme,并设置主题设置。
- 保存组织。

如果您编辑的是当前登录的组织,更改将立即生效。否则,请登录到该组织以查看主题。
设置应用程序的主题
-
打开应用的编辑页面。
-
关闭 Follow organization theme,并在主题编辑器中设置主题设置。
-
在应用的预览面板中检查结果。

-
保存应用。