diff --git a/d2graph/d2graph.go b/d2graph/d2graph.go
index 99206e667..ae3bfc74d 100644
--- a/d2graph/d2graph.go
+++ b/d2graph/d2graph.go
@@ -338,6 +338,12 @@ func (l ContainerLevel) LabelSize() int {
func (obj *Object) GetFill() string {
level := int(obj.Level())
+ shape := obj.Attributes.Shape.Value
+
+ if strings.EqualFold(shape, d2target.ShapeSQLTable) || strings.EqualFold(shape, d2target.ShapeClass) {
+ return color.N1
+ }
+
if obj.IsSequenceDiagramNote() {
return color.N7
} else if obj.IsSequenceDiagramGroup() {
@@ -366,8 +372,6 @@ func (obj *Object) GetFill() string {
return color.N7
}
- shape := obj.Attributes.Shape.Value
-
if shape == "" || strings.EqualFold(shape, d2target.ShapeSquare) || strings.EqualFold(shape, d2target.ShapeCircle) || strings.EqualFold(shape, d2target.ShapeOval) || strings.EqualFold(shape, d2target.ShapeRectangle) {
if level == 1 {
if !obj.IsContainer() {
@@ -409,10 +413,6 @@ func (obj *Object) GetFill() string {
return color.N5
}
- if strings.EqualFold(shape, d2target.ShapeSQLTable) || strings.EqualFold(shape, d2target.ShapeClass) {
- return color.N1
- }
-
return color.N7
}
diff --git a/e2etests/regression_test.go b/e2etests/regression_test.go
index dc2f152bc..00b3c1b1b 100644
--- a/e2etests/regression_test.go
+++ b/e2etests/regression_test.go
@@ -39,6 +39,17 @@ group.nested: {
`,
expErr: "no actors declared in sequence diagram",
},
+ {
+ name: "class_font_style_sequence",
+ script: `shape: sequence_diagram
+a: {
+ shape: class
+ style: {
+ font-color: red
+ }
+}
+`,
+ },
{
name: "nested_steps",
script: `a: {
diff --git a/e2etests/testdata/regression/class_font_style_sequence/dagre/board.exp.json b/e2etests/testdata/regression/class_font_style_sequence/dagre/board.exp.json
new file mode 100644
index 000000000..247dd556c
--- /dev/null
+++ b/e2etests/testdata/regression/class_font_style_sequence/dagre/board.exp.json
@@ -0,0 +1,91 @@
+{
+ "name": "",
+ "fontFamily": "SourceSansPro",
+ "shapes": [
+ {
+ "id": "a",
+ "type": "class",
+ "pos": {
+ "x": 12,
+ "y": 52
+ },
+ "width": 117,
+ "height": 92,
+ "opacity": 1,
+ "strokeDash": 0,
+ "strokeWidth": 2,
+ "borderRadius": 0,
+ "fill": "N1",
+ "stroke": "N7",
+ "shadow": false,
+ "3d": false,
+ "multiple": false,
+ "double-border": false,
+ "tooltip": "",
+ "link": "",
+ "icon": null,
+ "iconPosition": "",
+ "blend": false,
+ "fields": null,
+ "methods": null,
+ "columns": null,
+ "label": "a",
+ "fontSize": 20,
+ "fontFamily": "DEFAULT",
+ "language": "",
+ "color": "red",
+ "italic": false,
+ "bold": false,
+ "underline": false,
+ "labelWidth": 12,
+ "labelHeight": 31,
+ "labelPosition": "INSIDE_MIDDLE_CENTER",
+ "zIndex": 0,
+ "level": 1,
+ "primaryAccentColor": "B2",
+ "secondaryAccentColor": "AA2",
+ "neutralAccentColor": "N2"
+ }
+ ],
+ "connections": [
+ {
+ "id": "(a -- )[0]",
+ "src": "a",
+ "srcArrow": "none",
+ "srcLabel": "",
+ "dst": "a-lifeline-end-2251863791",
+ "dstArrow": "none",
+ "dstLabel": "",
+ "opacity": 1,
+ "strokeDash": 6,
+ "strokeWidth": 2,
+ "stroke": "B2",
+ "label": "",
+ "fontSize": 16,
+ "fontFamily": "DEFAULT",
+ "language": "",
+ "color": "N2",
+ "italic": true,
+ "bold": false,
+ "underline": false,
+ "labelWidth": 0,
+ "labelHeight": 0,
+ "labelPosition": "",
+ "labelPercentage": 0,
+ "route": [
+ {
+ "x": 70.5,
+ "y": 144
+ },
+ {
+ "x": 70.5,
+ "y": 214
+ }
+ ],
+ "animated": false,
+ "tooltip": "",
+ "icon": null,
+ "zIndex": 1
+ }
+ ]
+}
diff --git a/e2etests/testdata/regression/class_font_style_sequence/dagre/sketch.exp.svg b/e2etests/testdata/regression/class_font_style_sequence/dagre/sketch.exp.svg
new file mode 100644
index 000000000..682ad03a0
--- /dev/null
+++ b/e2etests/testdata/regression/class_font_style_sequence/dagre/sketch.exp.svg
@@ -0,0 +1,43 @@
+
\ No newline at end of file
diff --git a/e2etests/testdata/regression/class_font_style_sequence/elk/board.exp.json b/e2etests/testdata/regression/class_font_style_sequence/elk/board.exp.json
new file mode 100644
index 000000000..247dd556c
--- /dev/null
+++ b/e2etests/testdata/regression/class_font_style_sequence/elk/board.exp.json
@@ -0,0 +1,91 @@
+{
+ "name": "",
+ "fontFamily": "SourceSansPro",
+ "shapes": [
+ {
+ "id": "a",
+ "type": "class",
+ "pos": {
+ "x": 12,
+ "y": 52
+ },
+ "width": 117,
+ "height": 92,
+ "opacity": 1,
+ "strokeDash": 0,
+ "strokeWidth": 2,
+ "borderRadius": 0,
+ "fill": "N1",
+ "stroke": "N7",
+ "shadow": false,
+ "3d": false,
+ "multiple": false,
+ "double-border": false,
+ "tooltip": "",
+ "link": "",
+ "icon": null,
+ "iconPosition": "",
+ "blend": false,
+ "fields": null,
+ "methods": null,
+ "columns": null,
+ "label": "a",
+ "fontSize": 20,
+ "fontFamily": "DEFAULT",
+ "language": "",
+ "color": "red",
+ "italic": false,
+ "bold": false,
+ "underline": false,
+ "labelWidth": 12,
+ "labelHeight": 31,
+ "labelPosition": "INSIDE_MIDDLE_CENTER",
+ "zIndex": 0,
+ "level": 1,
+ "primaryAccentColor": "B2",
+ "secondaryAccentColor": "AA2",
+ "neutralAccentColor": "N2"
+ }
+ ],
+ "connections": [
+ {
+ "id": "(a -- )[0]",
+ "src": "a",
+ "srcArrow": "none",
+ "srcLabel": "",
+ "dst": "a-lifeline-end-2251863791",
+ "dstArrow": "none",
+ "dstLabel": "",
+ "opacity": 1,
+ "strokeDash": 6,
+ "strokeWidth": 2,
+ "stroke": "B2",
+ "label": "",
+ "fontSize": 16,
+ "fontFamily": "DEFAULT",
+ "language": "",
+ "color": "N2",
+ "italic": true,
+ "bold": false,
+ "underline": false,
+ "labelWidth": 0,
+ "labelHeight": 0,
+ "labelPosition": "",
+ "labelPercentage": 0,
+ "route": [
+ {
+ "x": 70.5,
+ "y": 144
+ },
+ {
+ "x": 70.5,
+ "y": 214
+ }
+ ],
+ "animated": false,
+ "tooltip": "",
+ "icon": null,
+ "zIndex": 1
+ }
+ ]
+}
diff --git a/e2etests/testdata/regression/class_font_style_sequence/elk/sketch.exp.svg b/e2etests/testdata/regression/class_font_style_sequence/elk/sketch.exp.svg
new file mode 100644
index 000000000..682ad03a0
--- /dev/null
+++ b/e2etests/testdata/regression/class_font_style_sequence/elk/sketch.exp.svg
@@ -0,0 +1,43 @@
+
\ No newline at end of file