I made a course schedule using TikZ, but my code is inelegant and inefficient. Most of the steps are repeated for each course, so I would like to see how to combine them. I would also like to make the code easier to modify, e.g., adding new courses, changing the times of courses, and changing the times that are displayed on the schedule. I would greatly appreciate any advice on improving it.
\documentclass[12pt]{article}
\usepackage[margin=1.25in]{geometry}
\usepackage{comment}
\pagenumbering{gobble}
\usepackage[dvipsnames]{xcolor}
\definecolor{Pantone113U}{RGB}{255 225 94}
\definecolor{Pantone2347U}{RGB}{231 69 54}
\definecolor{gPurple}{RGB}{117 102 160}
\definecolor{gEvergreen}{RGB}{0 78 66}
\usepackage{tikz}
\usetikzlibrary{arrows,decorations.pathmorphing,backgrounds,positioning,fit,petri,calc}
\begin{document}
{\centering\LARGE\textbf{Fall 2020 Schedule}\\}
\vspace{0.5in}
\begin{figure}[h]
\centering
\begin{tikzpicture}
\draw[gray] (0,0) -- ++(5in,0) -- ++(0,-15cm) -- ++(-5in,0) -- cycle;
\draw[gray] (5in, 0) -- (0, 0)
node[left,black]{12 p.m.};
\foreach \x in {1, ..., 10}
\draw[gray] (5in, -1.5*\x) -- (0, -1.5*\x) node[left,black]{\x \space p.m.};
\draw[gray] (0,0) -- (1in,0) node[midway,above,black]{Monday} -- (1in, -15cm);
\draw[gray] (1in,0) -- (2in,0) node[midway,above,black]{Tuesday} -- (2in,-15cm);
\draw[gray] (2in,0) -- (3in,0) node[midway,above,black]{Wednesday} -- (3in, -15cm);
\draw[gray] (3in,0) -- (4in,0) node[midway,above,black]{Thursday} -- (4in, -15cm);
\draw[gray] (4in,0) -- (5in,0) node[midway,above,black]{Friday} -- (5 in, -15cm);
\path let % Course 1 on Mon
\p1 = (0,-1.5),
\p2 = (1in,-1.5),
\p3 = (0,{-1.5*(2+20/60)}),
\p4 = (1in,{-1.5*(2+20/60)}), in
coordinate (p1) at (\p1)
coordinate (p2) at (\p2)
coordinate (p3) at (\p3)
coordinate (p4) at (\p4)
coordinate (p5) at ($(\p1) !.5! (\p4)$);
\path[preaction={clip,postaction={fill=gPurple!20, draw=gPurple, line width=2pt}}] (p1) -- (p2) -- (p4) -- (p3) -- cycle;
\node at (p5) {\textbf{Course 1}};
\path let % Course 1 on Wed
\p1 = (2in,-1.5),
\p2 = (3in,-1.5),
\p3 = (2in,{-1.5*(2+20/60)}),
\p4 = (3in,{-1.5*(2+20/60)}), in
coordinate (p1) at (\p1)
coordinate (p2) at (\p2)
coordinate (p3) at (\p3)
coordinate (p4) at (\p4)
coordinate (p5) at ($(\p1) !.5! (\p4)$);
\path[preaction={clip,postaction={fill=gPurple!20, draw=gPurple, line width=2pt}}] (p1) -- (p2) -- (p4) -- (p3) -- cycle;
\node at (p5) {\textbf{Course 1}};
\path let % Course 1 on Fri
\p1 = (4in,-1.5),
\p2 = (5in,-1.5),
\p3 = (4in,{-1.5*(2+20/60)}),
\p4 = (5in,{-1.5*(2+20/60)}), in
coordinate (p1) at (\p1)
coordinate (p2) at (\p2)
coordinate (p3) at (\p3)
coordinate (p4) at (\p4)
coordinate (p5) at ($(\p1) !.5! (\p4)$);
\path[preaction={clip,postaction={fill=gPurple!20, draw=gPurple, line width=2pt}}] (p1) -- (p2) -- (p4) -- (p3) -- cycle;
\node at (p5) {\textbf{Course 1}};
\path let % Course 2 on Mon
\p1 = (0,-1.5*3),
\p2 = (1in,-1.5*3),
\p3 = (0,{-1.5*(3+50/60)}),
\p4 = (1in,{-1.5*(3+50/60)}), in
coordinate (p1) at (\p1)
coordinate (p2) at (\p2)
coordinate (p3) at (\p3)
coordinate (p4) at (\p4)
coordinate (p5) at ($(\p1) !.5! (\p4)$);
\path[preaction={clip,postaction={fill=Pantone2347U!30, draw=Pantone2347U!80, line width=2pt}}] (p1) -- (p2) -- (p4) -- (p3) -- cycle;
\node at (p5) {\textbf{Course 2}};
\path let % Course 2 on Wed
\p1 = (2in,-1.5*3),
\p2 = (3in,-1.5*3),
\p3 = (2in,{-1.5*(3+50/60)}),
\p4 = (3in,{-1.5*(3+50/60)}), in
coordinate (p1) at (\p1)
coordinate (p2) at (\p2)
coordinate (p3) at (\p3)
coordinate (p4) at (\p4)
coordinate (p5) at ($(\p1) !.5! (\p4)$);
\path[preaction={clip,postaction={fill=Pantone2347U!30, draw=Pantone2347U!80, line width=2pt}}] (p1) -- (p2) -- (p4) -- (p3) -- cycle;
\node at (p5) {\textbf{Course 2}};
\path let % Course 2 on Fri
\p1 = (4in,-1.5*3),
\p2 = (5in,-1.5*3),
\p3 = (4in,{-1.5*(3+50/60)}),
\p4 = (5in,{-1.5*(3+50/60)}), in
coordinate (p1) at (\p1)
coordinate (p2) at (\p2)
coordinate (p3) at (\p3)
coordinate (p4) at (\p4)
coordinate (p5) at ($(\p1) !.5! (\p4)$);
\path[preaction={clip,postaction={fill=Pantone2347U!30, draw=Pantone2347U!80, line width=2pt}}] (p1) -- (p2) -- (p4) -- (p3) -- cycle;
\node at (p5) {\textbf{Course 2}};
\path let % Course 3 on Mon
\p1 = (0,-1.5*7),
\p2 = (1in,-1.5*7),
\p3 = (0,{-1.5*(9+50/60)}),
\p4 = (1in,{-1.5*(9+50/60)}), in
coordinate (p1) at (\p1)
coordinate (p2) at (\p2)
coordinate (p3) at (\p3)
coordinate (p4) at (\p4)
coordinate (p5) at ($(\p1) !.5! (\p4)$);
\path[preaction={clip,postaction={fill=Pantone113U!20, draw=Pantone113U, line width=2pt}}] (p1) -- (p2) -- (p4) -- (p3) -- cycle;
\node at (p5) {\textbf{Course 3}};
\path let % Course 4 on Tue
\p1 = (1in,-1.5*2),
\p2 = (2in,-1.5*2),
\p3 = (1in,{-1.5*(3+50/60)}),
\p4 = (2in,{-1.5*(3+50/60)}), in
coordinate (p1) at (\p1)
coordinate (p2) at (\p2)
coordinate (p3) at (\p3)
coordinate (p4) at (\p4)
coordinate (p5) at ($(\p1) !.5! (\p4)$);
\path[preaction={clip,postaction={fill=gEvergreen!20, draw=gEvergreen, line width=2pt}}] (p1) -- (p2) -- (p4) -- (p3) -- cycle;
\node at (p5) {\textbf{Course 4}};
\path let % Course 4 on Fri
\p1 = (3in,-1.5*2),
\p2 = (4in,-1.5*2),
\p3 = (3in,{-1.5*(3+50/60)}),
\p4 = (4in,{-1.5*(3+50/60)}), in
coordinate (p1) at (\p1)
coordinate (p2) at (\p2)
coordinate (p3) at (\p3)
coordinate (p4) at (\p4)
coordinate (p5) at ($(\p1) !.5! (\p4)$);
\path[preaction={clip,postaction={fill=gEvergreen!20, draw=gEvergreen, line width=2pt}}] (p1) -- (p2) -- (p4) -- (p3) -- cycle;
\node at (p5) {\textbf{Course 4}};
\end{tikzpicture}
\end{figure}
\end{document}