Skip to content

Can the text color of the win rate percentage be dynamically changed? #94

@qcgm1978

Description

@qcgm1978

The current win rate is displayed in white, which is easily misleading as to the win rate of white chess. Additionally, the color has no correlation with the win rate itself. It is possible to consider dynamically setting it to other colors, for example, the following modification:

const get_color = (percent) => {
    if (percent < 40) {
        return 'red';
    } else if (percent < 60) {
        return 'orange';
    } else if (percent < 80) {
        return 'yellow';
    } else {
        return 'green';
    }
}
function draw_winrate_graph_current(g) {
    ...
    g.strokeStyle = g.fillStyle = get_color(percent);
    fill_text(g, unit * 2, `${percent}%`, ...here)
    g.restore()
}
2023-10-11.21-58-08.mp4

Metadata

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