1
- from typing import Dict , Optional , Union
1
+ from typing import Optional , Union
2
2
from warnings import warn
3
3
4
4
import napari .qt
@@ -141,47 +141,47 @@ def from_napari_css_get_size_of(
141
141
return QSize (* fallback )
142
142
143
143
144
- def style_sheet_from_theme (theme : Theme ) -> Dict [str , str ]:
144
+ def style_sheet_from_theme (theme : Theme ) -> dict [str , str ]:
145
145
"""Translate napari theme to a matplotlib style dictionary.
146
146
147
147
Parameters
148
148
----------
149
149
theme : napari.utils.theme.Theme
150
150
Napari theme object representing the theme of the current viewer.
151
-
151
+
152
152
Returns
153
153
-------
154
154
Dict[str, str]
155
155
Matplotlib compatible style dictionary.
156
156
"""
157
157
return {
158
- ' axes.edgecolor' : theme .secondary .as_hex (),
159
- #BUG: could be the same as napari canvas, but facecolors do not get
158
+ " axes.edgecolor" : theme .secondary .as_hex (),
159
+ # BUG: could be the same as napari canvas, but facecolors do not get
160
160
# updated upon redraw for what ever reason
161
161
#'axes.facecolor':theme.canvas.as_hex(),
162
- ' axes.facecolor' : ' none' ,
163
- ' axes.labelcolor' : theme .text .as_hex (),
164
- ' boxplot.boxprops.color' : theme .text .as_hex (),
165
- ' boxplot.capprops.color' : theme .text .as_hex (),
166
- ' boxplot.flierprops.markeredgecolor' : theme .text .as_hex (),
167
- ' boxplot.whiskerprops.color' : theme .text .as_hex (),
168
- ' figure.edgecolor' : theme .secondary .as_hex (),
169
- #BUG: should be the same as napari background, but facecolors do not get
162
+ " axes.facecolor" : " none" ,
163
+ " axes.labelcolor" : theme .text .as_hex (),
164
+ " boxplot.boxprops.color" : theme .text .as_hex (),
165
+ " boxplot.capprops.color" : theme .text .as_hex (),
166
+ " boxplot.flierprops.markeredgecolor" : theme .text .as_hex (),
167
+ " boxplot.whiskerprops.color" : theme .text .as_hex (),
168
+ " figure.edgecolor" : theme .secondary .as_hex (),
169
+ # BUG: should be the same as napari background, but facecolors do not get
170
170
# updated upon redraw for what ever reason
171
171
#'figure.facecolor':theme.background.as_hex(),
172
- ' figure.facecolor' : ' none' ,
173
- ' grid.color' : theme .foreground .as_hex (),
174
- #COMMENT: the hard coded colors are to match the previous behaviour
172
+ " figure.facecolor" : " none" ,
173
+ " grid.color" : theme .foreground .as_hex (),
174
+ # COMMENT: the hard coded colors are to match the previous behaviour
175
175
# alternativly we could use the theme to style the legend as well
176
176
#'legend.edgecolor':theme.secondary.as_hex(),
177
- ' legend.edgecolor' : ' black' ,
177
+ " legend.edgecolor" : " black" ,
178
178
#'legend.facecolor':theme.background.as_hex(),
179
- ' legend.facecolor' : ' white' ,
179
+ " legend.facecolor" : " white" ,
180
180
#'legend.labelcolor':theme.text.as_hex()
181
- ' legend.labelcolor' : ' black' ,
182
- ' text.color' : theme .text .as_hex (),
183
- ' xtick.color' : theme .secondary .as_hex (),
184
- ' xtick.labelcolor' : theme .text .as_hex (),
185
- ' ytick.color' : theme .secondary .as_hex (),
186
- ' ytick.labelcolor' : theme .text .as_hex (),
187
- }
181
+ " legend.labelcolor" : " black" ,
182
+ " text.color" : theme .text .as_hex (),
183
+ " xtick.color" : theme .secondary .as_hex (),
184
+ " xtick.labelcolor" : theme .text .as_hex (),
185
+ " ytick.color" : theme .secondary .as_hex (),
186
+ " ytick.labelcolor" : theme .text .as_hex (),
187
+ }
0 commit comments