Skip to content

Commit b227413

Browse files
committed
Addresses 4352
Add more colors to built-in color list. Addresses #4352.
1 parent c4ba81e commit b227413

File tree

1 file changed

+18
-6
lines changed

1 file changed

+18
-6
lines changed

src/utils.py

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3235,6 +3235,21 @@ def getColorInfoList() -> list:
32353235
("GRAY97", 247, 247, 247),
32363236
("GRAY98", 250, 250, 250),
32373237
("GRAY99", 252, 252, 252),
3238+
("AQUA", 0, 255, 255)
3239+
("CRIMSON", 220, 20, 60)
3240+
("DARKGREY", 169, 169, 169)
3241+
("DARKSLATEGREY", 47, 79, 79)
3242+
("DIMGREY", 105, 105, 105)
3243+
("FUCHSIA", 255, 0, 255)
3244+
("GREY", 128, 128, 128)
3245+
("INDIGO", 75, 0, 130)
3246+
("LIGHTGREY", 211, 211, 211)
3247+
("LIGHTSLATEGREY", 119, 136, 153)
3248+
("LIME", 0, 255, 0)
3249+
("OLIVE", 128, 128, 0)
3250+
("SILVER", 192, 192, 192)
3251+
("SLATEGREY", 112, 128, 144)
3252+
("TEAL", 0, 128, 128)
32383253
("HONEYDEW", 240, 255, 240),
32393254
("HONEYDEW1", 240, 255, 240),
32403255
("HONEYDEW2", 224, 238, 224),
@@ -3543,12 +3558,9 @@ def getColor(name: str) -> tuple:
35433558
Returns:
35443559
a triple of floats in range 0 to 1. In case of name-not-found, "white" is returned.
35453560
"""
3546-
try:
3547-
c = getColorInfoList()[getColorList().index(name.upper())]
3548-
return (c[1] / 255.0, c[2] / 255.0, c[3] / 255.0)
3549-
except Exception:
3550-
pymupdf.exception_info()
3551-
return (1, 1, 1)
3561+
color_dict = getColorInfoDict()
3562+
c = color_dict.get(name, (255, 255, 255))
3563+
return (c[1] / 255.0, c[2] / 255.0, c[3] / 255.0)
35523564

35533565

35543566
def getColorHSV(name: str) -> tuple:

0 commit comments

Comments
 (0)