Skip to content

Commit 6c2eff4

Browse files
committed
Added section color based on option color
1 parent 6b830d7 commit 6c2eff4

File tree

2 files changed

+29
-2
lines changed

2 files changed

+29
-2
lines changed

dist/index.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9847,6 +9847,18 @@ const core_1 = __importDefault(__webpack_require__(470));
98479847
const endpoints_1 = __webpack_require__(897);
98489848
const fs_1 = __importDefault(__webpack_require__(747));
98499849
const utils_1 = __webpack_require__(326);
9850+
const ColorMap = {
9851+
default: '505558',
9852+
gray: '979a9b',
9853+
brown: '695b55',
9854+
orange: '9f7445',
9855+
yellow: '9f9048',
9856+
green: '467870',
9857+
blue: '487088',
9858+
purple: '6c598f',
9859+
pink: '904d74',
9860+
red: '9f5c58'
9861+
};
98509862
async function main() {
98519863
try {
98529864
const databaseId = core_1.default.getInput('database_id');
@@ -9934,7 +9946,7 @@ async function main() {
99349946
const newLines = [];
99359947
for (const [category, category_info] of categories_map) {
99369948
const content = [
9937-
`<div><img height="20px" src="https://img.shields.io/badge/${category}-${category_info.color}"/></div>`
9949+
`<div><img height="20px" src="https://img.shields.io/badge/${category}-${ColorMap[category_info.color]}"/></div>`
99389950
];
99399951
category_info.items.forEach((item) => content.push(`<img src="https://img.shields.io/badge/-${item}-black?style=flat-square&amp;logo=${item}" alt="${item}">`));
99409952
newLines.push(...content, '<hr>');

src/index.ts

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,19 @@ import {
1010
import fs from 'fs';
1111
import { commitFile } from './utils';
1212

13+
const ColorMap: Record<TTextColor, string> = {
14+
default: '505558',
15+
gray: '979a9b',
16+
brown: '695b55',
17+
orange: '9f7445',
18+
yellow: '9f9048',
19+
green: '467870',
20+
blue: '487088',
21+
purple: '6c598f',
22+
pink: '904d74',
23+
red: '9f5c58'
24+
} as any;
25+
1326
async function main() {
1427
try {
1528
const databaseId = core.getInput('database_id');
@@ -137,7 +150,9 @@ async function main() {
137150

138151
for (const [category, category_info] of categories_map) {
139152
const content = [
140-
`<div><img height="20px" src="https://img.shields.io/badge/${category}-${category_info.color}"/></div>`
153+
`<div><img height="20px" src="https://img.shields.io/badge/${category}-${
154+
ColorMap[category_info.color]
155+
}"/></div>`
141156
];
142157
category_info.items.forEach((item) =>
143158
content.push(

0 commit comments

Comments
 (0)