From 9b20403cef6669120a9da3c4eebe0eb4793df800 Mon Sep 17 00:00:00 2001 From: Compositr Date: Mon, 4 Nov 2024 22:02:58 +1100 Subject: [PATCH] feat: stroke alias for stroke_colour --- CHANGELOG.md | 3 ++- src/constants.rs | 1 + src/main.rs | 4 ++-- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2876a93..c70d116 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,8 @@ - Remove version information from headers - Remove unneeded dependency indoc - As a result, Dockerfile no longer requires musl-dev libraries -- Added `backwards_compatibility` option for compatibility with the old 80x80 image size +- Added `backwards_compatibility` option for compatibility with the old 80x80 image size +- Added equivalent `stroke` query option for `stroke_colour` # 1.0.0 / 2024-11-03 - Added multithreading support diff --git a/src/constants.rs b/src/constants.rs index 0ea7e74..8d50b2e 100644 --- a/src/constants.rs +++ b/src/constants.rs @@ -10,6 +10,7 @@ GET /icons/[icon].png - Get an icon rendered in PNG format padding - integer - Add padding (px) around the icon (default: 0, min: 0, max: 100) background - hex - Set the background color in hex WITHOUT the hashtag (e.g. FFFFFF) (default: transparent) stroke_colour - string - Set the stroke color for the SVG icon, any CSS color WITH the hashtag (default: currentColor) + stroke - string - Alias for stroke_colour. Don't use if you are using stroke_colour, undefined behaviour. (default: currentColor) discord_compatibility - boolean - Set padding to 8px for Discord compatibility. Typically for use in embed author icons as these have a circle clip applied by Discord. Overrides padding if set. (default: false) backwards_compatibility - boolean - Sets padding to 8px, and scale to 3x for backwards compatibility with older versions of Lucide server (so they are 80x80 again). (default: false) cache_key - string - Technically this can have any name. The server does not interpret this at all. Useful for cache busting. (default: none) diff --git a/src/main.rs b/src/main.rs index 61c6577..5a5f397 100644 --- a/src/main.rs +++ b/src/main.rs @@ -165,8 +165,8 @@ fn main() { let mut svg_stroke = "currentColor"; // thx horizell for this code - match (req.url.query.get("stroke_color"), req.url.query.get("stroke_colour")) { - (Some(stroke_str), _) | (_, Some(stroke_str)) => svg_stroke = stroke_str, + match (req.url.query.get("stroke_color"), req.url.query.get("stroke_colour"), req.url.query.get("stroke")) { + (Some(stroke_str), _, _) | (_, Some(stroke_str), _) | (_, _, Some(stroke_str)) => svg_stroke = stroke_str, _ => {} }