Returns a generator that mixes provided quantities forever trans: a function to convert the three arguments into a color. lambda x,y,z:(x,y,z) by default
(*lstcol, # type: Any
**kargs # type: Any
)
| 1112 | |
| 1113 | |
| 1114 | def colgen(*lstcol, # type: Any |
| 1115 | **kargs # type: Any |
| 1116 | ): |
| 1117 | # type: (...) -> Iterator[Any] |
| 1118 | """Returns a generator that mixes provided quantities forever |
| 1119 | trans: a function to convert the three arguments into a color. lambda x,y,z:(x,y,z) by default""" # noqa: E501 |
| 1120 | if len(lstcol) < 2: |
| 1121 | lstcol *= 2 |
| 1122 | trans = kargs.get("trans", lambda x, y, z: (x, y, z)) |
| 1123 | while True: |
| 1124 | for i in range(len(lstcol)): |
| 1125 | for j in range(len(lstcol)): |
| 1126 | for k in range(len(lstcol)): |
| 1127 | if i != j or j != k or k != i: |
| 1128 | yield trans(lstcol[(i + j) % len(lstcol)], lstcol[(j + k) % len(lstcol)], lstcol[(k + i) % len(lstcol)]) # noqa: E501 |
| 1129 | |
| 1130 | |
| 1131 | def incremental_label(label="tag%05i", start=0): |
no test coverage detected