Skip to content

Commit 3f2e854

Browse files
committed
added the support to use 'auto' as logoColor
1 parent 53b097d commit 3f2e854

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed

.husky/pre-commit

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22
. "$(dirname -- "$0")/_/husky.sh"
33

44
npm run format
5+
npm run lint

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,9 @@ Every badge is built like this: `{logoName},{logoTitle},{logoColor}` (e.g `types
7070
The `logoColor` has to be a hexadecimal color code, without the `#` symbol.
7171
We need to separate the values with commas. (`,`)
7272

73+
> **Note**
74+
> If you set the `logoColor` to `auto`, it will use the default color of the SVG logo.
75+
7376
Now that we know how to create badges, we can move on to creating a line.
7477
We just simply put badges next to each other separated by semicolons. (`{badge};{another one};{another one}`)
7578

src/utils/validator.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,13 @@ export const validateLine = (line: string): Badge[] => {
5050
continue;
5151
}
5252

53+
const logoColor =
54+
splitByComma[2] === "auto" ? "" : formatHexColor(splitByComma[2]);
55+
5356
badges.push({
5457
logoName: splitByComma[0],
5558
label: splitByComma[1],
56-
logoColor: formatHexColor(splitByComma[2]),
59+
logoColor: logoColor,
5760
});
5861
}
5962

0 commit comments

Comments
 (0)