-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgetColorFriendly.m
More file actions
44 lines (42 loc) · 1.33 KB
/
getColorFriendly.m
File metadata and controls
44 lines (42 loc) · 1.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
function [colors] = getColorFriendly(nColors)
% nColors max is 10 for now. No need for more clusters for now.
paletteN = 10; % set palette color number 10
cMat = [];
[cMat] = addColor(cMat, 127,59,8); %rgb now =cmap
[cMat] = addColor(cMat, 179,88,6);
[cMat] = addColor(cMat, 224,130,20);
[cMat] = addColor(cMat, 253,184,99);
[cMat] = addColor(cMat, 254,224,182);
[cMat] = addColor(cMat, 216,218,235);
[cMat] = addColor(cMat, 178,171,210);
[cMat] = addColor(cMat, 128,115,172);
[cMat] = addColor(cMat, 84,39,136);
[cMat] = addColor(cMat, 45,0,75);
if nColors < paletteN +1
switch nColors
case 2
index = [5,10];
case 3
index = [5,7,10];
case 4
index = [1,5,7,10];
case 5
index = [1,3,5,7,10];
case 6
index = [1,3,5,7,8,10];
case 7
index = [1,2,3,5,7,8,10];
case 8
index = [1,2,3,4,5,7,8,10];
case 9
index = [1,2,3,4,5,7,8,9,10];
case 10
index = [1,2,3,4,5,6,7,8,9,10];
end
colors = cMat(index, :);
end
function [mat] = addColor(mat, R,G,B)
rgbRow = [R/255, G/255, B/255];
mat = [mat;rgbRow];
end
end