外观
外观设置用于控制文档站点的外观:颜色、徽标、字体、布局、顶栏和侧边栏。在 API Studio 中打开 Docs settings,然后选择 Appearance。设置旁边的预览就是文档页面本身,并提供切换选项,可查看浅色和深色模式下的效果。
更改保存后会立即生效,无需发布。Reset to defaults 会将所有设置恢复为下方所列的默认值。
下方每项设置都会列出它在 octri.json 中的键(位于 appearance 下),以及键 octri docs theme set 接受的值。
品牌
Primary colorcolour链接、侧边栏中的当前行和主要按钮。可使用任意颜色:链接会针对每种配色方案调整为该颜色的一个色调,因此在白色和深色背景上都清晰可读。
colors.primary · CLI primaryColor
Logoimage顶栏中的图片,浅色和深色模式分别上传。若未设置深色图片,则使用浅色图片。URL 最长 500 个字符。
logo.light、logo.dark · CLI logoUrl、logoUrlDark
Logo linkpath or URL点击徽标后跳转到的位置,例如营销网站。
logo.link · CLI logoHref
Show logoon or off关闭后,会改为显示项目名称和首字母,并保留图片,以便重新开启时使用。
logo.show · CLI showLogo
Faviconimage浏览器标签页中的图标。SVG 或 WebP 网站图标也会生成 PNG 副本,因为 Google 搜索结果无法显示这两种格式。
favicon · CLI faviconUrl
浅色和深色
Color schemechoice读者初始使用的配色方案。
| 值 | 含义 |
|---|---|
system | 遵循读者的操作系统设置 |
light | 始终以浅色模式启动 |
dark | 始终以深色模式启动 |
colorScheme · CLI colorScheme
Light and dark switchon or off顶栏中的切换开关,供读者切换配色方案。无论初始配色方案为何,该开关都会保持可用。
themeToggle · CLI showThemeToggle
布局
Page layoutchoice页面的框架布局方式。
| 值 | Studio 标签 | 含义 |
|---|---|---|
full | 全宽 | 侧边栏和“本页内容”导航栏贴近屏幕边缘 |
contained | 居中 | 整个页面作为一个居中的区块 |
framed | 框架 | 内容置于凸起面板上 |
floating | 悬浮 | 侧边栏作为卡片,与边缘保持间距 |
layout · CLI layout
Content widthchoice阅读栏的宽度。
| 值 | 宽度 |
|---|---|
narrow | 800px |
default | 1040px |
wide | 1280px |
contentWidth · CLI contentWidth
Border radiuschoice整个站点中圆角的程度,包括卡片、代码面板、按钮和徽章。
| 值 | 含义 |
|---|---|
sharp | 直角 |
default | 略带圆角 |
rounded | 圆角更明显,按钮和徽章会变成胶囊形 |
corners · CLI borderRadius
字体
Font familychoice正文所用的字体:manrope、inter、plus-jakarta-sans、dm-sans、system(读者自己的界面字体)或 google。
fonts.body · CLI fontFamily
Heading fontchoice标题所用的字体。body 使用正文字体,显示为 Match body。否则可选 manrope、inter、plus-jakarta-sans、dm-sans 或 google。
fonts.heading · CLI headingFont
Code fontchoice代码所用的字体:jetbrains-mono、fira-code、ibm-plex-mono、system 或 google。
fonts.code · CLI codeFont
Google fontfamily name任意 Google Fonts 字体系列,例如 Source Sans 3,供设置为 google 的字体槽使用。每个字体槽单独设置。若字体槽设为 google 且未指定字体系列,则回退到默认字体。
fonts.google.body、fonts.google.heading、fonts.google.code · CLI googleFontFamily、googleHeadingFont、googleCodeFont
文字大小
Sidebar text sizechoicesmaller、large或larger。
textSize.sidebar · CLI sidebarTextSize
Main panel text sizechoice页面本身:smaller、large或larger。
textSize.content · CLI contentTextSize
Code examples text sizechoicesmaller、large或larger。默认设置会让代码比页面文本低一层。
textSize.code · CLI codeTextSize
顶栏
Layoutchoice| 值 | Studio 标签 | 含义 |
|---|---|---|
default | 单行 | 徽标、标签页和操作按钮排列在同一行 |
stacked | 标签页置于下方 | 标签页排列在第二行 |
centered | 标签页居中 | 标签页位于行中间 |
navbar.layout · CLI navbarLayout
Searchchoice搜索框的位置。
| 值 | Studio 标签 | 含义 |
|---|---|---|
sidebar | 在侧边栏中 | 位于侧边栏顶部,在页面列表上方 |
centered | 居中 | 位于顶栏中间的输入框 |
button | 搜索按钮 | 点击按钮后展开为输入框 |
在主页等隐藏侧边栏的页面上,sidebar会导致宽屏上没有搜索功能,因此对于包含此类页面的网站,centered或button更合适。
navbar.search · CLI searchPlacement
Top bar backgroundchoice顶栏的外观。
| 值 | 含义 |
|---|---|
solid | 不透明 |
frosted | 玻璃效果:滚动时,后方页面会模糊 |
transparent | 几乎透明 |
colored | 填充 Top bar color 的颜色 |
navbar.surface · CLI navbarSurface
Top bar colorcolour当背景为colored时的填充颜色,浅色和深色模式分别设置。其他背景下此设置无效。
navbar.color.light、navbar.color.dark · CLI navbarColor、navbarColorDark
RepositoryURL在顶栏中链接到你的源代码仓库。Stars 会在链接旁显示星标数。
repository.url、repository.stars · CLI repoUrl、repoStarsEnabled
号召性用语按钮和社交链接在导航下设置。
侧边栏
Stylechoice行的绘制方式:default、bordered或minimal。预览会展示每种方式。
sidebar.style · CLI sidebarStyle
Widthchoice初始宽度。
| 值 | 宽度 |
|---|---|
compact | 240px |
default | 280px |
wide | 340px |
sidebar.width · CLI sidebarWidth
Let readers resize iton or off读者可以拖动侧边栏边缘来调整宽度。
sidebar.resizable · CLI sidebarResizable
Folder lineson or off沿着每个文件夹的子项绘制竖线。
sidebar.lines · CLI showSidebarLines
Iconson or off在每一行旁显示文件夹、页面和链接图标。
sidebar.icons · CLI showSidebarIcons
代码和页面大纲
Light themechoice浅色方案中的代码高亮:octri、github、monokai、nord或dracula。
codeTheme.light · CLI codeTheme
Dark themechoice深色方案中的代码高亮,选项与上述列表相同。
codeTheme.dark · CLI codeThemeDark
On this pageon or off页面右侧的大纲,端点页面和书面页面分别设置。
tableOfContents.endpoints、tableOfContents.pages · CLI showToc、showGuideToc
示例
以你的颜色为主题的深色网站,搜索框位于顶栏中间:
"appearance": {
"colors": { "primary": "#0e7c66" },
"colorScheme": "dark",
"navbar": { "search": "centered", "surface": "solid" },
"sidebar": { "width": "wide", "lines": true }
}在终端中执行同样的操作:
octri docs theme set primaryColor=#0e7c66 colorScheme=dark searchPlacement=centered navbarSurface=solid sidebarWidth=wide showSidebarLines=true进一步自定义
对于设置未涵盖的内容,可以使用自定义代码编写自己的 CSS。网站名称和“Powered by Octri”标识位于白标下设置。
相关
- 导航:标签页、导航按钮和社交链接。
- octri.json:以文本形式列出每项设置。
octri docs theme:在终端中查看相同的设置。