diff options
| author | Fuwn <[email protected]> | 2024-06-13 14:30:22 +0000 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2024-06-13 14:30:22 +0000 |
| commit | e02923bfe473b474a0b8ea96509a0cbda501e0dc (patch) | |
| tree | 07a4e167aa3b51fd7d0b1020e9d3cdd54b13a799 | |
| parent | refactor(url): use unwrap instead of map (diff) | |
| download | september-e02923bfe473b474a0b8ea96509a0cbda501e0dc.tar.xz september-e02923bfe473b474a0b8ea96509a0cbda501e0dc.zip | |
feat: custom primary colour variable
| -rw-r--r-- | Configuration.md | 16 | ||||
| -rw-r--r-- | default.css | 14 | ||||
| -rw-r--r-- | src/response.rs | 22 |
3 files changed, 41 insertions, 11 deletions
diff --git a/Configuration.md b/Configuration.md index b461b7e..4815e13 100644 --- a/Configuration.md +++ b/Configuration.md @@ -144,3 +144,19 @@ A comma-separated list of paths will condense adjacent links to a single line on <!-- Condensed --> <p><a href="/">Link</a> | <a href="/">Link</a> | <a href="/">Link</a></p> ``` + +## `PRIMARY_COLOUR` + +Set the primary colour of elements in the default stylesheet. This field +controls the colour of items such as links and highlights. + +Popular choices are `var(--base0D)` for a blue, or `var(--base09)` for an +amber colour. + +### Examples + +```plaintext +PRIMARY_COLOUR=var(--base09) +PRIMARY_COLOUR=red +PRIMARY_COLOUR=#ff0000 +``` diff --git a/default.css b/default.css index 65a1ea4..625d0d7 100644 --- a/default.css +++ b/default.css @@ -5,10 +5,10 @@ --fg: var(--base04); --off-fg: var(--base04); --muted: var(--base03); - --link: var(--base0D); + --link: var(--primary); --hover: var(--base0E); - --highlight: var(--base0D); - --logo: var(--base0D); + --highlight: var(--primary); + --logo: var(--primary); --font-monospace: "Fira Mono", monospace; --font-size: 13.5px; } @@ -89,12 +89,14 @@ p { a:link, a:visited { color: var(--link); + text-decoration: none; } a:hover, a:active, a.active { - color: var(--hover); + background-color: var(--link); + color: var(--bg); } ul { @@ -267,7 +269,7 @@ img { } } -* { +/* * { transition: color 0.15s ease-in-out, background-color 0.15s ease-in-out, border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out; -} +} */ diff --git a/src/response.rs b/src/response.rs index 2cf0005..91764b9 100644 --- a/src/response.rs +++ b/src/response.rs @@ -164,6 +164,14 @@ For example: to proxy "gemini://fuwn.me/uptime", visit "/proxy/fuwn.me/uptime".< } } else if !is_nocss { html_context.push_str(&format!(r#"<link rel="stylesheet" href="https://latex.now.sh/style.css"><style>{CSS}</style>"#)); + + if let Ok(primary) = var("PRIMARY_COLOUR") { + html_context + .push_str(&format!("<style>:root {{ --primary: {primary} }}</style>")); + } else { + html_context + .push_str("<style>:root { --primary: var(--base0D); }</style>"); + } } // Try to add an external favicon from the `FAVICON_EXTERNAL` environment @@ -256,17 +264,21 @@ For example: to proxy "gemini://fuwn.me/uptime", visit "/proxy/fuwn.me/uptime".< html_context.push_str(&format!( "<details>\n<summary>Proxy Information</summary> <dl> -<dt>Original URL</dt><dd><a href=\"{}\">{0}</a></dd> +<dt>Original URL</dt><dd><a \ + href=\"{}\">{0}</a></dd> <dt>Status Code</dt> <dd>{} ({})</dd> -<dt>Meta</dt><dd><code>{}</code></dd> +<dt>Meta</dt><dd><code>{}</code></dd>\ + <dt>Capsule Response Time</dt> <dd>{} milliseconds</dd> -<dt>Gemini-to-HTML Time</dt> +<dt>Gemini-to-HTML \ + Time</dt> <dd>{} milliseconds</dd> </dl> -<p>This content has been proxied by \ -<a href=\"https://github.com/gemrest/september{}\">September ({})</a>.</p> +<p>This content has been proxied \ + by <a href=\"https://github.com/gemrest/september{}\">September \ + ({})</a>.</p> </details></body></html>", url, response.status(), |