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
27bool isEqual(NVGcolor a, NVGcolor b);
29NVGcolor clamp(NVGcolor a);
31NVGcolor minus(NVGcolor a, NVGcolor b);
33NVGcolor plus(NVGcolor a, NVGcolor b);
35NVGcolor mult(NVGcolor a, NVGcolor b);
36NVGcolor mult(NVGcolor a, float x);
38NVGcolor lerp(NVGcolor a, NVGcolor b, float t);
40NVGcolor screen(NVGcolor a, NVGcolor b);
42NVGcolor alpha(NVGcolor a, float alpha);
46NVGcolor fromHexString(std::string s);
47std::string toHexString(NVGcolor c);
48
49
50} // namespace color
51} // namespace rack
NVGcolor clamp(NVGcolor a)
Limits color components between 0 and 1.
NVGcolor mult(NVGcolor a, NVGcolor b)
Multiplies color components elementwise.
static const NVGcolor BLACK
Definition color.hpp:17
bool isEqual(NVGcolor a, NVGcolor b)
static const NVGcolor BLUE
Definition color.hpp:20
NVGcolor screen(NVGcolor a, NVGcolor b)
Screen blending with alpha compositing.
std::string toHexString(NVGcolor c)
NVGcolor minus(NVGcolor a, NVGcolor b)
Subtracts 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 color components elementwise.
static const NVGcolor RED
Definition color.hpp:18
NVGcolor alpha(NVGcolor a, float alpha)
Multiplies alpha value.
NVGcolor fromHexString(std::string s)
Converts from color hex string of the form "#RRGGBB" or "#RRGGBBAA".
NVGcolor lerp(NVGcolor a, NVGcolor b, float t)
Interpolates RGBA color values.
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