forked from napari/napari
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnew_theme.py
More file actions
39 lines (28 loc) · 900 Bytes
/
Copy pathnew_theme.py
File metadata and controls
39 lines (28 loc) · 900 Bytes
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
"""
New theme
=========
Displays an image and sets the theme to new custom theme.
"""
from skimage import data
import napari
from napari.utils.theme import available_themes, get_theme, register_theme
# create the viewer with an image
viewer = napari.view_image(data.astronaut(), rgb=True, name='astronaut')
# List themes
print('Originally themes', available_themes())
blue_theme = get_theme('dark', False)
blue_theme.name = "blue"
blue_theme.icon = (
'rgb(0, 255, 255)' # you can provide colors as rgb(XXX, YYY, ZZZ)
)
blue_theme.background = 28, 31, 48 # or as tuples
blue_theme.foreground = [45, 52, 71] # or as list
blue_theme.primary = '#50586c' # or as hexes
blue_theme.current = 'orange' # or as color name
register_theme('blue', blue_theme)
# List themes
print('New themes', available_themes())
# Set theme
viewer.theme = 'blue'
if __name__ == '__main__':
napari.run()