Skip to content

Commit 159f61d

Browse files
authored
fix: Safer label color API (#259)
Signed-off-by: Christoph Auer <[email protected]>
1 parent caa8aee commit 159f61d

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

docling_core/types/doc/labels.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ def get_color(label: "DocItemLabel") -> Tuple[int, int, int]:
4545
DocItemLabel.PAGE_FOOTER: (204, 255, 204),
4646
DocItemLabel.PAGE_HEADER: (204, 255, 204),
4747
DocItemLabel.PICTURE: (255, 204, 164),
48+
DocItemLabel.CHART: (255, 204, 164),
4849
DocItemLabel.SECTION_HEADER: (255, 153, 153),
4950
DocItemLabel.TABLE: (255, 204, 204),
5051
DocItemLabel.TEXT: (255, 255, 153),
@@ -58,7 +59,7 @@ def get_color(label: "DocItemLabel") -> Tuple[int, int, int]:
5859
DocItemLabel.PARAGRAPH: (255, 255, 153),
5960
DocItemLabel.REFERENCE: (176, 224, 230),
6061
}
61-
return color_map[label]
62+
return color_map.get(label, (0, 0, 0))
6263

6364

6465
class GroupLabel(str, Enum):

0 commit comments

Comments
 (0)