問題:Plurk 自訂佈景只套用在主頁面
Plurk 允許使用者自訂佈景主題(包含 CSS),但這個主題只會在主 timeline 頁面生效。 當你點進單一噗的頁面(獨立分頁開啟)時,自訂樣式就完全失效了, 畫面回到刺眼的白底介面。
在暗處盯著白底螢幕看回應,眼睛真的很不舒服。 所以這篇文章提供兩種解法:純 CSS 版本(適合主頁面)和 Tampermonkey 版本(可套用到所有頁面)。
解法一:CSS(貼到 Plurk 佈景設定)
進入 Plurk 設定 → 佈景 → 自訂 CSS,貼入以下樣式:
/* Plurk Dark Mode - 主頁面 */
body, #main_content {
background-color: #1a1a1a !important;
color: #eee !important;
}
.content_holder, .plurk_cnt, .response_cnt {
background: #2a2a2a !important;
color: #eee !important;
}
.input_holder, .plurk_add_response {
background: #333 !important;
color: #eee !important;
}
a { color: #7ab8ff !important; }
a:hover { color: #aacfff !important; }
解法二:Tampermonkey(套用到所有 Plurk 頁面)
安裝 Tampermonkey 後新增以下腳本:
// ==UserScript==
// @name Plurk Dark Mode
// @namespace http://tampermonkey.net/
// @version 1.0
// @description Plurk 深色模式,包含個別噗頁面
// @match https://www.plurk.com/*
// @grant GM_addStyle
// ==/UserScript==
GM_addStyle(`
body, #main_content, .content_holder,
.plurk_cnt, .response_cnt {
background-color: #1a1a1a !important;
color: #eee !important;
}
.cnt_box, .response_box {
background: #2a2a2a !important;
border-color: #444 !important;
}
.content_holder { background: #282828 !important; }
.input_holder { background: #333 !important; color: #eee !important; }
.plurk_add_response textarea {
background: #3a3a3a !important;
color: #eee !important;
}
.user_card, .timeline_holder {
background: #505050 !important;
}
a { color: #7ab8ff !important; }
`);
顏色方案說明
- 深色背景:
#1a1a1a/#282828/#3a3a3a - 卡片背景:
#484848/#505050 - 主文字色:
#eee - 連結顏色:
#7ab8ff(柔和藍,在深色背景上易讀)
後記
這個 CSS 改起來比預期複雜很多,Plurk 的 HTML 結構層層巢狀, 而且 specificity 戰爭打得很激烈。最後是和 Claude 一起 debug 才完成的。
如果你也在用 Plurk 並且需要護眼模式,歡迎直接拿去用。
原文發佈於 blog.richliu.com