Skip to content

Commit 31b1704

Browse files
committed
Add a different colour theme for the extinct tree
1 parent 0ab30d8 commit 31b1704

File tree

3 files changed

+316
-8
lines changed

3 files changed

+316
-8
lines changed
Lines changed: 314 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,314 @@
1+
// define colours that will be used
2+
3+
let black = 'rgb(0,0,0)';
4+
let very_dark_grey = 'rgb(40,40,40)';
5+
let dark_grey = 'rgb(75,75,75)';
6+
let grey = 'rgb(95,95,95)';
7+
let mid_grey = 'rgb(115,115,115)';
8+
let light_grey = 'rgb(135,135,135)';
9+
let very_light_grey = 'rgb(180, 180, 180)';
10+
let off_white = 'rgb(240,240,240)'
11+
let white = 'rgb(255,255,255)';
12+
13+
let half_transparent_black = 'rgba(0,0,0,0.5)';
14+
let transparent_black = 'rgba(0,0,0,0.2)';
15+
let slightly_tranparent_white = 'rgba(255,255,255,0.85)';
16+
let half_transparent_white = 'rgba(255,255,255,0.5)';
17+
let very_transparent_white = 'rgba(255,255,255,0.2)';
18+
19+
let dark_green = 'rgb(20,80,00)';
20+
let green = 'rgb(70,135,30)';
21+
let light_green = 'rgb(135,215,90)';
22+
23+
let dark_brown = 'rgb(100,62,45)';
24+
let brown = 'rgb(125,70,55)';
25+
let light_brown = 'rgb(175,115,85)';
26+
27+
let pastel_red = 'rgb(255,130,130)';
28+
let pastel_green = 'rgb(130,255,130)';
29+
let pastel_blue = 'rgb(130,130,255)';
30+
let pastel_cyan = 'rgb(100,200,200)';
31+
let pastel_magenta = 'rgb(200,100,200)';
32+
let pastel_yellow = 'rgb(200,200,100)';
33+
34+
// define functions of a node that return different colours depending on node status
35+
36+
function outline_highlight(node) {
37+
if (node.richness_val > 1) {
38+
return black;
39+
} else {
40+
return leafcolor2b(node);
41+
}
42+
}
43+
44+
function leafcolor2b(node) {
45+
return black;
46+
}
47+
48+
function leafcolor1(node) {
49+
return dark_grey;
50+
}
51+
52+
function leafcolor2(node) {
53+
// for 'fake' leaves at end of branches that are not developed yet
54+
// note that this is not the same as undeveloped branches that are rendered as circles by a different colour scheme and dealt with as part of branch rendering.
55+
return black;
56+
}
57+
58+
function sponsor_highlight(node) {
59+
return black;
60+
}
61+
62+
function sponsor_color(node) {
63+
return black;
64+
}
65+
66+
function copyright_highlight_fill(node) {
67+
if (node.richness_val > 1) {
68+
return half_transparent_white;
69+
} else {
70+
return white;
71+
}
72+
}
73+
74+
function copyright_highlight_stroke(node) {
75+
if (node.richness_val > 1) {
76+
return black;
77+
} else {
78+
return white;
79+
}
80+
}
81+
82+
function copyright_fill(node) {
83+
if (node.richness_val > 1) {
84+
return leafcolor1(node);
85+
} else {
86+
return leafcolor2(node);
87+
}
88+
}
89+
90+
function copyright_stroke(node) {
91+
if (node.richness_val > 1) {
92+
return leafcolor2(node);
93+
} else {
94+
return leafcolor1(node);
95+
}
96+
}
97+
98+
function copyright_text_fill(node) {
99+
if (node.richness_val > 1) {
100+
return leafcolor2(node);
101+
} else {
102+
return leafcolor1(node);
103+
}
104+
}
105+
106+
function copyright_text_highlight_fill(node) {
107+
if (node.richness_val > 1) {
108+
return black;
109+
} else {
110+
return white;
111+
}
112+
}
113+
114+
function leaf_text_hover_outline(node) {
115+
return half_transparent_white;
116+
}
117+
118+
function get_leaf_text_fill(node) {
119+
return white;
120+
}
121+
122+
function branch_colour(node) {
123+
if (node._is_polytomy == true)
124+
{
125+
return brown;
126+
} else {
127+
return dark_brown;
128+
}
129+
}
130+
131+
const theme = {
132+
branch: {
133+
stroke: branch_colour,
134+
135+
// this pallette stores colours that are mapped to highlights
136+
marked_area_pallette: {
137+
'0': pastel_blue,
138+
'1': pastel_red,
139+
'2': pastel_green,
140+
'3': pastel_magenta,
141+
'4': pastel_cyan,
142+
'5': pastel_yellow
143+
},
144+
145+
highlight_search_hit: {
146+
stroke: pastel_red
147+
},
148+
// for search hit colouring including common ancestor markings
149+
highlight_search_hit1: {
150+
stroke: pastel_red
151+
},
152+
highlight_search_hit2: {
153+
stroke: pastel_blue
154+
},
155+
highlight_arrow_search_hit: {
156+
fill: pastel_red
157+
},
158+
highlight_arrow_search_hit1: {
159+
fill: pastel_red
160+
},
161+
highlight_arrow_search_hit2: {
162+
fill: pastel_blue
163+
}
164+
},
165+
166+
interior: {
167+
pic_text_hover: {
168+
stroke: transparent_black,
169+
fill: white
170+
},
171+
pic_text: {
172+
fill: white
173+
},
174+
175+
undeveloped: {
176+
stroke: light_grey,
177+
fill: off_white
178+
},
179+
180+
text_hover: {
181+
stroke: transparent_black
182+
},
183+
text: {
184+
fill: white
185+
},
186+
187+
sponsor_text_hover: { /* hide the sponsor text */
188+
fill: brown
189+
},
190+
sponsor_text: {
191+
fill: brown
192+
},
193+
194+
195+
circle_hover: {
196+
stroke: dark_brown,
197+
fill: dark_brown
198+
},
199+
circle: {
200+
stroke: brown,
201+
fill: dark_brown
202+
},
203+
circle_searchin: {
204+
stroke: half_transparent_white
205+
},
206+
circle_highlight: {
207+
outer: {
208+
fill: brown
209+
},
210+
inner: {
211+
fill: half_transparent_white
212+
}
213+
},
214+
215+
copyright_hover: {
216+
fill: white,
217+
stroke: black
218+
},
219+
220+
copyright: {
221+
fill: half_transparent_white,
222+
stroke: black,
223+
text: {
224+
fill: black
225+
},
226+
text_hover: {
227+
fill: black,
228+
}
229+
}
230+
231+
},
232+
233+
signpost: {
234+
pic: {
235+
stroke: half_transparent_white
236+
},
237+
238+
pic_hover: {
239+
stroke: half_transparent_black
240+
},
241+
242+
pic_inner: {
243+
stroke: white
244+
},
245+
246+
pic_text: {
247+
stroke: slightly_tranparent_white,
248+
fill: dark_grey
249+
},
250+
251+
pic_text_hover: {
252+
stroke: white,
253+
fill: black
254+
}
255+
},
256+
257+
leaf: {
258+
259+
bg: {
260+
fill: white,
261+
},
262+
263+
'outline_hover': {
264+
fill: outline_highlight
265+
},
266+
267+
outline: {
268+
fill: leafcolor2,
269+
stroke: leafcolor2
270+
},
271+
272+
inside: {
273+
fill: leafcolor1
274+
},
275+
276+
'inside_hover': {
277+
fill: leafcolor1
278+
},
279+
280+
text: {
281+
fill: get_leaf_text_fill
282+
},
283+
284+
'text_hover': {
285+
stroke: leaf_text_hover_outline
286+
},
287+
288+
sponsor: {
289+
fill: sponsor_color
290+
},
291+
292+
'sponsor_hover': {
293+
fill: sponsor_highlight
294+
},
295+
296+
'copyright_hover': {
297+
fill: copyright_fill,
298+
stroke: white
299+
},
300+
301+
copyright: {
302+
fill: copyright_fill,
303+
stroke: copyright_stroke,
304+
text: {
305+
fill: copyright_text_fill
306+
},
307+
'text_hover': {
308+
fill: white
309+
}
310+
}
311+
}
312+
}
313+
314+
export default theme;

