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

Default Colors deplete too Rapidly #647

Closed
KevinWu098 opened this issue Jul 25, 2023 · 0 comments · Fixed by #1006 or nav800/AntAlmanac#1
Closed

Default Colors deplete too Rapidly #647

KevinWu098 opened this issue Jul 25, 2023 · 0 comments · Fixed by #1006 or nav800/AntAlmanac#1
Labels
design good first task Good task for someone new to the project low Low priority issue Stale

Comments

@KevinWu098
Copy link
Member

KevinWu098 commented Jul 25, 2023

Issue

After the initial 7 colors are used in a term -- meaning that 7 unique*** courses are in a given term (not just a particular schedule, this is done for consistency. See #635 if curious) --, we then select a random color from the palette (See #644).

This is... mildly acceptable at best..., but can create situations where users end up with two same-colored courses back-to-back. Google Chrome colors tab groups linearly (see below), with colors repeating once they're all expended. Linearly here means that the order that colors are used is always the same.

Screenshot 2023-11-30 at 12 31 40 PM

Linear assignment is also preferable to not just random assignment, but also adding new colors:

Screenshot 2023-11-30 at 12 25 49 PM

As you can tell, with all 7 colors utilized -- alongside their lighter variants for other course types -- we're already hard-pressed on contrast and differentiability

***Unique, in this instance means ICS 6B vs ICS 32A. Alternatively, it means that a 6B lecture and a 6B discussion are not unique. Course Name dictates uniqueness

Good First Taskers

Relevant code can be found in scheduleHelpers.ts, specifically the getColorForNewSection function. The color of the 8th course and onwards is set by this block of code:

    // If there are no existing sections with the same course title, generate a new color. If we run out of unique colors, return a random one that's been used already.
    return (
        defaultColors.find((materialColor) => !usedColors.has(materialColor)) ||
        defaultColors[Math.floor(Math.random() * defaultColors.length)]
    );

Your task is to essentially take this from random assignment to linear assignment.

Old Issue Writeup

This was the original solution, advocating for additional colors; it's left for documentation purposes (I guess), but it's not relevant to the issue any longer

Following the merging of #635, #644 and #646, the set of Used Colors for courses is now drawn from courses which share the same term as the newCourse (i.e. the course that is being added). (Prior, used colors only came from the same schedule)

Because of this, the seven base colors are being used up too quickly. New colors should be drawn from the MUI template like the current ones we've got:

const defaultColors = [blue[500], pink[500], purple[500], green[500], amber[500], deepPurple[500], deepOrange[500], ];

@KevinWu098 KevinWu098 self-assigned this Jul 26, 2023
@github-actions github-actions bot added the Stale label Oct 24, 2023
@KevinWu098 KevinWu098 added design low Low priority issue labels Nov 24, 2023
@github-actions github-actions bot removed the Stale label Nov 24, 2023
@KevinWu098 KevinWu098 added the good first task Good task for someone new to the project label Nov 30, 2023
@KevinWu098 KevinWu098 removed their assignment Nov 30, 2023
@github-actions github-actions bot added the Stale label Feb 29, 2024
nav800 added a commit to nav800/AntAlmanac that referenced this issue Sep 30, 2024
This fix adjusts color selection to treat the earliest-used default color as a new color, and reuses said color if every other default color is already in use.

Intended to close icssc#647
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
design good first task Good task for someone new to the project low Low priority issue Stale
Projects
Status: Done 🤩
1 participant