無論在 OBS 瀏覽器來源、Chrome 擴充功能還是桌面應用程式中載入 dock.html 和 featured.html,都可使用自己的字型。
dock.html 或 featured.html ,可透過 URL 參數或 OBS 自訂 CSS 實作。
featured.html 疊加畫面,套用了 &googlefont=Pacifico 已套用 — 自行託管的字型也可透過下列方式使用: @font-face.你需要字型檔案的直接 HTTPS 連結。請選擇允許外連存取/CORS 的託管服務,讓 OBS 或應用程式中的瀏覽器能夠取得該檔案。
使用下列規則定義字型: @font-face 並指向託管的檔案,然後透過下列屬性讓疊加畫面使用它: --font-family.
@font-face {
font-family: 'MyDockFont';
src: url('https://your-site.example/fonts/MyDockFont.woff2') format('woff2');
font-style: normal;
font-weight: 400;
}
/* Optional second weight */
@font-face {
font-family: 'MyDockFont';
src: url('https://your-site.example/fonts/MyDockFont-Bold.woff2') format('woff2');
font-style: normal;
font-weight: 700;
}
:root {
--font-family: 'MyDockFont', 'Segoe UI', 'Arial Unicode MS', sans-serif;
--comment-font-size: 28px;
--author-font-size: 24px;
--message-line-height: 32px;
}
需要多種字型(例如亞美尼亞文、俄文和拉丁文)?分別宣告每個 font-face,並在下列屬性中列出: --font-family ,例如 'FontA', 'FontB', 'FontC', sans-serif。缺少某個字形時,瀏覽器會自動使用備用字型。
&css=https://your-site.example/my-font.css 到頁面 URL:
https://socialstream.ninja/dock.html?session=YOURSESSION&css=https://your-site.example/my-font.css https://socialstream.ninja/featured.html?session=YOURSESSION&css=https://your-site.example/my-font.css
&css= ,或使用下列參數傳入 base64 編碼的 CSS: &b64css= (兩個頁面均支援)。&font=YourInstalledFont 使用系統字型名稱,而 &googlefont=Noto+Sans+Armenian,Noto+Sans 可載入 Google Fonts,適合不想自行託管的情況。這些選項在 Chrome 擴充功能、Electron 應用程式和託管網站中的運作方式相同,因為它們都載入相同的 dock.html/featured.html 檔案。
兩個頁面使用的核心排版變數:
:root {
--font-family: 'MyDockFont', 'FontB', sans-serif;
--comment-font-size: 28px; /* message text size */
--author-font-size: 24px; /* name text size */
--comment-font-weight: 600; /* featured.html */
--author-font-weight: 700; /* featured.html */
--message-font-weight: 500; /* dock.html */
--name-font-weight: 700; /* dock.html */
--comment-color: #ffffff;
--author-color: #ffe08a;
--comment-bg-color: #161616;
--author-bg-color: #202020;
}
僅適用於停駐面板的額外選項: --stylized-emoji, --stylized-img, --text-stroke-width, --text-shadow,以及列顏色(--highlight-base, --highlight-base2,再加上 compact 等變體)。
精選訊息版面配置調整: 調整 --comment-width, --comment-padding, --comment-area-bottom,以及 --comment-area-height ,無需編輯 HTML 即可重新定位下三分之一字幕區塊。
將 CSS 變更與現有 URL 選項搭配使用,例如 &scale, &compact,或 &hidesource ,用於調整停駐面板版面配置。
https://socialstream.ninja/fonts.html ,在測試時確認系統字型可見 &font=.@font-face 程式碼區塊和 --font-family;名稱不符是最常見的問題。