Skip to content

Commit 45e9c96

Browse files
authored
Merge pull request #530 from hx2A/fix528
Fix528
2 parents ecbb5a0 + 0c32aa8 commit 45e9c96

File tree

4 files changed

+24
-1
lines changed

4 files changed

+24
-1
lines changed

py5_resources/py5_module/py5/decorators.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,9 @@ def _hex_converter(arg):
8484
if mcolors is not None:
8585
return JInt(int("0xFF" + mcolors.to_hex(arg)[1:], base=16))
8686
except:
87-
return None
87+
raise RuntimeError(
88+
f"unknown color or unparsable color string '{arg}'"
89+
) from None
8890
elif isinstance(arg, (int, np.integer)) and 0x7FFFFFFF < arg <= 0xFFFFFFFF:
8991
return JInt(arg)
9092
elif colour is not None and isinstance(arg, colour.Color):

py5_resources/py5_module/py5_tools/colors/css4.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,10 @@
2222
mcolor_css4 = None # DELETE
2323

2424
{mcolor_css4}
25+
26+
27+
def __getattr__(name):
28+
if name in locals():
29+
return locals()[name]
30+
else:
31+
raise AttributeError("unknown css4 color '" + name + "'")

py5_resources/py5_module/py5_tools/colors/mpl_cmaps.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,10 @@
2222
mpl_cmaps = None # DELETE
2323

2424
{mpl_cmaps}
25+
26+
27+
def __getattr__(name):
28+
if name in locals():
29+
return locals()[name]
30+
else:
31+
raise AttributeError("unknown matplotlib colormap '" + name + "'")

py5_resources/py5_module/py5_tools/colors/xkcd.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,10 @@
2222
mcolor_xkcd = None # DELETE
2323

2424
{mcolor_xkcd}
25+
26+
27+
def __getattr__(name):
28+
if name in locals():
29+
return locals()[name]
30+
else:
31+
raise AttributeError("unknown xkcd color '" + name + "'")

0 commit comments

Comments
 (0)