Created
February 13, 2026 10:04
-
-
Save santhoshtr/1c6170a51bd27a778118446783f8fac6 to your computer and use it in GitHub Desktop.
Color - hex color code usage #metapost-sandbox
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| vardef hexrgb(expr Spec) = | |
| save r, g, b; | |
| numeric r, g, b; | |
| r = hex substring (1,3) of Spec; | |
| g = hex substring (3,5) of Spec; | |
| b = hex substring (5,7) of Spec; | |
| 1/256(r,g,b) | |
| enddef; | |
| beginfig(0); | |
| width:=100; | |
| rotation:=45; | |
| pen calligraphicpen ; | |
| calligraphicpen := makepen ((0, 0)--(width,0 ) rotated rotation) ; | |
| z0 = (x1+150, 0); | |
| z1 = (0, y0+250); | |
| z2 = (x1+250, y1+250); | |
| z3 = (x2+250, y1); | |
| z4 = (x2, y0); | |
| pickup calligraphicpen; | |
| draw z0..z1..z2..z3..z4 withcolor hexrgb("#0ca678"); | |
| endfig; | |
| end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment