diff options
author | Vika <vika@fireburn.ru> | 2025-04-20 08:25:57 +0300 |
---|---|---|
committer | Vika <vika@fireburn.ru> | 2025-04-20 10:01:01 +0300 |
commit | 3207c8ea57eac714417494e06ce0f82864b7ff1e (patch) | |
tree | 70cfde719dd596dbe05d38276526e763d55eac1d /src/database | |
parent | b3288627d171fff9a289a56a4ae27307985f9f96 (diff) | |
download | kittybox-3207c8ea57eac714417494e06ce0f82864b7ff1e.tar.zst |
WIP: Theme support
Kittybox can now ship with several different stylesheets, provided by the renderer. Unknown stylesheets fall back to the default one, which is the same Kittybox has shipped since its inception. There's also a settings field for custom CSS, but it's not exposed anywhere yet. Change-Id: I2850dace5c40f9fed04b4651c551a861df5b83d3
Diffstat (limited to 'src/database')
-rw-r--r-- | src/database/settings.rs | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/database/settings.rs b/src/database/settings.rs index 792a155..77e5821 100644 --- a/src/database/settings.rs +++ b/src/database/settings.rs @@ -1,3 +1,5 @@ +pub use kittybox_frontend_renderer::themes::ThemeName; + mod private { pub trait Sealed {} } @@ -61,3 +63,20 @@ impl Setting for Webring { Self(data) } } + +#[derive(Debug, Default, serde::Serialize, serde::Deserialize, Clone, Copy, PartialEq, Eq)] +/// Theme setting for Kittybox, specifying the stylesheet used for laying out the website. +pub struct Theme(ThemeName); +impl private::Sealed for Theme {} +impl Setting for Theme { + type Data = ThemeName; + const ID: &'static str = "theme"; + + fn into_inner(self) -> Self::Data { + self.0 + } + + fn new(data: Self::Data) -> Self { + Self(data) + } +} |