VCV Rack API v2
Loading...
Searching...
No Matches
color.hpp
Go to the documentation of this file.
1#pragma once
2#include <nanovg.h>
3
4#include <common.hpp>
5#include <string.hpp>
6
7
8namespace rack {
10namespace color {
11
12
13static const NVGcolor BLACK_TRANSPARENT = nvgRGBA(0x00, 0x00, 0x00, 0x00);
14static const NVGcolor WHITE_TRANSPARENT = nvgRGBA(0xff, 0xff, 0xff, 0x00);
15
16// All corners of the RGB cube and nothing else
17static const NVGcolor BLACK = nvgRGB(0x00, 0x00, 0x00);
18static const NVGcolor RED = nvgRGB(0xff, 0x00, 0x00);
19static const NVGcolor GREEN = nvgRGB(0x00, 0xff, 0x00);
20static const NVGcolor BLUE = nvgRGB(0x00, 0x00, 0xff);
21static const NVGcolor CYAN = nvgRGB(0x00, 0xff, 0xff);
22static const NVGcolor MAGENTA = nvgRGB(0xff, 0x00, 0xff);
23static const NVGcolor YELLOW = nvgRGB(0xff, 0xff, 0x00);
24static const NVGcolor WHITE = nvgRGB(0xff, 0xff, 0xff);
25
26
28bool isEqual(NVGcolor a, NVGcolor b);
30NVGcolor clamp(NVGcolor a);
34NVGcolor minus(NVGcolor a, NVGcolor b);
38NVGcolor plus(NVGcolor a, NVGcolor b);
42NVGcolor mult(NVGcolor a, NVGcolor b);
46NVGcolor mult(NVGcolor a, float x);
48NVGcolor lerp(NVGcolor a, NVGcolor b, float t);
52NVGcolor screen(NVGcolor a, NVGcolor b);
56NVGcolor alpha(NVGcolor a, float alpha);
61NVGcolor fromHexString(std::string s);
65std::string toHexString(NVGcolor c);
66
67
68} // namespace color
69} // namespace rack
NVGcolor clamp(NVGcolor a)
Limits RGBA color components between 0 and 1.
NVGcolor mult(NVGcolor a, NVGcolor b)
Multiplies RGB color components elementwise.
static const NVGcolor BLACK
Definition color.hpp:17
bool isEqual(NVGcolor a, NVGcolor b)
Returns whether all RGBA color components are equal.
static const NVGcolor BLUE
Definition color.hpp:20
NVGcolor screen(NVGcolor a, NVGcolor b)
Screen blending with alpha compositing.
std::string toHexString(NVGcolor c)
Converts color to hex string of the form "#RRGGBB" if opaque or "#RRGGBBAA" if alpha < 255.
NVGcolor minus(NVGcolor a, NVGcolor b)
Subtracts RGB color components elementwise.
static const NVGcolor YELLOW
Definition color.hpp:23
static const NVGcolor MAGENTA
Definition color.hpp:22
static const NVGcolor BLACK_TRANSPARENT
Definition color.hpp:13
static const NVGcolor WHITE
Definition color.hpp:24
NVGcolor plus(NVGcolor a, NVGcolor b)
Adds RGB color components elementwise.
static const NVGcolor RED
Definition color.hpp:18
NVGcolor alpha(NVGcolor a, float alpha)
Multiplies alpha value by a scalar.
NVGcolor fromHexString(std::string s)
Converts from hex string of the form "#RRGGBB" or "#RRGGBBAA".
NVGcolor lerp(NVGcolor a, NVGcolor b, float t)
Interpolates RGBA color components.
static const NVGcolor WHITE_TRANSPARENT
Definition color.hpp:14
static const NVGcolor CYAN
Definition color.hpp:21
static const NVGcolor GREEN
Definition color.hpp:19
Root namespace for the Rack API.
Definition AudioDisplay.hpp:9