6#include "utils/serialization.h"
10#include <boost/describe.hpp>
18 static constexpr auto DEFAULT_BRIGHTEN_VAL = 0.1f;
20 Color ()
noexcept =
default;
21 Color (
const QColor &color)
noexcept { *
this = color; }
22 Color (
float r,
float g,
float b,
float a = 1.0f)
noexcept;
31 Color &operator= (
const QColor &color);
56 [[nodiscard]]
bool is_same (
const Color &other)
const;
105 [[nodiscard]] Color
morph (
const Color &other,
float amt)
const;
113 get_mid_color (
const Color &c1,
const Color &c2,
const float transition = 0.5f);
121 QColor to_qcolor ()
const;
143 static std::string rgb_to_hex (
float r,
float g,
float b);
145 friend bool operator== (
const Color &lhs,
const Color &rhs);
float get_brightness() const
Gets the brightness of the color.
Color & darken_default()
Darkens the color by the default amount.
static Color get_mid_color(const Color &c1, const Color &c2, const float transition=0.5f)
Returns the color in-between two colors.
bool is_bright() const
Returns if the color is bright or not.
float get_darkness() const
Gets the darkness of the color.
Color get_contrast_color() const
Returns the contrasting color (variation of black or white) based on if the given color is dark enoug...
Color & darken(float val)
Darkens the color by the given amount.
bool is_very_bright() const
Returns if the color is very bright or not.
Color get_opposite() const
Gets the opposite color.
Color & brighten(float val)
Brightens the color by the given amount.
Color morph(const Color &other, float amt) const
Morphs from this color to another, depending on the given amount.
Color(const std::string &str)
Construct a new Color object by parsing the color string.
bool is_same(const Color &other) const
Returns whether the color is the same as another.
std::string to_hex() const
Converts the color to a hex string.
bool is_very_very_dark() const
Returns if the color is very very dark or not.
Color & brighten_default()
Brightens the color by the default amount.
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.
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.