Updated HtmlColor object API (markdown)

Michael Miller
2016-07-03 18:29:19 -07:00
parent bd4438bdc0
commit 99c2a8c841

@@ -33,3 +33,34 @@ 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);
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.
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
```
// #define USE_CSS3_COLORS 1
```
### size_t Parse(const char* name);
Alternative to Parse above, the string MUST be null terminated.
### 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;
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.
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
```
// #define USE_CSS3_COLORS 1
```
### size_t ToNumericalString(char* buf, size_t bufSize) const;
This will convert the color value to a standard HTML/CSS3 color string. It will always provide a numerical "#hhhhhh" formatted string.
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.