Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

凡例の色指定を動的に取得可能にする #24

Merged
merged 2 commits into from Oct 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions contributions.graphql
Expand Up @@ -3,6 +3,7 @@ query($userName:String!) {
contributionsCollection {
contributionCalendar {
totalContributions
colors
weeks {
contributionDays {
color
Expand Down
2 changes: 2 additions & 0 deletions contributions.ts
Expand Up @@ -11,6 +11,7 @@ interface Week {

interface ContributionCalendar {
totalContributions: number;
colors: string[];
weeks: Week[];
}

Expand All @@ -24,6 +25,7 @@ const getContributions = async (user: string) => {
contributionsCollection {
contributionCalendar {
totalContributions
colors
weeks {
contributionDays {
color
Expand Down
2 changes: 1 addition & 1 deletion renderCanvas.ts
Expand Up @@ -50,7 +50,7 @@ const renderContributions = (
});
});

const legend = ["#ebedf0", "#9be9a8", "#40c463", "#30a14e", "#216e39"];
const legend = ["#ebedf0", ...contribution.colors];

ctx.fillStyle = "black";
ctx.fillText("Less", 500, 128);
Expand Down
6 changes: 6 additions & 0 deletions vrt/contributions.json
Expand Up @@ -4,6 +4,12 @@
"contributionsCollection": {
"contributionCalendar": {
"totalContributions": 3891,
"colors": [
"#9be9a8",
"#40c463",
"#30a14e",
"#216e39"
],
"weeks": [
{
"contributionDays": [
Expand Down