printed v0.0.3: a low-level API to generate self-contained PDF/SVG

Guillaume Piolat spam at smam.org
Fri Nov 2 12:38:36 UTC 2018


On Monday, 1 October 2018 at 09:34:34 UTC, Guillaume Piolat wrote:
> printed is a low-level API to generate self-contained PDF 
> 1.4/SVG 1.1 documents hopefully suitable for print.
>

Hello,

printed:htmlcolors is a sub-package for parsing HTML color 
(supporting a subset of CSS Color Module Level 4). @safe pure.

------ example.d ----------

import printed.htmlcolors;

parseHTMLColor("black");                      // all HTML named 
colors
parseHTMLColor("#fe85dc");                    // hex colors
parseHTMLColor("rgba(64, 255, 128, 0.24)");   // alpha
parseHTMLColor("rgb(9e-1, 50%, 128)");        // percentage, 
floating-point
parseHTMLColor("hsl(120deg, 25%, 75%)");      // hsv colors
parseHTMLColor("gray(0.5)");                  // gray colors
parseHTMLColor(" rgb ( 245 , 112 , 74 )  ");  // strips whitespace


----------------

Give a const(char)[], get a ubyte[4] back.

http://printed.dpldocs.info/printed.htmlcolors.parseHTMLColor.html


More information about the Digitalmars-d-announce mailing list