Modify ↓
#10799 closed defect (fixed)
Workflow macro generates invalid colors
Reported by: | Peter Suter | Owned by: | Peter Suter |
---|---|---|---|
Priority: | normal | Milestone: | 1.0 |
Component: | ticket system | Version: | |
Severity: | minor | Keywords: | workflow macro |
Cc: | Branch: | ||
Release Notes: | |||
API Changes: | |||
Internal Changes: |
Description
When using the Workflow
macro with more than five actions, invalid colors can be generated.
For example the above graph causes Firefox to log a warning Expected color but found '#3abb'.
and use the same color twice.
The fix is simple:
-
trac/htdocs/js/workflow_graph.js
diff -r 144933abd515 trac/htdocs/js/workflow_graph.js
a b 172 172 }; 173 173 174 174 function hexColor(r, g, b) { 175 r eturn '#' +176 Math.floor(r).toString(16) +177 Math.floor(g).toString(16) +178 Math.floor(b).toString(16);175 r = (r < 16 ? '0' : '') + Math.floor(r).toString(16); 176 g = (g < 16 ? '0' : '') + Math.floor(g).toString(16); 177 b = (b < 16 ? '0' : '') + Math.floor(b).toString(16); 178 return String.concat('#', r, g, b); 179 179 } 180 180 181 181 function saturatedColor(r, g, b) {
Attachments (0)
Change History (8)
comment:1 by , 12 years ago
comment:2 by , 12 years ago
Milestone: | next-stable-1.0.x → 1.0 |
---|---|
Resolution: | → fixed |
Status: | new → closed |
OK, applied in [11196].
comment:3 by , 12 years ago
Owner: | set to |
---|
comment:4 by , 12 years ago
Resolution: | fixed |
---|---|
Status: | closed → reopened |
Oops…
TypeError: Object function String() { [native code] } has no method 'concat' workflow_graph.js:178
comment:5 by , 12 years ago
- return String.concat('#', r, g, b); + return '#'.concat(r, g, b);
Works in Chrome at least.
comment:6 by , 12 years ago
Oops indeed! I'm not sure why I even switched away from +
. (Apparently it's faster too.) Backed that out in [11199].
Thanks for noticing!
comment:7 by , 12 years ago
Resolution: | → fixed |
---|---|
Status: | reopened → closed |
Hopefully that settles that. :)
comment:8 by , 12 years ago
Severity: | normal → minor |
---|
Note:
See TracTickets
for help on using tickets.
If you have the fix already, feel free to apply it to 1.0dev.