Phosphor
Qt6 / Wayland library suite for window-management tools
Loading...
Searching...
No Matches
ColorTemperature.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: 2026 fuddlesworth
2// SPDX-License-Identifier: LGPL-2.1-or-later
3
4#pragma once
5
6#include <PhosphorServiceNightLight/phosphorservicenightlight_export.h>
7
8#include <QByteArray>
9#include <QtGlobal>
10
12
15
17inline constexpr int Minimum = 1000;
19inline constexpr int Maximum = 10000;
21inline constexpr int Neutral = 6500;
22
24[[nodiscard]] constexpr int bound(int kelvin)
25{
26 return qBound(Minimum, kelvin, Maximum);
27}
28
29} // namespace ColorTemperature
30
40{
41 double red = 1.0;
42 double green = 1.0;
43 double blue = 1.0;
44
45 bool operator==(const WhitePoint&) const = default;
46};
47
61[[nodiscard]] PHOSPHORSERVICENIGHTLIGHT_EXPORT WhitePoint whitePoint(int kelvin);
62
71[[nodiscard]] PHOSPHORSERVICENIGHTLIGHT_EXPORT QByteArray gammaTable(const WhitePoint& white, quint32 size);
72
73} // namespace PhosphorServiceNightLight
The colour temperatures the library works in, in kelvin.
Definition ColorTemperature.h:14
constexpr int Neutral
The temperature that leaves the screen unchanged (an identity ramp).
Definition ColorTemperature.h:21
constexpr int bound(int kelvin)
Clamp kelvin to [Minimum, Maximum].
Definition ColorTemperature.h:24
constexpr int Maximum
The coolest temperature the library sets.
Definition ColorTemperature.h:19
constexpr int Minimum
The warmest temperature the library sets.
Definition ColorTemperature.h:17
Definition ColorTemperature.h:11
PHOSPHORSERVICENIGHTLIGHT_EXPORT QByteArray gammaTable(const WhitePoint &white, quint32 size)
A wlr-gamma-control table for white with size entries per channel.
PHOSPHORSERVICENIGHTLIGHT_EXPORT WhitePoint whitePoint(int kelvin)
The white point of a black body at kelvin, relative to 6500 K.
The colour of white at a temperature, as per-channel factors.
Definition ColorTemperature.h:40
double blue
Definition ColorTemperature.h:43
bool operator==(const WhitePoint &) const =default
double red
Definition ColorTemperature.h:41
double green
Definition ColorTemperature.h:42