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

Dark mode seems broken? Black background does not match canvas #29

Closed
jens-markussen opened this issue Jun 2, 2023 · 4 comments
Closed

Comments

@jens-markussen
Copy link
Contributor

jens-markussen commented Jun 2, 2023

Investigate and fix it really a problem exists

https://plan4hub.github.io/yoda/yoda-time-stats.html?owner=plan4hub&repolist=yoda-demo,yoda-demo2&labelsplit=^S[1-4]%20-%20|^prio:%20(.*)&draw=true&dark=true

image

@jens-markussen
Copy link
Contributor Author

Very very strangely, the problem does not occur when running against the Yoda files served locally. Does the publishing to GitHub Pages somehow mess up something?

@jens-markussen
Copy link
Contributor Author

The background is rendered using the following code. How can that possibly be different from page being served locally and using GitHub pages? Very very strange.

	Chart.register({
		id: "yoda-background",
		beforeDraw: function (c) {
			var ctx = c.ctx;
			ctx.fillStyle = getColor('htmlBackground');
			ctx.fillRect(0, 0, c.canvas.width, c.canvas.height);
		}
	});

@jens-markussen
Copy link
Contributor Author

chartjs documentation https://www.chartjs.org/docs/latest/developers/plugins.html

shows an example which is slightly different for doing the same thing. Maybe worth checking:

const plugin = {
    id: 'custom_canvas_background_color',
    beforeDraw: (chart, args, options) => {
        const {ctx} = chart;
        ctx.save();
        ctx.globalCompositeOperation = 'destination-over';
        ctx.fillStyle = options.color;
        ctx.fillRect(0, 0, chart.width, chart.height);
        ctx.restore();
    },
    defaults: {
        color: 'lightGreen'
    }
}

jens-markussen added a commit that referenced this issue Jun 3, 2023
@jens-markussen
Copy link
Contributor Author

Fixed. See commit above.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant