% Colors.m     gr16sep17
% Three-color chromaticity diagram @ different luminances

R = [.7 .26];     % base colors
G = [.1 .8];
B = [.2 .15];

for k = 0:.2:1;
 plot(R(1),R(2),'r+','LineWidth',4,'MarkerSize',12); hold on;
 plot(G(1),G(2),'g+','LineWidth',4,'MarkerSize',12);
 plot(B(1),B(2),'b+','LineWidth',4,'MarkerSize',12);
 axis([0 .8 0 .9])
 text(.05,.05,['k = ', num2str(k)]);
for i=1:180
 w = rand(1,3); w = w/sum(w);
 c = ( w * [R; G; B;] )';
 ybr = rgb2ycbcr(w); ybr(1)=k; col = ycbcr2rgb(ybr);
 plot(c(1),c(2),'o','MarkerSize',15,'MarkerFaceColor',col,'MarkerEdgeColor',col);
 drawnow;
end; hold off; pause();
end
