2026-06-12 bouzuya/shiori-web への color-scheme 設定の追加
bouzuya/shiori-web を進めた。
shiori-web は以前つくった bouzuya/shiori というブックマーク管理 をする Android アプリの Web 版。 Rust で書かれた JavaScript-free な Web アプリケーション。
今日は color scheme の設定を追加した。
一般的な Web サービスにある「ライト」「ダーク」「システム設定に従う」みたいなものは使っているけど、内部実装については自身でしたことがなかった。
ライト・ダークは変数を切り替えるなりなんなりで実装可能なのは分かるが、システム設定がどうなっているのかが気になっていた。どうも prefers-color-scheme CSS media feature というのがあるらしい。 @media (prefes-color-scheme: light) { /* ... */ } のような形でシステム設定がどうかで分岐できる。
https://developer.mozilla.org/ja/docs/Web/CSS/Reference/At-rules/@media/prefers-color-scheme
意外と実装する機会がなかったけど、便利そうだ。
今日のコミット。
- shiori-web 22 commits
- Add
PUT /settings - Add /settings
- Add FirestoreUserSettingsRepository
- Add UserSettingsDocumentData::from_user_settings
- Fix clippy warnings
- Add UserSettingsRepository
- Add UserSettings
- Update clippy settings
- Fix to remove wildcard import
- Fix to use
use crate::Xxxinstead of crate::read_models::Xxx - Update AGENTS.md
- Fix to use
use crate::Xxxinstead of crate::entities::Xxx - Add Collection suffix to FirestoreCollection impls
- Rename theme attr to color-scheme attr
- Add AppState::user_settings_reader
- Add FirestoreUserSettingsReader
- Add UserSettingsCollection
- Add UserSettingsDocumentData
- Add UserSettingsReader
- Add UserSettingsView
- Add kernel::ColorScheme
- Update AGENTS.md
- Add