Skip to content

Commit a7e5cd1

Browse files
fix: do not share the Expr for text_color and background_color
Signed-off-by: Maarten A. Breddels <[email protected]>
1 parent 061975d commit a7e5cd1

File tree

1 file changed

+19
-3
lines changed

1 file changed

+19
-3
lines changed

ipydatagrid/cellrenderer.py

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,17 @@
66
from bqplot import ColorScale, Scale
77
from ipywidgets import Color, Widget, widget_serialization
88
from py2vega import Variable, py2vega
9-
from traitlets import Any, Bool, Enum, Float, Instance, Unicode, Union, validate
9+
from traitlets import (
10+
Any,
11+
Bool,
12+
Enum,
13+
Float,
14+
Instance,
15+
Unicode,
16+
Union,
17+
default,
18+
validate,
19+
)
1020

1121
from ._frontend import module_name, module_version
1222

@@ -68,11 +78,9 @@ class TextRenderer(CellRenderer):
6878
).tag(sync=True, **widget_serialization)
6979
text_color = Union(
7080
(Color(), Instance(VegaExpr), Instance(ColorScale)),
71-
default_value=Expr("default_value"),
7281
).tag(sync=True, **widget_serialization)
7382
background_color = Union(
7483
(Color(), Instance(VegaExpr), Instance(ColorScale)),
75-
default_value=Expr("default_value"),
7684
).tag(sync=True, **widget_serialization)
7785
vertical_alignment = Union(
7886
(
@@ -98,6 +106,14 @@ class TextRenderer(CellRenderer):
98106
)
99107
missing = Unicode("").tag(sync=True)
100108

109+
@default("text_color")
110+
def _default_text_color(self):
111+
return Expr("default_value")
112+
113+
@default("background_color")
114+
def _default_background_color(self):
115+
return Expr("default_value")
116+
101117

102118
class BarRenderer(TextRenderer):
103119
_model_name = Unicode("BarRendererModel").tag(sync=True)

0 commit comments

Comments
 (0)