GAP 4.8.9 installation with standard packages -- copy to your CoCalc project to get it
<?xml version="1.0" encoding="UTF-8"?>12<Chapter Label="colors">3<Heading>4The colors in the <Package>IntPic</Package> package5</Heading>6<!--<Index>&IntPic; - colors</Index>-->78The idea in what concerns the colors is the following: the reader is free to9choose his colors (taking into account that the latex <Package>xcolor</Package> package is10used), but we try to make users life reasonably easy. He is allowed to choose11tones. The default colors used by &IntPic; are not many, although (from our12experience) sufficient for most examples.13<!--Furthermore, we have functions that, especially when only a few of14the available colors are used, chose quite different colors.-->15<Section>16<Heading>Colors by tones</Heading>17The colors are divided by tones.18<!-- <Subsection>19<Heading>Tones</Heading>-->20<Listing Type="red"><![CDATA[21gap> IP_ColorsRedTones; #red22[ "red", "red!50", "red!20", "red!80!green!50", "red!80!blue!60" ]23]]></Listing>24<Alt Only="LaTeX">25\begin{center}26\includegraphics[scale=1.2]{../images/red_tones.pdf}27\end{center}28</Alt>29<Alt Only="HTML">30<br><center><img src="../images/red_tones.jpg"></center><br>31</Alt>32<Listing Type="green"><![CDATA[33gap> IP_ColorsGreenTones; #green34[ "green", "green!50", "green!20", "green!80!red!50", "green!80!blue!60" ]35]]></Listing>36<Alt Only="LaTeX">37\begin{center}38\includegraphics[scale=1.2]{../images/green_tones.pdf}39\end{center}40</Alt>41<Alt Only="HTML">42<br><center><img src="../images/green_tones.jpg"></center><br>43</Alt>44<Listing Type="blue"><![CDATA[45gap> IP_ColorsBlueTones; #blue46[ "blue", "blue!50", "blue!20", "blue!80!red!50", "blue!80!green!60" ]47]]></Listing>48<Alt Only="LaTeX">49\begin{center}50\includegraphics[scale=1.2]{../images/blue_tones.pdf}51\end{center}52</Alt>53<Alt Only="HTML">54<br><center><img src="../images/blue_tones.jpg"></center><br>55</Alt>56<Listing Type="cyan"><![CDATA[57gap> IP_ColorsCompRedTones; # cyan (complement of red)58[ "-red", "-red!50", "-red!20", "-red!80!green!50", "-red!80!blue!60" ]59]]></Listing>60<Alt Only="LaTeX">61\begin{center}62\includegraphics[scale=1.2]{../images/comp_red_tones.pdf}63\end{center}64</Alt>65<Alt Only="HTML">66<br><center><img src="../images/comp_red_tones.jpg"></center><br>67</Alt>68<Listing Type="magenta"><![CDATA[69gap> IP_ColorsCompGreenTones; # magenta (complement of green)70[ "-green", "-green!50", "-green!20", "-green!80!red!50", "-green!80!blue!60"71]72]]></Listing>73<Alt Only="LaTeX">74\begin{center}75\includegraphics[scale=1.2]{../images/comp_green_tones.pdf}76\end{center}77</Alt>78<Alt Only="HTML">79<br><center><img src="../images/comp_green_tones.jpg"></center><br>80</Alt>81<Listing Type="yellow"><![CDATA[82gap> IP_ColorsCompBlueTones; # yellow (complement of blue)83[ "-blue", "-blue!50", "-blue!20", "-blue!80!red!50", "-blue!80!green!60" ]84]]></Listing>85<Alt Only="LaTeX">86\begin{center}87\includegraphics[scale=1.2]{../images/comp_blue_tones.pdf}88\end{center}89</Alt>90<Alt Only="HTML">91<br><center><img src="../images/comp_blue_tones.jpg"></center><br>92</Alt>93<Listing Type="dark gray"><![CDATA[94gap> IP_ColorsDGrayTones; # dark gray95[ "black!80", "black!70", "black!60", "black!50", "black!40" ]96]]></Listing>97<Alt Only="LaTeX">98\begin{center}99\includegraphics[scale=1.2]{../images/dark_gray_tones.pdf}100\end{center}101</Alt>102<Alt Only="HTML">103<br><center><img src="../images/dark_gray_tones.jpg"></center><br>104</Alt>105<Listing Type="light gray"><![CDATA[106gap> IP_ColorsLGrayTones; # light gray107[ "black!30", "black!25", "black!20", "black!15", "black!10" ]108]]></Listing>109<Alt Only="LaTeX">110\begin{center}111\includegraphics[scale=1.2]{../images/light_gray_tones.pdf}112\end{center}113</Alt>114<Alt Only="HTML">115<br><center><img src="../images/light_gray_tones.jpg"></center><br>116</Alt>117</Section>118<Section>119<Heading>Lists of colors</Heading>120<Listing Type="array of colors by tones"><![CDATA[121gap> ListsOfIP_Colors;122[ [ "red", "red!50", "red!20", "red!80!green!50", "red!80!blue!60" ],123[ "green", "green!50", "green!20", "green!80!red!50", "green!80!blue!60" ],124[ "blue", "blue!50", "blue!20", "blue!80!red!50", "blue!80!green!60" ],125[ "-red", "-red!50", "-red!20", "-red!80!green!50", "-red!80!blue!60" ],126[ "-green", "-green!50", "-green!20", "-green!80!red!50",127"-green!80!blue!60" ],128[ "-blue", "-blue!50", "-blue!20", "-blue!80!red!50", "-blue!80!green!60" ],129[ "black!80", "black!70", "black!60", "black!50", "black!40" ],130[ "black!30", "black!25", "black!20", "black!15", "black!10" ] ]131]]></Listing>132<Listing Type="list of colors by tones"><![CDATA[133gap> IP_Colors;134[ "red", "red!50", "red!20", "red!80!green!50", "red!80!blue!60", "green",135"green!50", "green!20", "green!80!red!50", "green!80!blue!60", "blue",136"blue!50", "blue!20", "blue!80!red!50", "blue!80!green!60", "-red",137"-red!50", "-red!20", "-red!80!green!50", "-red!80!blue!60", "-green",138"-green!50", "-green!20", "-green!80!red!50", "-green!80!blue!60", "-blue",139"-blue!50", "-blue!20", "-blue!80!red!50", "-blue!80!green!60", "black!80",140"black!70", "black!60", "black!50", "black!40", "black!30", "black!25",141"black!20", "black!15", "black!10" ]142]]></Listing>143</Section>144<Section>145<Heading>The <Package>IntPic</Package> default list of colors</Heading>146The colors are shuffled by concatenating the transposed of the matrix147<C>ListsOfIP_Colors</C>. The list obtained is taken as the default list of colors.148<Listing Type="default list of colors"><![CDATA[149gap> ShuffledIP_colors;150[ "red", "green", "blue", "-red", "-green", "-blue", "black!80", "black!30",151"red!50", "green!50", "blue!50", "-red!50", "-green!50", "-blue!50",152"black!70", "black!25", "red!20", "green!20", "blue!20", "-red!20",153"-green!20", "-blue!20", "black!60", "black!20", "red!80!green!50",154"green!80!red!50", "blue!80!red!50", "-red!80!green!50", "-green!80!red!50",155"-blue!80!red!50", "black!50", "black!15", "red!80!blue!60",156"green!80!blue!60", "blue!80!green!60", "-red!80!blue!60",157"-green!80!blue!60", "-blue!80!green!60", "black!40", "black!10" ]158]]></Listing>159<Alt Only="LaTeX">160\begin{center}161\includegraphics[width=0.8\textwidth]{../images/intpic_default_colors.pdf}162\end{center}163</Alt>164<Alt Only="HTML">165<br><center><img src="../images/intpic_default_colors.jpg"></center><br>166</Alt>167These are the &IntPic; default colors. Although the user is free to use other colors, we warn that there is a need of compatibility with the colors used in other packages (the168&LaTeX; <Package>xcolor</Package>, for instance).169170To emphasize the integers of some sets by using some of the colors in some list of colors (for instance the default colors) one may use empty lists to force the non usage of the colors whose order in the list of colors is the order of these empty lists in the array of integers to be emphasized.171172<Example><![CDATA[173gap> m3 := Filtered([1..40],i->i mod 3=0);174[ 3, 6, 9, 12, 15, 18, 21, 24, 27, 30, 33, 36, 39 ]175gap> m5 := Filtered([1..40],i->i mod 5=0);176[ 5, 10, 15, 20, 25, 30, 35, 40 ]177gap> m7 := Filtered([1..40],i->i mod 7=0);178[ 7, 14, 21, 28, 35 ]179gap>180gap> arr := [[],[],m3,[],m5,[],m7];;181gap> tkz:=IP_TikzArrayOfIntegers([1..40],10,rec(highlights:=arr));;182]]></Example>183<Alt Only="LaTeX">184\begin{center}185\includegraphics[width=0.8\textwidth]{../images/mults_3_5_7}186\end{center}187</Alt>188<Alt Only="HTML">189<br><center><img src="../images/mults_3_5_7.jpg"></center><br>190</Alt>191192</Section>193<Section>194<Heading>Functions to deal with colors</Heading>195<!--196<ManSection>197<Heading>Auxiliary functions -- picking some elements from lists</Heading>198<Func Name="PickElementsFromList" Arg="arg"/>199<Description>200input: source is a list of length s; n is the number of elements to be picked201the distance between the elements picked is approximately the number of202remaining elements by the number of deserts. The first element is always203picked.204<Example><![CDATA[205gap> PickElementsFromList([1..20],3);206[ 1, 10, 19 ]207gap> PickElementsFromList([1..20],5);208[ 1, 5, 9, 13, 17 ]209]]></Example>210</Description>211<Func Name="PickSublistsFromListOfLists" Arg="arg"/>212<Description>213uses PickElementsFromList...214<Example><![CDATA[215gap> PickSublistsFromListOfLists([[1..20],[1..20]],[3,5]);216[ [ 1, 10, 19 ], [ 1, 5, 9, 13, 17 ] ]217]]></Example>218</Description>219</ManSection>220<ManSection>221<Heading>Creating tables of colors by tones</Heading>222<Func Name="IP_ColorsByTones" Arg="arg"/>223<Description>224the input is either a list of tones or are tones225<Example><![CDATA[226gap> IP_ColorsByTones("Reds","Blues");227[ [ "red", "red!50", "red!20", "red!80!green!50", "red!80!blue!60" ],228[ "blue", "blue!50", "blue!20", "blue!80!red!50", "blue!80!green!60" ] ]229]]></Example>230<Example><![CDATA[231gap> IP_ColorsByTones("Red","Blues");232the strings [ "Red" ] does not correspond to lists of colors233and will be ignored.234[ [ "blue", "blue!50", "blue!20", "blue!80!red!50", "blue!80!green!60" ] ]235]]></Example>236</Description>237</ManSection>238239<ManSection>240<Heading>Picking colors for one picture</Heading>241<Func Name="IP_ColorsForOneImage" Arg="arg"/>242<Description>243this function has as input a list of tones (from the list244RecNames(RecordOfColorsForIP_);245["Reds","rEDS","Greens","gREENS","Blues","bLUES","DGrays","LGrays"]) and a246number (which is the number of colors to be used)247-- the tones list is optional: if it is not present, all colors are used.248-- the number is optional too: when not present, the colors used are all the249colors of the selected tones. For each tone there is a list of *5* colors250<P/>251The output is a table of colors that are as far as possible from being similar252<Example><![CDATA[253gap> IP_ColorsForOneImage("rEDS","LGrays",5);254[ [ "-red", "-red!20", "-red!80!blue!60" ],255[ "black!30", "black!20", "black!10" ] ]256]]></Example>257</Description>258</ManSection>259-->260For the moment we only provide one function, which shuffles colors from lists of colors.261<ManSection>262<Heading>Shuffle colors from lists of colors</Heading>263<Func Name="ShuffleIP_Colors" Arg="mat"/>264<Description>265The argument <A>mat</A> is a list of lists of colors of the same length. The output is obtained by concatenating the transposed of <A>mat</A>.266<Example><![CDATA[267gap> ShuffleIP_Colors([IP_ColorsRedTones,IP_ColorsCompBlueTones]);268[ "red", "-blue", "red!50", "-blue!50", "red!20", "-blue!20",269"red!80!green!50", "-blue!80!red!50", "red!80!blue!60", "-blue!80!green!60"270]271]]></Example>272<Alt Only="LaTeX">273\begin{center}274\includegraphics[scale=1.2]{../images/shuffle_red_comp_blue.pdf}275\end{center}276</Alt>277<Alt Only="HTML">278<br><center><img src="../images/shuffle_red_comp_blue.jpg"></center><br>279</Alt>280281</Description>282</ManSection>283284</Section>285</Chapter>286287288