diff options
author | Context Git Mirror Bot <phg42.2a@gmail.com> | 2016-03-31 10:13:17 +0200 |
---|---|---|
committer | Context Git Mirror Bot <phg42.2a@gmail.com> | 2016-03-31 10:13:17 +0200 |
commit | e819b543f65c17964c36a2371f152b3c5f55d28a (patch) | |
tree | 14b05d0cc09ff0023832aa3723934cb36162e9e9 /metapost | |
parent | ed2c824995ef51ddb1dfc1fa2a526933cd377cda (diff) | |
download | context-e819b543f65c17964c36a2371f152b3c5f55d28a.tar.gz |
2016-03-31 09:10:00
Diffstat (limited to 'metapost')
-rw-r--r-- | metapost/context/base/mpiv/mp-tool.mpiv | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/metapost/context/base/mpiv/mp-tool.mpiv b/metapost/context/base/mpiv/mp-tool.mpiv index 306b40f0a..05f9d9edc 100644 --- a/metapost/context/base/mpiv/mp-tool.mpiv +++ b/metapost/context/base/mpiv/mp-tool.mpiv @@ -1702,6 +1702,22 @@ enddef ; let greyed = grayed ; +vardef hsvtorgb(expr h,s,v) = + save H, S, V, x ; + H = h mod 360 ; + S = if s < 0 : 0 elseif s > 1 : 1 else: s fi ; + V = if v < 0 : 0 elseif v > 1 : 1 else: v fi ; + x = 1 - abs(H mod 120 - 60)/60 ; + V * ( (1-S) * (1,1,1) + S * + if H < 60 : (1,x,0) + elseif H < 120 : (x,1,0) + elseif H < 180 : (0,1,x) + elseif H < 240 : (0,x,1) + elseif H < 300 : (x,0,1) + else : (1,0,x) + fi ) +enddef ; + % yes or no: "text" infont "cmr12" at 24pt ; % let normalinfont = infont ; |