Skip to content

Commit 51fcd1b

Browse files
committed
feat: update
1 parent 0e16cd3 commit 51fcd1b

2 files changed

Lines changed: 17 additions & 17 deletions

File tree

docs/content/2.guide/1.features.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -154,25 +154,25 @@ You can add custom npmx badges to your markdown files using the following syntax
154154

155155
You can further customize your badges by appending query parameters to the badge URL.
156156

157-
##### `color`
157+
#### `colorA`
158158

159-
Overrides the default strategy color. You can pass a standard hex code (with or without the `#` prefix).
159+
Overrides the default label color. You can pass a standard hex code (with or without the `#` prefix).
160160

161-
- **Default**: Depends on the badge type (e.g., version is blue, downloads are orange).
162-
- **Usage**: `?color=HEX_CODE`
161+
- **Default**: `#0a0a0a`
162+
- **Usage**: `?colorA=HEX_CODE`
163163

164-
| Example | URL |
165-
| :------------- | :------------------------------------ |
166-
| **Hot Pink** | `.../badge/version/nuxt?color=ff69b4` |
167-
| **Pure Black** | `.../badge/version/nuxt?color=000000` |
168-
| **Brand Blue** | `.../badge/version/nuxt?color=3b82f6` |
164+
##### `colorB`
169165

170-
#### `colorLeft`
166+
Overrides the default strategy color. You can pass a standard hex code (with or without the `#` prefix).
171167

172-
Overrides the default label color. You can pass a standard hex code (with or without the `#` prefix).
168+
- **Default**: Depends on the badge type (e.g., version is blue, downloads are orange).
169+
- **Usage**: `?colorB=HEX_CODE`
173170

174-
- **Default**: `#0a0a0a`
175-
- **Usage**: `?colorLeft=HEX_CODE`
171+
| Example | URL |
172+
| :------------- | :------------------------------------- |
173+
| **Hot Pink** | `.../badge/version/nuxt?colorB=ff69b4` |
174+
| **Pure Black** | `.../badge/version/nuxt?colorB=000000` |
175+
| **Brand Blue** | `.../badge/version/nuxt?colorB=3b82f6` |
176176

177177
##### `name`
178178

server/api/registry/badge/[type]/[...pkg].get.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ const BUNDLEPHOBIA_API = 'https://bundlephobia.com/api/size'
1212
const NPMS_API = 'https://api.npms.io/v2/package'
1313

1414
const QUERY_SCHEMA = v.object({
15-
color: v.optional(v.string()),
15+
colorA: v.optional(v.string()),
1616
name: v.optional(v.string()),
17-
colorLeft: v.optional(v.string()),
17+
colorB: v.optional(v.string()),
1818
})
1919

2020
const COLORS = {
@@ -263,8 +263,8 @@ export default defineCachedEventHandler(
263263
})
264264

265265
const queryParams = v.safeParse(QUERY_SCHEMA, query)
266-
const userColor = queryParams.success ? queryParams.output.color : undefined
267-
const userColorLeft = queryParams.success ? queryParams.output.colorLeft : undefined
266+
const userColor = queryParams.success ? queryParams.output.colorB : undefined
267+
const userColorLeft = queryParams.success ? queryParams.output.colorA : undefined
268268
const showName = queryParams.success && queryParams.output.name === 'true'
269269

270270
const badgeTypeResult = v.safeParse(BadgeTypeSchema, typeParam)

0 commit comments

Comments
 (0)