1 # This program is free software; you can redistribute it and/or modify
2 # it under the terms of the GNU General Public License as published by
3 # the Free Software Foundation; either version 2 of the License, or
4 # (at your option) any later version.
6 # This program is distributed in the hope that it will be useful,
7 # but WITHOUT ANY WARRANTY; without even the implied warranty of
8 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 # GNU Library General Public License for more details.
11 # You should have received a copy of the GNU General Public License
12 # along with this program; if not, write to the Free Software
13 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
15 # See the COPYING file for license information.
17 # Copyright (c) 2006, 2007, 2008 Guillaume Chazarain <guichaz@gmail.com>
19 def normalize(*colors
):
20 return map(lambda x
: x
/ 255.0, colors
)
22 SMALL_DIRECTORY
= normalize(145, 166, 245)
23 BIG_DIRECTORY
= normalize(100, 100, 200)
25 SMALL_FILE
= normalize(255, 128, 128)
26 BIG_FILE
= normalize(204, 0, 0)
28 SMALL_REMAINING
= normalize(128, 255, 255)
29 BIG_REMAINING
= normalize(89, 178, 175)
31 def map_interpol(small
, big
, interpol
, size
):
32 return map(lambda i
: interpol(small
[i
], big
[i
], size
), xrange(3))
34 def get_node_colors(node
, is_hovered
, is_selected
, interpol
):
37 base_color
= map_interpol(SMALL_DIRECTORY
, BIG_DIRECTORY
,
40 base_color
= map_interpol(SMALL_FILE
, BIG_FILE
,
43 base_color
= map_interpol(SMALL_REMAINING
, BIG_REMAINING
,
47 base_color
= map(lambda x
: x
* 0.6, base_color
)
50 base_color
= map(lambda x
: (x
+ 1.0) / 2.0, base_color
)
53 col1
= map(lambda x
: min(1.0, x
+ 0.08), base_color
)
54 col2
= map(lambda x
: max(0.0, x
- 0.08), base_color
)