Skip to content

Commit 002db1a

Browse files
feat(border_color): add border_color customization option and update examples (closes #238)
2 parents 3721798 + 4901089 commit 002db1a

File tree

9 files changed

+70
-36
lines changed

9 files changed

+70
-36
lines changed

README.md

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -20,25 +20,25 @@ Please refer to the updated link [here](#how-to-use)
2020

2121
## Table of contents
2222

23-
- [Table of contents](#table-of-contents)
24-
- [How to Use](#how-to-use)
25-
- [Attention ⚠](#attention-)
26-
- [Use themes](#use-themes)
27-
- [Available Themes](#available-themes)
28-
- [Customization](#customization)
29-
- [Common Options](#common-options)
30-
- [Deploy on your own Replit instance](#deploy-on-your-own-replit-instance)
31-
- [Follow the steps](#follow-the-steps)
32-
- [Deploy on your own Vercel instance](#deploy-on-your-own-vercel-instance)
33-
- [First Method](#first-method)
34-
- [Second Method](#second-method)
35-
- [Finally](#finally)
36-
- [Contributing](#contributing)
37-
- [Core Team 💻](#core-team-)
38-
- [Contributors ✨](#contributors-)
39-
- [Resources Used to build this project](#resources-used-to-build-this-project)
40-
- [Star History](#star-history)
41-
- [Made with ❤ and TypeScript ](#made-with--and-typescript-)
23+
- [Table of contents](#table-of-contents)
24+
- [How to Use](#how-to-use)
25+
- [Attention ⚠](#attention-)
26+
- [Use themes](#use-themes)
27+
- [Available Themes](#available-themes)
28+
- [Customization](#customization)
29+
- [Common Options](#common-options)
30+
- [Deploy on your own Replit instance](#deploy-on-your-own-replit-instance)
31+
- [Follow the steps](#follow-the-steps)
32+
- [Deploy on your own Vercel instance](#deploy-on-your-own-vercel-instance)
33+
- [First Method](#first-method)
34+
- [Second Method](#second-method)
35+
- [Finally](#finally)
36+
- [Contributing](#contributing)
37+
- [Core Team 💻](#core-team-)
38+
- [Contributors ✨](#contributors-)
39+
- [Resources Used to build this project](#resources-used-to-build-this-project)
40+
- [Star History](#star-history)
41+
- [Made with ❤ and TypeScript ](#made-with--and-typescript-)
4242

4343
## How to Use
4444

@@ -89,6 +89,7 @@ Customize the appearance of your Activity Graph however you want with URL params
8989
| Arguments | Description | Type of Value |
9090
| :------------: | :-------------------------------------------: | :--------------------------------------------: |
9191
| `bg_color` | card's background color | hex code (without `#`) |
92+
| `border_color` | card's border color | hex code (without `#`) |
9293
| `color` | graph card's text color | hex code (without `#`) |
9394
| `title_color` | graph card's title color | hex code (without `#`) |
9495
| `line` | graph's line color | hex code (without `#`) |
@@ -119,7 +120,7 @@ Example:
119120
**Example:**
120121

121122
```md
122-
[![Ashutosh's github activity graph](https://github-readme-activity-graph.vercel.app/graph?username=ashutosh00710&bg_color=fffff0&color=708090&line=24292e&point=24292e&area=true&hide_border=true)](https://github.com/ashutosh00710/github-readme-activity-graph)
123+
[![Ashutosh's github activity graph](https://github-readme-activity-graph.vercel.app/graph?username=ashutosh00710&bg_color=fffff0&color=708090&line=24292e&point=24292e&area=true&border_color=ff0000)](https://github.com/ashutosh00710/github-readme-activity-graph)
123124
```
124125

125126
## Deploy on your own Replit instance

__test__/fakeInputs.ts

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,17 @@ export let fakeQueryString = [
8585
hide_border: true,
8686
custom_title: 'some title',
8787
},
88+
{
89+
username: 'githubusername',
90+
bg_color: '44475a',
91+
border_color: 'ff0000',
92+
color: 'f8f8f2',
93+
line: 'ff79c6',
94+
point: 'bd93f9',
95+
area: true,
96+
hide_title: false,
97+
custom_title: undefined,
98+
},
8899
];
89100

90101
export let fakeQueryStringRes = [
@@ -269,6 +280,26 @@ export let fakeQueryStringRes = [
269280
to: '',
270281
grid: true,
271282
},
283+
{
284+
username: 'githubusername',
285+
radius: 0,
286+
height: 420,
287+
colors: {
288+
areaColor: '9e4c98',
289+
bgColor: '44475a',
290+
borderColor: 'ff0000',
291+
color: 'f8f8f2',
292+
titleColor: 'f8f8f2',
293+
lineColor: 'ff79c6',
294+
pointColor: 'bd93f9',
295+
},
296+
area: true,
297+
hide_title: false,
298+
days: 31,
299+
from: '',
300+
to: '',
301+
grid: true,
302+
},
272303
];
273304

274305
export let fakeGraphArgs: GraphArgs = {

__test__/mockFunctions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export const mockFetchCorrect = jest.fn().mockReturnValue(
2525
},
2626
},
2727
},
28-
})
28+
}),
2929
);
3030

3131
//For invalid username

__test__/svgs.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ describe('SVG Testing', () => {
2323
fakeQueryStringRes[0].radius,
2424
fakeQueryStringRes[0].colors,
2525
"xyz's Contribution Graph",
26-
fakeQueryStringRes[0].area
26+
fakeQueryStringRes[0].area,
2727
).buildGraph([
2828
{
2929
contributionCount: 2,
@@ -45,7 +45,7 @@ describe('SVG Testing', () => {
4545
contributionCount: 14,
4646
date: '1',
4747
},
48-
])
48+
]),
4949
).toMatchSnapshot();
5050
});
5151
});

src/GraphCards.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export class Card {
1010
private readonly colors: Colors,
1111
private readonly title = '',
1212
private readonly area = false,
13-
private readonly showGrid = true
13+
private readonly showGrid = true,
1414
) {}
1515

1616
private getOptions() {

src/handlers.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export class Handlers {
1818
const fetchCalendarData = await fetcher.fetchContributions(
1919
utils.queryOptions().days,
2020
queryOptions.from,
21-
queryOptions.to
21+
queryOptions.to,
2222
);
2323

2424
const { finalGraph, header } = await utils.buildGraph(fetchCalendarData);
@@ -38,7 +38,7 @@ export class Handlers {
3838

3939
const fetcher = new Fetcher(utils.username);
4040
const fetchCalendarData: UserDetails | string = await fetcher.fetchContributions(
41-
utils.queryOptions().days
41+
utils.queryOptions().days,
4242
);
4343

4444
if (typeof fetchCalendarData === 'object') {

src/interfaces/interface.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ export class ParsedQs {
3434
hide_title?: boolean;
3535
custom_title?: string;
3636
bg_color?: string;
37+
border_color?: string;
3738
hide_border?: boolean;
3839
area_color?: string;
3940
color?: string;

src/svgs.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ export const graphSvg = (props: GraphArgs) => `
1212
<rect xmlns="http://www.w3.org/2000/svg" data-testid="card_bg" id="cardBg"
1313
x="0" y="0" rx="${props.radius}" height="100%" stroke="#E4E2E2" fill-opacity="1"
1414
width="100%" fill="#${props.colors.bgColor}" stroke-opacity="1" style="stroke:#${
15-
props.colors.borderColor
16-
}; stroke-width:1;"/>
15+
props.colors.borderColor
16+
}; stroke-width:1;"/>
1717
1818
<style>
1919
body {
@@ -33,7 +33,7 @@ export const graphSvg = (props: GraphArgs) => `
3333
props.colors.color,
3434
props.colors.lineColor,
3535
props.colors.pointColor,
36-
props.colors.areaColor
36+
props.colors.areaColor,
3737
)}
3838
${pointAnimation()}
3939
${lineAnimation()}

src/utils.ts

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,17 @@ export class Utilities {
2020
bgColor: this.queryString.bg_color
2121
? this.queryString.bg_color
2222
: selectColors(theme).bgColor,
23-
borderColor:
24-
String(this.queryString.hide_border) === 'true'
25-
? '0000' // transparent
26-
: selectColors(theme).borderColor,
23+
borderColor: this.queryString.border_color
24+
? this.queryString.border_color
25+
: String(this.queryString.hide_border) === 'true'
26+
? '0000' // transparent
27+
: selectColors(theme).borderColor,
2728
color: this.queryString.color ? this.queryString.color : selectColors(theme).color,
2829
titleColor: this.queryString.title_color
2930
? this.queryString.title_color
3031
: this.queryString.color
31-
? this.queryString.color
32-
: selectColors(theme).titleColor,
32+
? this.queryString.color
33+
: selectColors(theme).titleColor,
3334
lineColor: this.queryString.line
3435
? this.queryString.line
3536
: selectColors(theme).lineColor,
@@ -152,7 +153,7 @@ export class Utilities {
152153
options.colors,
153154
title,
154155
options.area,
155-
options.grid
156+
options.grid,
156157
);
157158
const getChart = await graph.buildGraph(fetchCalendarData.contributions);
158159
return {

0 commit comments

Comments
 (0)