From 50b25a35f04084cc835797ad944d9a2b811a6d44 Mon Sep 17 00:00:00 2001 From: Shrecknt <58538423+Shrecknt@users.noreply.github.com> Date: Sun, 30 Jun 2024 22:15:02 -0700 Subject: [PATCH] add discord theme --- src/web/assets/themes/discord.css | 33 +++++++++++++++++++++++++++++++ src/web/mod.rs | 7 +++++++ src/web/settings.rs | 3 ++- 3 files changed, 42 insertions(+), 1 deletion(-) create mode 100644 src/web/assets/themes/discord.css diff --git a/src/web/assets/themes/discord.css b/src/web/assets/themes/discord.css new file mode 100644 index 0000000..eab8d77 --- /dev/null +++ b/src/web/assets/themes/discord.css @@ -0,0 +1,33 @@ +:root { + /* body background */ + --bg-1: hsl(223 calc(1 * 6.7%) 20.6% / 1); + /* background of the content */ + --bg-2: hsl(220 calc(1 * 6.5%) 18% / 1); + /* input suggestions background */ + --bg-3: hsl(225 calc(1 * 6.3%) 12.5% / 1); + /* mostly borders */ + --bg-4: transparent; + + /* main text color */ + --fg-1: hsl(210 calc(1 * 9.1%) 87.1% / 1); + /* search result description */ + --fg-2: hsl(215 calc(1 * 8.8%) 73.3% / 1); + --fg-3: hsl(214 calc(1 * 8.1%) 61.2% / 1); + + /* focus outline */ + --accent: hsl(227 calc(1 * 6.5%) 27.3% / 1); + + --link: hsl(200 calc(1 * 100%) 49.4% / 1); + --link-visited: hsl(201 calc(1 * 100%) 59% / 1); + + /* green, success */ + --positive: hsl(145 calc(1 * 65%) 39.2% / 1); + /* red, errors */ + --negative: hsl(358 calc(1 * 92.9%) 72.4% / 1); + + --syntax-string: #aad94c; + --syntax-special: #e6b673; + --syntax-constant: #d2a6ff; + --syntax-comment: #acb6bf8c; + --syntax-func: #ffb454; +} diff --git a/src/web/mod.rs b/src/web/mod.rs index 9cca871..e544e25 100644 --- a/src/web/mod.rs +++ b/src/web/mod.rs @@ -74,6 +74,13 @@ pub async fn run(config: Config) { "text/css; charset=utf-8", ), ) + .route( + "/themes/discord.css", + static_route( + include_str!("assets/themes/discord.css"), + "text/css; charset=utf-8", + ), + ) .route("/opensearch.xml", get(opensearch::route)) .route("/autocomplete", get(autocomplete::route)) .route("/image-proxy", get(image_proxy::route)) diff --git a/src/web/settings.rs b/src/web/settings.rs index 62d0cf6..6ae09bc 100644 --- a/src/web/settings.rs +++ b/src/web/settings.rs @@ -32,7 +32,8 @@ pub async fn get( select name="stylesheet-url" selected=(config.ui.stylesheet_url) { { (theme_option("", "Ayu Dark")) } { (theme_option("/themes/catppuccin-mocha.css", "Catppuccin Mocha")) } - { (theme_option("/themes/nord-bluish.css", "Nord Bluish"))} + { (theme_option("/themes/nord-bluish.css", "Nord Bluish")) } + { (theme_option("/themes/discord.css", "Discord")) } } br;