|
| | Color (const QColor &color) noexcept |
|
| Color (float r, float g, float b, float a=1.0f) noexcept |
| | Color (std::string_view hex) |
| | Construct a new Color object by parsing a hex color string.
|
|
Color & | operator= (const QColor &color) |
|
Color & | brighten (float val) |
| | Brightens the color by the given amount.
|
|
Color & | brighten_default () |
| | Brightens the color by the default amount.
|
|
Color & | darken (float val) |
| | Darkens the color by the given amount.
|
|
Color & | darken_default () |
| | Darkens the color by the default amount.
|
|
bool | is_same (const Color &other) const |
| | Returns whether the color is the same as another.
|
|
bool | is_bright () const |
| | Returns if the color is bright or not.
|
|
bool | is_very_bright () const |
| | Returns if the color is very bright or not.
|
|
bool | is_very_very_bright () const |
| | Returns if the color is very very bright or not.
|
|
bool | is_very_dark () const |
| | Returns if the color is very dark or not.
|
|
bool | is_very_very_dark () const |
| | Returns if the color is very very dark or not.
|
|
Color | get_opposite () const |
| | Gets the opposite color.
|
|
float | get_brightness () const |
| | Gets the brightness of the color.
|
|
float | get_darkness () const |
| | Gets the darkness of the color.
|
| Color | morph (const Color &other, float amt) const |
| | Morphs from this color to another, depending on the given amount.
|
|
Color | get_contrast_color () const |
| | Returns the contrasting color (variation of black or white) based on if the given color is dark enough or not.
|
|
QColor | to_qcolor () const |
| std::string | to_hex () const |
| | Converts the color to a hex string (RGB only).
|
|
| static Color | get_mid_color (const Color &c1, const Color &c2, const float transition=0.5f) |
| | Returns the color in-between two colors.
|
| static Color | get_arranger_object_color (const Color &color, bool is_hovered, bool is_selected, bool is_transient, bool is_muted) |
| | Gets the color the widget should be.
|
| static std::string | rgb_to_hex (float r, float g, float b) |
| | Converts RGB float values to a hex string.
|
| static Color | from_hex (std::string_view hex) |
| | Parses a hex color string using QColor.
|
|
|
bool | operator== (const Color &lhs, const Color &rhs) |
|
void | to_json (nlohmann::json &j, const Color &color) |
|
void | from_json (const nlohmann::json &j, Color &color) |
Definition at line 14 of file color.h.
◆ Color() [1/2]
| zrythm::utils::Color::Color |
( |
const QColor & | color | ) |
|
|
inlinenoexcept |
◆ Color() [2/2]
| zrythm::utils::Color::Color |
( |
std::string_view | hex | ) |
|
Construct a new Color object by parsing a hex color string.
- Parameters
-
| hex | Hex color string (e.g., "#ff5588" or "#ff5588cc") |
◆ from_hex()
| Color zrythm::utils::Color::from_hex |
( |
std::string_view | hex | ) |
|
|
static |
Parses a hex color string using QColor.
Supports QColor-compatible formats: #RGB, #RRGGBB Alpha defaults to 1.0.
- Parameters
-
| hex | Hex color string (e.g., "#ff5588") |
- Returns
- Color Parsed color
◆ get_arranger_object_color()
| Color zrythm::utils::Color::get_arranger_object_color |
( |
const Color & | color, |
|
|
bool | is_hovered, |
|
|
bool | is_selected, |
|
|
bool | is_transient, |
|
|
bool | is_muted ) |
|
static |
Gets the color the widget should be.
- Parameters
-
| color | The original color. |
| is_selected | Whether the widget is supposed to be selected or not. |
◆ get_mid_color()
| Color zrythm::utils::Color::get_mid_color |
( |
const Color & | c1, |
|
|
const Color & | c2, |
|
|
const float | transition = 0.5f ) |
|
static |
Returns the color in-between two colors.
- Parameters
-
| transition | How far to transition (0.5 for half). |
◆ morph()
| Color zrythm::utils::Color::morph |
( |
const Color & | other, |
|
|
float | amt ) const |
|
nodiscard |
Morphs from this color to another, depending on the given amount.
Eg, if amt is 0, the resulting color will be this color. If amt is 1, the resulting color will be other.
◆ rgb_to_hex()
| std::string zrythm::utils::Color::rgb_to_hex |
( |
float | r, |
|
|
float | g, |
|
|
float | b ) |
|
static |
Converts RGB float values to a hex string.
- Parameters
-
| r | Red (0.0-1.0) |
| g | Green (0.0-1.0) |
| b | Blue (0.0-1.0) |
- Returns
- std::string Hex color string (e.g., "#ff5588")
◆ to_hex()
| std::string zrythm::utils::Color::to_hex |
( |
| ) |
const |
Converts the color to a hex string (RGB only).
- Returns
- std::string Hex color string (e.g., "#ff5588")
◆ alpha_
| float zrythm::utils::Color::alpha_ = 1.0f |
◆ blue_
| float zrythm::utils::Color::blue_ = 0.f |
◆ DEFAULT_BRIGHTEN_VAL
| auto zrythm::utils::Color::DEFAULT_BRIGHTEN_VAL = 0.1f |
|
staticconstexpr |
◆ green_
| float zrythm::utils::Color::green_ = 0.f |
◆ red_
| float zrythm::utils::Color::red_ = 0.f |
The documentation for this class was generated from the following file: