color.py
1 """!
2 
3 @brief Colors used by pyclustering library for visualization.
4 
5 @authors Andrei Novikov (pyclustering@yandex.ru)
6 @date 2014-2018
7 @copyright GNU Public License
8 
9 @cond GNU_PUBLIC_LICENSE
10  PyClustering is free software: you can redistribute it and/or modify
11  it under the terms of the GNU General Public License as published by
12  the Free Software Foundation, either version 3 of the License, or
13  (at your option) any later version.
14 
15  PyClustering is distributed in the hope that it will be useful,
16  but WITHOUT ANY WARRANTY; without even the implied warranty of
17  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  GNU General Public License for more details.
19 
20  You should have received a copy of the GNU General Public License
21  along with this program. If not, see <http://www.gnu.org/licenses/>.
22 @endcond
23 
24 """
25 
26 
27 class color:
28  """!
29  @brief Consists titles of colors that are used by pyclustering for visualization.
30 
31  """
32 
33  @staticmethod
34  def get_color(sequential_index):
35  """!
36  @brief Returns color using round robin to avoid out of range exception.
37 
38  @param[in] sequential_index (uint): Index that should be converted to valid color index.
39 
40  @return (uint) Color from list color.TITLES.
41 
42  """
43  return color.TITLES[sequential_index % len(color.TITLES)]
44 
45 
46 
47  TITLES = [ 'red', 'blue', 'darkgreen', 'gold', 'violet',
48  'deepskyblue', 'darkgrey', 'lightsalmon', 'deeppink', 'yellow',
49  'black', 'mediumspringgreen', 'orange', 'darkviolet', 'darkblue',
50  'silver', 'lime', 'pink', 'brown', 'bisque',
51  'dimgray', 'firebrick', 'darksalmon', 'chartreuse', 'skyblue',
52  'purple', 'fuchsia', 'palegoldenrod', 'coral', 'hotpink',
53  'gray', 'tan', 'crimson', 'teal', 'olive']
def get_color(sequential_index)
Returns color using round robin to avoid out of range exception.
Definition: color.py:34
Consists titles of colors that are used by pyclustering for visualization.
Definition: color.py:27