From 0b315f7855207f702c155cbdf777b6fd39cf7225 Mon Sep 17 00:00:00 2001 From: Michael Miller Date: Mon, 4 Jul 2016 13:30:49 -0700 Subject: [PATCH] Updated HtmlColor object API (markdown) --- HtmlColor-object-API.md | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/HtmlColor-object-API.md b/HtmlColor-object-API.md index 8c35b30..d014324 100644 --- a/HtmlColor-object-API.md +++ b/HtmlColor-object-API.md @@ -33,30 +33,37 @@ c11 - lower right quadrant color x - unit value (0.0 - 1.0) that defines the blend progress in horizontal space y - unit value (0.0 - 1.0) that defines the blend progress in vertical space -### size_t Parse(const char* name, size_t nameSize); +### template \ size_t Parse(const char* name, size_t nameSize); This will parse the given string and set the color based on the value. The string is expected to be in a HTML4/CSS3 supported format. + +T_HTMLCOLORNAMES - a HtmlColorName object (either HtmlColorNames or HtmlShortColorNames) that defines the collection of color names to use. HtmlColorNames will consume more program space as it contains the full set of standard names. name - the string to parse, ending at either null terminated, non-alphanumeric delimited, or nameSize count. nameSize - the size of the name buffer, max number of chars to parse. returns - the count of chars parsed (excludes null terminator). Add this to name to get the next char after the parsed value. -**NOTE:** - by default a short list of standard names are used to conserve flash memory. If the full CSS3 set is required, currently you will be required to find and edit the "HtmlColor.h" file, uncomment the following line +example: ``` -// #define USE_CSS3_COLORS 1 + HtmlColor color; + uint8_t result = color.Parse(buf, bufSize); ``` -### size_t Parse(const char* name); +### template \ size_t Parse(const char* name); Alternative to Parse above, the string MUST be null terminated. -### size_t Parse(String const &name); +### template \ size_t Parse(String const &name); Alternative to Parse above, takes a standard String object instead. -### size_t ToString(char* buf, size_t bufSize) const; +### template \ size_t ToString(char* buf, size_t bufSize) const; This will convert the color value to a standard HTML/CSS3 color string. If a standard friendly name is available it will use it; otherwise it will provide a numerical "#hhhhhh" formatted string. + +T_HTMLCOLORNAMES - a HtmlColorName object (either HtmlColorNames or HtmlShortColorNames) that defines the collection of color names to use. HtmlColorNames will consume more program space as it contains the full set of standard names. buf - the buffer to write the string into. bufSize - the size of the buf, room must be provided for a null terminator. returns - the number of chars written into the buffer. -**NOTE:** - by default a short list of standard names are used to conserve flash memory. If the full CSS3 set is required, currently you will be required to find and edit the "HtmlColor.h" file, uncomment the following line + +example: ``` -// #define USE_CSS3_COLORS 1 + HtmlColor color; + color.ToString(buf, bufSize); ``` ### size_t ToNumericalString(char* buf, size_t bufSize) const;