#include "Colors.h" #include Colors *Colors::instance() { static Colors *self = nullptr; if (self == nullptr) { self = new Colors(); } return self; } Colors *Colors::create(QQmlEngine *, QJSEngine *) { auto ret = instance(); QJSEngine::setObjectOwnership(ret, QJSEngine::CppOwnership); return ret; } Colors::Colors(QObject *parent) : QObject{parent} { m_Transparent = QColor(0, 0, 0, 0); m_Black = QColor(0, 0, 0); m_White = QColor(255, 255, 255); m_Grey10 = QColor(250, 249, 248); m_Grey20 = QColor(243, 242, 241); m_Grey30 = QColor(237, 235, 233); m_Grey40 = QColor(225, 223, 221); m_Grey50 = QColor(210, 208, 206); m_Grey60 = QColor(200, 198, 196); m_Grey70 = QColor(190, 185, 184); m_Grey80 = QColor(179, 176, 173); m_Grey90 = QColor(161, 159, 157); m_Grey100 = QColor(151, 149, 146); m_Grey110 = QColor(138, 136, 134); m_Grey120 = QColor(121, 119, 117); m_Grey130 = QColor(96, 94, 92); m_Grey140 = QColor(72, 70, 68); m_Grey150 = QColor(59, 58, 57); m_Grey160 = QColor(50, 49, 48); m_Grey170 = QColor(41, 40, 39); m_Grey180 = QColor(37, 36, 35); m_Grey190 = QColor(32, 31, 30); m_Grey200 = QColor(27, 26, 25); m_Grey210 = QColor(22, 21, 20); m_Grey220 = QColor(17, 16, 15); auto yellow = new AccentColor(this); yellow->darkest(QColor(249, 168, 37)); yellow->darker(QColor(251, 192, 45)); yellow->dark(QColor(253, 212, 53)); yellow->normal(QColor(255, 235, 59)); yellow->light(QColor(255, 238, 88)); yellow->lighter(QColor(255, 241, 118)); yellow->lightest(QColor(255, 245, 155)); m_Yellow = yellow; auto orange = new AccentColor(this); orange->darkest(QColor(153, 61, 7)); orange->darker(QColor(172, 68, 8)); orange->dark(QColor(209, 88, 10)); orange->normal(QColor(247, 99, 12)); orange->light(QColor(248, 122, 48)); orange->lighter(QColor(249, 145, 84)); orange->lightest(QColor(250, 192, 106)); m_Orange = orange; auto red = new AccentColor(this); red->darkest(QColor(143, 10, 21)); red->darker(QColor(162, 11, 24)); red->dark(QColor(185, 13, 28)); red->normal(QColor(232, 17, 35)); red->light(QColor(236, 64, 79)); red->lighter(QColor(238, 88, 101)); red->lightest(QColor(240, 107, 118)); m_Red = red; auto magenta = new AccentColor(this); magenta->darkest(QColor(111, 0, 79)); magenta->darker(QColor(160, 7, 108)); magenta->dark(QColor(181, 13, 125)); magenta->normal(QColor(227, 0, 140)); magenta->light(QColor(234, 77, 168)); magenta->lighter(QColor(238, 110, 193)); magenta->lightest(QColor(241, 140, 213)); m_Magenta = magenta; auto purple = new AccentColor(this); purple->darkest(QColor(44, 15, 118)); purple->darker(QColor(61, 15, 153)); purple->dark(QColor(78, 17, 174)); purple->normal(QColor(104, 33, 122)); purple->light(QColor(123, 76, 157)); purple->lighter(QColor(141, 110, 189)); purple->lightest(QColor(158, 142, 217)); m_Purple = purple; auto blue = new AccentColor(this); blue->darkest(QColor(0, 74, 131)); blue->darker(QColor(0, 84, 148)); blue->dark(QColor(0, 102, 180)); blue->normal(QColor(0, 120, 212)); blue->light(QColor(38, 140, 220)); blue->lighter(QColor(76, 160, 224)); blue->lightest(QColor(96, 171, 228)); m_Blue = blue; auto teal = new AccentColor(this); teal->darkest(QColor(0, 110, 91)); teal->darker(QColor(0, 124, 103)); teal->dark(QColor(0, 151, 125)); teal->normal(QColor(0, 178, 148)); teal->light(QColor(38, 189, 164)); teal->lighter(QColor(77, 201, 180)); teal->lightest(QColor(96, 207, 188)); m_Teal = teal; auto green = new AccentColor(this); green->darkest(QColor(9, 76, 9)); green->darker(QColor(12, 93, 12)); green->dark(QColor(14, 111, 14)); green->normal(QColor(16, 124, 16)); green->light(QColor(39, 137, 57)); green->lighter(QColor(76, 156, 76)); green->lightest(QColor(106, 173, 106)); m_Green = green; } AccentColor *Colors::createAccentColor(const QColor &primaryColor) { auto accentColor = new AccentColor(this); accentColor->normal(primaryColor); accentColor->dark(Utilities::instance()->withOpacity(primaryColor, 0.9)); accentColor->light(Utilities::instance()->withOpacity(primaryColor, 0.9)); accentColor->darker(Utilities::instance()->withOpacity(accentColor->dark(), 0.8)); accentColor->lighter(Utilities::instance()->withOpacity(accentColor->light(), 0.8)); accentColor->darkest(Utilities::instance()->withOpacity(accentColor->darker(), 0.7)); accentColor->lightest(Utilities::instance()->withOpacity(accentColor->lighter(), 0.7)); return accentColor; }