diff options
Diffstat (limited to 'Master/texmf-dist/asymptote/plain_pens.asy')
-rw-r--r-- | Master/texmf-dist/asymptote/plain_pens.asy | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/Master/texmf-dist/asymptote/plain_pens.asy b/Master/texmf-dist/asymptote/plain_pens.asy index 627ce2e8c84..22cf5ca4817 100644 --- a/Master/texmf-dist/asymptote/plain_pens.asy +++ b/Master/texmf-dist/asymptote/plain_pens.asy @@ -324,10 +324,16 @@ pen rgba(real[] a) // Return a pen corresponding to a given 6-character RGB hexidecimal string. pen rgb(string s) { - real value(string s, int i) {return hex(substr(s,2i,2))/255;} + int offset=substr(s,0,1) == '#' ? 1 : 0; + real value(string s, int i) {return hex(substr(s,2i+offset,2))/255;} return rgb(value(s,0),value(s,1),value(s,2)); } +pen RGB(int r, int g, int b) +{ + return rgb(r/255,g/255,b/255); +} + pen[] operator +(pen[] a, pen b) { return sequence(new pen(int i) {return a[i]+b;},a.length); |