15 lines
641 B
Mathematica
15 lines
641 B
Mathematica
|
|
function [colors] = giveColors(n)
|
||
|
|
if n > 36
|
||
|
|
error('Maximum number of colors 36');
|
||
|
|
end
|
||
|
|
colors = [1 0 0; 0 1 0; 0 0 1; 1 1 0 ; 1 0 1; 0 1 1; ...
|
||
|
|
0.4 0 0; 0 0.4 0; 0 0 0.4; 0.4 0.4 0; 0.4 0 0.4; 0 0.4 0.4; ...
|
||
|
|
0.2 0 0; 0 0.2 0; 0 0 0.2; 0.2 0.2 0; 0.2 0 0.2; 0 0.2 0.2; ...
|
||
|
|
0.8 0 0; 0 0.8 0; 0 0 0.8; 0.8 0.8 0; 0.8 0 0.8; 0 0.8 0.8; ...
|
||
|
|
0.6 0 0; 0 0.6 0; 0 0 0.6; 0.6 0.6 0; 0.6 0 0.6; 0 0.6 0.6; ...
|
||
|
|
0.6 0.2 0.4; 0.2 0.4 0.8; 0.8 0.4 0.2; 0 0.6 0.2; 0.2 0.8 0.6; 0.5 0.2 0.1; ...
|
||
|
|
0.6 0.3 0.1];
|
||
|
|
colors = colors(1:n,:);
|
||
|
|
% red; green; blue; yellow
|
||
|
|
% RGB format: [red green blue]
|