|Author||Julien Vanier email@example.com|
|All Versions||1.0.3, 1.0.2, 1.0.1|
Convert color values between RGB and HSV
Device OS Version:
This table is generated from an automated build. Success only indicates that the code compiled successfully.
This content is provided by the library maintainer and has not been validated or approved.
A Particle library to convert color values between red green blue (RGB) and hue saturation value (HSV).
Add the hsv library to your project and follow this simple example:
#include "hsv.h" HsvColor hsv(hue, 255, 255); RgbColor rgb = HsvToRgb(hsv);
Flash a full example that animates the RGB LED in a rainbow pattern.
particle flash <my_device> examples/rainbow
See the examples folder for more details.
Structure with red, green, blue colors.
// Create black RgbColor rgb; // Create with color RgbColor rgb(255, 255, 0); // Extract colors RGB.color(rgb.r, rgb.g, rgb.b);
Structure with hue, saturation, value colors.
// Create black HsvColor hsv; // Create with color HsvColor hsv(255, 255, 0); // Extract colors unsigned char hue = hsv.h; unsigned char saturation = hsv.s; unsigned char value = hsv.v;
Convert between the 2 color types.
HsvColor hsv = RgbToHsv(rgb); RgbColor rgb = HsvToRgb(hsv);
Here's how you can make changes to this library and eventually contribute those changes back.
To get started, clone the library from GitHub to your local machine.
Change the name of the library in
library.properties to something different. You can add your name at then end.
Modify the sources in
After your changes are done you can upload them with
particle library upload or
Upload command in the IDE. This will create a private (only visible by you) library that you can use in other projects. Do
particle library add hsv_myname to add the library to a project on your machine or add the hsv_myname library to a project on the Web IDE or Desktop IDE.
At this point, you can create a GitHub pull request with your changes to the original library.
If you wish to make your library public, use
particle library publish or
Copyright 2016 Julien Vanier firstname.lastname@example.org
Licensed under the MIT license