-
Notifications
You must be signed in to change notification settings - Fork 0
/
openmined_theme.py
111 lines (101 loc) · 2.97 KB
/
openmined_theme.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
from typing import Dict
# Quadrant colours
northwest_orange_dark = "#ED986C"
northwest_orange_light = "#F1BF7A"
northwest_orange_gradient = [
"#F1BF7A",
"#ED986C",
]
northeast_green_dark = "#5CB5A4"
northeast_green_light = "#9BCC9A"
northeast_green_gradient = [
"#5CB5A4",
"#9BCC9A",
]
southeast_blue_dark = "#767EA1"
southeast_blue_light = "#62A4AE"
southeast_blue_gradient = [
"#62A4AE",
"#767EA1",
]
southwest_red_dark = "#C3707C"
southwest_red_light = "#EF996B"
southwest_red_gradient = [
"#C3707C",
"#EF996B",
]
# Grayscale colours
light_gray = "#969696"
gray = "#808080"
dark_gray = "#323232"
# Fonts
headline_font = "PT Mono"
body_font = "Overpass"
def openmined() -> Dict:
"""
OpenMined colour scheme for Altair
To use, register and enable the theme:
import altair
altair.themes.register("openmined", openmined)
altair.themes.enable("openmined")
Returns
-------
dict
Altair colour scheme spec
"""
return {
"config": {
"background": "#FFFFFF",
"title": {
"anchor": "start",
"color": dark_gray,
"font": headline_font,
"fontSize": 22,
"fontWeight": "normal",
},
"legend": {
"labelFont": body_font,
"labelFontSize": 13,
"symbolType": "circle",
"titleFont": headline_font,
"titleFontSize": 11,
},
"axis": {
"domain": False,
"grid": False,
"labelColor": dark_gray,
"labelPadding": 4,
"tickColor": dark_gray,
"tickSize": 5.67,
"titleFontSize": 16,
"titleFontWeight": "normal",
},
# Colours
"range": {
"category": [
northwest_orange_dark,
northeast_green_dark,
southeast_blue_dark,
southwest_red_dark,
northwest_orange_light,
northeast_green_light,
southeast_blue_light,
southwest_red_light,
],
"heatmap": northwest_orange_gradient,
"ordinal": northwest_orange_gradient,
},
# Marks
"arc": {"fill": northwest_orange_dark},
"area": {"fill": northwest_orange_dark},
"point": {
"fill": northwest_orange_dark, # Use dark orange as default colour
"filled": True,
"shape": "M 0 -1 l 0.179 0.821 L 1 0 l -0.821 0.179 L 0 1 l -0.179 -0.821 L -1 0 l 0.821 -0.179 Z",
"size": 250,
},
"line": {"stroke": northwest_orange_dark, "strokeWidth": 2,},
"bar": {"binSpacing": 2, "fill": northwest_orange_dark, "stroke": None,},
# TODO rect
}
}