OZprivate/rawJS/OZTreeModule/src/themes/index.js

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,9 @@
33
* (look at natural_theme.js for an example), then add it to this file. It should be picked up
44
* as one of the options available for the OneZoom object (in tree_settings.js)
55
**/
6-
export {default as natural} from './natural_theme';
7-
export {default as natural_CBF} from './natural_colour_blind_friendly';
8-
export {default as AT} from './at_theme';
9-
export {default as AT_CBF} from './at_colour_blind_friendly';
10-
export {default as otop} from './otop_theme';
6+
export {default as extinct} from './extinct_theme';
117
export {default as popularity} from './popularity_theme';
128
export {default as popularity_CBF} from './popularity_colour_blind_friendly';
13-
export {default as IUCN} from './IUCN_explicit_theme';
14-
export {default as IUCN_CBF} from './IUCN_explicit_colour_blind_friendly';
159

1610
export {default as gencons} from './genetic_conservation_theme';
1711
export {default as gencons_CBF} from './genetic_conservation_theme';

OZprivate/rawJS/OZTreeModule/src/tree_settings.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ class TreeSettings {
9696
}
9797

9898
this.default = {
99-
cols: this.options.cols.IUCN,
99+
cols: this.options.cols.extinct, //default theme
100100
layout: {
101101
branch: this.options.layout.branch.tree,
102102
node: this.options.layout.node.tree,

0 commit comments

Comments
 (0)