From 1b8c655a276ddd35b070ac8e0bdd9c721ac162cf Mon Sep 17 00:00:00 2001 From: Laura Allison Obermaier Date: Fri, 8 Aug 2025 00:53:54 -0400 Subject: [PATCH] feature: add colors param --- README.md | 17 ++++++++++ packages/cloudflare-worker/src/demo/demo.html | 11 +++++-- packages/cloudflare-worker/src/sanitize.ts | 15 +++++++++ packages/core/src/_test/index.test.ts | 31 +++++++++++++++++++ packages/core/src/exts/theme.ts | 17 +++++++++- packages/core/src/types.ts | 2 ++ 6 files changed, 90 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 29cbb43..c65f4bf 100644 --- a/README.md +++ b/README.md @@ -83,6 +83,23 @@ Use a comma to separate the light and dark theme. [![](https://leetcard.jacoblin.cool/jacoblincool?theme=unicorn)](https://leetcode.com/jacoblincool) +#### `colors` (default: `""`) + +Override the card's theme palette with your own comma-separated list of hex colors. + +Format: +`colors=bg0,bg1,text0,text1,color0,color1,color2,color3` + +You can provide fewer values; missing values will be padded by repeating the last provided one. + +Example (Blue Palette): + +```md +![](https://leetcard.jacoblin.cool/jacoblincool?colors=012a4a,013a63,a9d6e5,ffffff,0077b6,0096c7,00b4d8,90e0ef) +``` + +When both `theme` and `colors` are provided, `colors` takes precedence. + #### `font` (default: `Baloo_2`) Card font, you can use almost all fonts on [Google Fonts](https://fonts.google.com/). diff --git a/packages/cloudflare-worker/src/demo/demo.html b/packages/cloudflare-worker/src/demo/demo.html index 44c5901..4aacfb3 100644 --- a/packages/cloudflare-worker/src/demo/demo.html +++ b/packages/cloudflare-worker/src/demo/demo.html @@ -35,6 +35,10 @@

LeetCode Stats Card

${font_options} +
+ + +