Skip to content

Dark theme not working properly #2

Closed
@codenashwan

Description

When I change the theme to dark, the cmatrix behavior is not working as expected. The matrix is not displayed correctly with the dark theme.

Html

<canvas id="matrix"></canvas>

Javascript

import matrix from "cmatrix/dist/matrix";


var canvas = document.getElementById("matrix");
var someFunction = function (event) {
    //clear canvas before drawing
    canvas.getContext("2d").clearRect(0, 0, canvas.width, canvas.height);

    matrix(canvas, {
        chars: ["0", "1"],
        color: localStorage.getItem("theme") === "dark" ? "#0F0" : "#000",
        background:
            localStorage.getItem("theme") === "dark"
                ? "rgba(51, 65, 84, 0.09)"
                : "rgba(255,255,255, 0.05)",
        exit: true,
        font_size: 20,
    });
};
window.addEventListener("theme", someFunction, false);

Untitled3.1.mp4

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions