opynsim
Unofficial C++ Documentation
Loading...
Searching...
No Matches
color.h
Go to the documentation of this file.
1#pragma once
2
4
5#include <optional>
6#include <string>
7#include <string_view>
8
9namespace osc
10{
12
13 // returns the linearized version of a sRGB component value
15
16 // returns the sRGB version of a linearized component value
18
19 // returns the linear version of a (presumed to be) sRGB color
21
22 // returns a color that is the (presumed to be) linear color with the sRGB gamma curve applied
24
25 // returns the color as a hexadecimal string in the format "#rrggbbaa", as
26 // commonly-used in web applications, configuration files, etc.
27 //
28 // - HDR values are clamped to LDR (they can't fit in this format)
29 // - examples:
30 // - red --> "#ff0000ff"
31 // - green --> "#00ff00ff"
32 // - blue --> "#0000ffff"
33 // - black --> "#000000ff"
34 // - clear --> "#00000000"
35 // - etc.
36 std::string to_html_string_rgba(const Color&);
37 std::optional<Color> try_parse_html_color_string(std::string_view);
38
39 // returns a color that is the result of converting `color` to HSLA multiplying
40 // its luminance (L) by `factor`, and converting it back to RGBA
41 Color multiply_luminance(const Color& color, float factor);
42}
Definition custom_decoration_generator.h:5
Color multiply_luminance(const Color &color, float factor)
float to_linear_colorspace(float srgb_component_value)
constexpr U to(T &&value)
Definition conversion.h:56
std::optional< Color > try_parse_html_color_string(std::string_view)
float to_srgb_colorspace(float linear_component_value)
std::string to_html_string_rgba(const Color &)