diff --git a/+rgb/X11.m b/+rgb/X11.m index dc61ab6..080ab9d 100644 --- a/+rgb/X11.m +++ b/+rgb/X11.m @@ -77,7 +77,7 @@ % Make sure the function can load the data, rebuild it if necessary disp 'Cannot load X11/rgb database. I will try to import from local X11.txt file now.' X11_install - % Load data created by xkcd_install + % Load data created by X11_install load([here,'/private/X11_rgb_data.mat'],'namelist','rgblist'); end @@ -166,7 +166,7 @@ end -%% Web-installation subfunction: +%% installation subfunction: function X11_install @@ -186,13 +186,13 @@ if ~exist('X11.txt','file') disp 'Cannot find X11.txt file.' try - %websave('rgb.txt','https://X11.com/color/rgb.txt'); + % websave('rgb.txt','https://do-not-know-a-url.txt'); catch try - %urlwrite('https://X11.com/color/rgb.txt','rgb.txt'); %#ok + % urlwrite('https://do-not-know-a-url.txt,'rgb.txt'); %#ok catch - disp('Having trouble downloading the txt file. You''ll need to download it manually') - disp('from http://X11.com/color/rgb.txt and place it in current folder. Then run again.') + disp('Having trouble finding the txt file. You''ll need to retrieve it manually') + disp('from your *nix system and place it in current folder. Then run again.') return end end diff --git a/.test/test_X11_update.m b/.test/test_X11_update.m new file mode 100644 index 0000000..08e9147 --- /dev/null +++ b/.test/test_X11_update.m @@ -0,0 +1,23 @@ +X11_update() + +function X11_update() + + disp('TESTING upgrade of X11 colors [rgb.X11]') + + colorlab.enter + close all + clear + + here = pwd; + root = erase(fileparts(mfilename('fullpath')),'.test'); + cd(root) + cd('+rgb/private') + delete('X11_rgb_data.mat') + cd(here) + + rgb.X11('white'); + + disp('>> All good!') + disp('------------') + +end \ No newline at end of file diff --git a/.test/test_all_docstrings.m b/.test/test_all_docstrings.m index 1b9919f..665cdac 100644 --- a/.test/test_all_docstrings.m +++ b/.test/test_all_docstrings.m @@ -8,6 +8,49 @@ function all_docstrings() close all clear + disp COLORNAMES + + disp colorshow + import rgb.* + X11('show') + xkcd('show') + disp '...done!' + + disp X11 + X11('navyblue') + X11('SpringGreen','CornflowerBlue','sapphire','radioactive green') + x = -pi:.1:pi; + y = cos(x); + plot(x,y,'linewidth',4,'color',X11('CornflowerBlue')) + hold on + plot(x,y-1,'*','color',X11('Brown1')) + plot(x,y-2,'linewidth',4,'color',X11('SeaGreen')) + legend('cornflower','brown1 (wtf?!)','SeaGreen') + set(gca,'color',X11('seashell')) + text(-1,-2,'This text is chocolate (wtf?!).','fontweight','bold','color',... + X11('chocolate')); + close all + disp '...done!' + + disp xkcd + xkcd('baby blue') + xkcd('wintergreen','sunflower yellow','sapphire','radioactive green') + x = -pi:.1:pi; + y = cos(x); + plot(x,y,'linewidth',4,'color',xkcd('cornflower')) + hold on + plot(x,y-1,'*','color',xkcd('strawberry')) + plot(x,y-2,'linewidth',4,'color',xkcd('puke green')) + legend('cornflower','strawberry','puke green') + set(gca,'color',xkcd('eggshell')) + text(-1,-2,'This text is burnt orange.','fontweight','bold','color',... + xkcd('burnt orange')); + close all + disp '...done!' + + disp('>> All good!') + disp('------------') + disp COLORTOOLS disp view_color @@ -130,7 +173,7 @@ function all_docstrings() surfc(X,Y,Z) cmap = palette.cubehelix([],0.7,-0.7,2,1,[0.1,0.9],[0.1,0.9]); colormap(cmap) - preset_palette(@palette.cubehelix, 3,-0.5,1.5,1); % preselect the map. + preset_palette(@palette.cubehelix,[3,-0.5,1.5,1]); % preselect the map. cmap = palette.cubehelix([],3,-0.5,1.5,1); assert(isequal(cmap,preset_palette)) clear; close @@ -161,9 +204,6 @@ function all_docstrings() close all force % brewer is nasty disp '...done!' - disp('>> All good!') - disp('------------') - end function names = matplotlib_names() diff --git a/.test/test_cmocean_negative.m b/.test/test_cmocean_negative.m new file mode 100644 index 0000000..45d27e3 --- /dev/null +++ b/.test/test_cmocean_negative.m @@ -0,0 +1,19 @@ +cmocean_negative() + +function cmocean_negative() + + disp('TESTING negative lightness [palette.cmocean]') + + colorlab.enter + close all + clear + + map1 = get_palette('algae',256,'negative'); + map2 = palette.cmocean('algae','negative'); + + assert(isequal(map1,map2)) + + disp('>> All good!') + disp('------------') + +end \ No newline at end of file diff --git a/.test/test_crameri_update.m b/.test/test_crameri_update.m new file mode 100644 index 0000000..40f9735 --- /dev/null +++ b/.test/test_crameri_update.m @@ -0,0 +1,20 @@ +upgrade_crameri() + +function upgrade_crameri() + + disp('TESTING upgrading of crameri [private function]') + + here = pwd; + root = erase(fileparts(mfilename('fullpath')),'.test'); + cd(root) + cd('crameri') + disp('Release 7 [zenodo::5501399]') + crameri_update(7,5501399) + disp('Release 6 [zenodo::4153113]') + crameri_update('6','4153113') + cd(here) + + disp('>> All good!') + disp('------------') + +end \ No newline at end of file diff --git a/.test/test_install.m b/.test/test_install.m new file mode 100644 index 0000000..b0d13ea --- /dev/null +++ b/.test/test_install.m @@ -0,0 +1,14 @@ +install() + +function install() + + disp('TESTING (un)install procedures [+colorlab]') + + colorlab.vista + colorlab.enter + colorlab.leave + + disp('>> All good!') + disp('------------') + +end \ No newline at end of file diff --git a/.test/test_xkcd_update.m b/.test/test_xkcd_update.m new file mode 100644 index 0000000..4d8b5cf --- /dev/null +++ b/.test/test_xkcd_update.m @@ -0,0 +1,23 @@ +xkcd_update() + +function xkcd_update() + + disp('TESTING upgrade of xkcd colors [rgb.xkcd]') + + colorlab.enter + close all + clear + + here = pwd; + root = erase(fileparts(mfilename('fullpath')),'.test'); + cd(root) + cd('+rgb/private') + delete('xkcd_rgb_data.mat') + cd(here) + + rgb.xkcd('white'); + + disp('>> All good!') + disp('------------') + +end \ No newline at end of file