Changeset View
Changeset View
Standalone View
Standalone View
src/colorutils.cpp
1 | /* | 1 | /* | ||
---|---|---|---|---|---|
2 | * SPDX-FileCopyrightText: 2020 Carson Black <uhhadd@gmail.com> | 2 | * SPDX-FileCopyrightText: 2020 Carson Black <uhhadd@gmail.com> | ||
3 | * | 3 | * | ||
4 | * SPDX-License-Identifier: LGPL-2.0-or-later | 4 | * SPDX-License-Identifier: LGPL-2.0-or-later | ||
5 | */ | 5 | */ | ||
6 | 6 | | |||
7 | #include "colorutils.h" | 7 | #include "colorutils.h" | ||
8 | 8 | | |||
9 | #include <QIcon> | 9 | #include <QIcon> | ||
10 | #include <QtMath> | 10 | #include <QtMath> | ||
11 | #include <QtConcurrent> | | |||
12 | #include <cmath> | 11 | #include <cmath> | ||
13 | #include <map> | 12 | #include <map> | ||
14 | 13 | | |||
15 | ColorUtils::ColorUtils(QObject *parent) : QObject(parent) {} | 14 | ColorUtils::ColorUtils(QObject *parent) : QObject(parent) {} | ||
16 | 15 | | |||
17 | ColorUtils::Brightness ColorUtils::brightnessForColor(QColor color) { | 16 | ColorUtils::Brightness ColorUtils::brightnessForColor(QColor color) { | ||
18 | auto luma = [](QColor color) { | 17 | auto luma = [](QColor color) { | ||
19 | return (0.299*color.red() + 0.587*color.green() + 0.114*color.blue())/255; | 18 | return (0.299*color.red() + 0.587*color.green() + 0.114*color.blue())/255; | ||
▲ Show 20 Lines • Show All 193 Lines • Show Last 20 Lines |