# MATLAB Line Colors for The University of Michigan

One maize. One blue. One brand. This function makes the University of Michigan colors available in an array (just like how lines() works in MATLAB). To get all the primary colors:

``colors = linesUM;``

To limit the amount of colors returned (for instance, to use the colors as a colormap):

``colors = linesUM(3);``

Finally, to get all the secondary colors just pass in Inf for the amount of colors and set onlySecondary to true:

``colors = linesUM(Inf,true);``

``function colors = linesUM(nColors,onlySecondary)``
``if ~exist('nColors','var')``
``    nColors = Inf;``
``end``
`` ``
``if ~exist('onlySecondary','var')``
``    onlySecondary = false;``
``end``
``% maize & blue + BRIGHT colors, n=8``
``primaryUMcolors = [254 202 48;...``
``    2 40 75;...``
``    177 34 31;...``
``    232 127 46;...``
``    185 178 39;...``
``    28 177 175;...``
``    25 110 180;...``
``    110 47 140] / 255;``
``% only metallic colors, n=12``
``secondaryUMcolors = [231 211 166;...``
``    178 169 128;...``
``    173 175 178;...``
``    187 178 167;...``
``    125 106 86;...``
``    17 27 34;...``
``    121 22 9;...``
``    205 112 40;...``
``    123 111 19;...``
``    140 174 162;...``
``    81 139 188;...``
``    81 79 132] / 255;``
`` ``
``if onlySecondary``
``    nColors = min(size(secondaryUMcolors,1),nColors);``
``    colors = secondaryUMcolors(1:nColors,:);``
``else``
``    colors = [primaryUMcolors;secondaryUMcolors];``
``    nColors = min(size(colors,1),nColors);``
``    colors = colors(1:nColors,:);``
``end``