AntAlmanac icon indicating copy to clipboard operation
AntAlmanac copied to clipboard

Default Colors deplete too Rapidly

Open KevinWu098 opened this issue 1 year ago • 0 comments

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 avatar Jul 25 '23 16:07 KevinWu098