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

Added backgroundOpacity option #74

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ exports.GitBlockSettings = exports.NightRainbowSettings = exports.NightGreenSett
exports.NormalSettings = {
type: 'normal',
backgroundColor: '#ffffff',
backgroundOpacity: 1.0,
foregroundColor: '#00000f',
strongColor: '#111133',
weakColor: 'gray',
Expand All @@ -118,6 +119,7 @@ exports.NormalSettings = {
exports.HalloweenSettings = {
type: 'normal',
backgroundColor: '#ffffff',
backgroundOpacity: 1.0,
foregroundColor: '#00000f',
strongColor: '#111133',
weakColor: 'gray',
Expand All @@ -128,6 +130,7 @@ exports.HalloweenSettings = {
exports.NorthSeasonSettings = {
type: 'season',
backgroundColor: '#ffffff',
backgroundOpacity: 1.0,
foregroundColor: '#00000f',
strongColor: '#111133',
weakColor: 'gray',
Expand All @@ -141,6 +144,7 @@ exports.NorthSeasonSettings = {
exports.SouthSeasonSettings = {
type: 'season',
backgroundColor: '#ffffff',
backgroundOpacity: 1.0,
foregroundColor: '#00000f',
strongColor: '#111133',
weakColor: 'gray',
Expand All @@ -153,6 +157,7 @@ exports.SouthSeasonSettings = {
exports.NightViewSettings = {
type: 'normal',
backgroundColor: '#00000f',
backgroundOpacity: 1.0,
foregroundColor: '#eeeeff',
strongColor: 'rgb(255,200,55)',
weakColor: '#aaaaaa',
Expand All @@ -168,6 +173,7 @@ exports.NightViewSettings = {
exports.NightGreenSettings = {
type: 'normal',
backgroundColor: '#00000f',
backgroundOpacity: 1.0,
foregroundColor: '#eeeeff',
strongColor: 'rgb(255,200,55)',
weakColor: '#aaaaaa',
Expand All @@ -177,6 +183,7 @@ exports.NightGreenSettings = {
exports.NightRainbowSettings = {
type: 'rainbow',
backgroundColor: '#00000f',
backgroundOpacity: 1.0,
foregroundColor: '#eeeeff',
strongColor: 'rgb(255,200,55)',
weakColor: '#aaaaaa',
Expand All @@ -189,6 +196,7 @@ exports.NightRainbowSettings = {
exports.GitBlockSettings = {
type: 'bitmap',
backgroundColor: '#ffffff',
backgroundOpacity: 1.0,
foregroundColor: '#00000f',
strongColor: '#111133',
weakColor: 'gray',
Expand Down Expand Up @@ -732,6 +740,7 @@ const create3DContrib = (svg, userInfo, x, y, width, height, settings, isForcedA
const week = Math.floor(diffDate(startTime, cal.date.getTime()) / 7);
const baseX = offsetX + (week - dayOfWeek) * dx;
const baseY = offsetY + (week + dayOfWeek) * dy;
// ref. https://github.com/yoshi389111/github-profile-3d-contrib/issues/27
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please don't ask me how this occurred! I suspect my IDE playing a trick on me here! Sorry!

const calHeight = Math.log10(cal.contributionCount / 20 + 1) * 144 + 3;
const contribLevel = cal.contributionLevel;
const isAnimate = settings.growingAnimation || isForcedAnimation;
Expand Down Expand Up @@ -1201,7 +1210,8 @@ const createSvg = (userInfo, settings, isForcedAnimation) => {
.attr('y', 0)
.attr('width', svgWidth)
.attr('height', svgHeight)
.attr('fill', settings.backgroundColor);
.attr('fill', settings.backgroundColor)
.attr('fill-opacity', settings.backgroundOpacity);
if (settings.type === 'pie_lang_only') {
// pie chart only
pie.createPieLanguage(svg, userInfo, 0, 0, pieWidth, pieHeight, settings, isForcedAnimation);
Expand Down
8 changes: 8 additions & 0 deletions src/color-template.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import * as type from './type';
export const NormalSettings: type.NormalColorSettings = {
type: 'normal',
backgroundColor: '#ffffff',
backgroundOpacity: 1.0,
foregroundColor: '#00000f',
strongColor: '#111133',
weakColor: 'gray',
Expand All @@ -13,6 +14,7 @@ export const NormalSettings: type.NormalColorSettings = {
export const HalloweenSettings: type.NormalColorSettings = {
type: 'normal',
backgroundColor: '#ffffff',
backgroundOpacity: 1.0,
foregroundColor: '#00000f',
strongColor: '#111133',
weakColor: 'gray',
Expand All @@ -24,6 +26,7 @@ export const HalloweenSettings: type.NormalColorSettings = {
export const NorthSeasonSettings: type.SeasonColorSettings = {
type: 'season',
backgroundColor: '#ffffff',
backgroundOpacity: 1.0,
foregroundColor: '#00000f',
strongColor: '#111133',
weakColor: 'gray',
Expand All @@ -38,6 +41,7 @@ export const NorthSeasonSettings: type.SeasonColorSettings = {
export const SouthSeasonSettings: type.SeasonColorSettings = {
type: 'season',
backgroundColor: '#ffffff',
backgroundOpacity: 1.0,
foregroundColor: '#00000f',
strongColor: '#111133',
weakColor: 'gray',
Expand All @@ -51,6 +55,7 @@ export const SouthSeasonSettings: type.SeasonColorSettings = {
export const NightViewSettings: type.NormalColorSettings = {
type: 'normal',
backgroundColor: '#00000f',
backgroundOpacity: 1.0,
foregroundColor: '#eeeeff',
strongColor: 'rgb(255,200,55)',
weakColor: '#aaaaaa',
Expand All @@ -67,6 +72,7 @@ export const NightViewSettings: type.NormalColorSettings = {
export const NightGreenSettings: type.NormalColorSettings = {
type: 'normal',
backgroundColor: '#00000f',
backgroundOpacity: 1.0,
foregroundColor: '#eeeeff',
strongColor: 'rgb(255,200,55)',
weakColor: '#aaaaaa',
Expand All @@ -77,6 +83,7 @@ export const NightGreenSettings: type.NormalColorSettings = {
export const NightRainbowSettings: type.RainbowColorSettings = {
type: 'rainbow',
backgroundColor: '#00000f',
backgroundOpacity: 1.0,
foregroundColor: '#eeeeff',
strongColor: 'rgb(255,200,55)',
weakColor: '#aaaaaa',
Expand All @@ -90,6 +97,7 @@ export const NightRainbowSettings: type.RainbowColorSettings = {
export const GitBlockSettings: type.BitmapPatternSettings = {
type: 'bitmap',
backgroundColor: '#ffffff',
backgroundOpacity: 1.0,
foregroundColor: '#00000f',
strongColor: '#111133',
weakColor: 'gray',
Expand Down
3 changes: 2 additions & 1 deletion src/create-svg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ export const createSvg = (
.attr('y', 0)
.attr('width', svgWidth)
.attr('height', svgHeight)
.attr('fill', settings.backgroundColor);
.attr('fill', settings.backgroundColor)
.attr('fill-opacity', settings.backgroundOpacity);

if (settings.type === 'pie_lang_only') {
// pie chart only
Expand Down
3 changes: 3 additions & 0 deletions src/type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ export type ContributionLevel =

export interface RadarContribSettings {
backgroundColor: string;
backgroundOpacity: number;
foregroundColor: string;
weakColor: string;
radarColor: string;
Expand All @@ -52,6 +53,7 @@ export interface RadarContribSettings {

export interface PieLangSettings {
backgroundColor: string;
backgroundOpacity: number;
foregroundColor: string;

growingAnimation?: boolean;
Expand All @@ -62,6 +64,7 @@ export interface PieLangSettings {
export interface BaseSettings extends RadarContribSettings, PieLangSettings {
backgroundColor: string;
foregroundColor: string;
backgroundOpacity: number;
strongColor: string;
weakColor: string;
radarColor: string;
Expand Down