3
3
#include < cmath>
4
4
5
5
COLORREF g_dwAccent;
6
- int g_hslAccentH;
7
- double g_hslAccentS;
8
- double g_oldhslAccentS;
6
+ //
7
+ hsl_t g_hslAccent;
8
+ hsl_t g_hslDefaultAccent;
9
+ //
9
10
double g_balance1hslAccentS;
10
11
double g_balance2hslAccentS;
11
- double g_hslAccentL;
12
+ //
12
13
double g_oldhslAccentL;
13
- double g_defaulthslAccentH;
14
- double g_defaulthslAccentS;
15
- double g_defaulthslAccentL;
14
+ double g_oldhslAccentS;
16
15
17
16
bool UpdateAccentColor ()
18
17
{
@@ -29,24 +28,24 @@ bool UpdateAccentColor()
29
28
}
30
29
31
30
if (accentColorChanges >= 1 ) {
32
- g_oldhslAccentS = g_hslAccentS ;
31
+ g_oldhslAccentS = g_hslAccent. s ;
33
32
if (g_oldhslAccentS <= 0.0666 ) {
34
33
g_oldhslAccentS = 0.0666 ;
35
34
}
36
35
}
37
36
else g_oldhslAccentS = 1 ;
38
37
39
38
if (accentColorChanges >= 1 ) {
40
- g_oldhslAccentL = g_hslAccentL ;
39
+ g_oldhslAccentL = g_hslAccent. l ;
41
40
}
42
41
else g_oldhslAccentL = 0 ;
43
42
44
43
g_dwAccent = dwAccent;
45
44
if ((double )GetRValue (dwAccent) == (double )GetGValue (dwAccent) && (double )GetGValue (dwAccent) == (double )GetBValue (dwAccent)) {
46
- g_hslAccentH = 210.0 ;
45
+ g_hslAccent. h = 210.0 ;
47
46
}
48
47
else {
49
- g_hslAccentH = rgb2hsl ({
48
+ g_hslAccent. h = rgb2hsl ({
50
49
(double )GetRValue (dwAccent) / 255 ,
51
50
(double )GetGValue (dwAccent) / 255 ,
52
51
(double )GetBValue (dwAccent) / 255 }).h ;
@@ -61,36 +60,36 @@ bool UpdateAccentColor()
61
60
62
61
g_dwAccent = dwAccent;
63
62
if ((double )GetRValue (dwAccent) == (double )GetGValue (dwAccent) && (double )GetGValue (dwAccent) == (double )GetBValue (dwAccent)) {
64
- g_hslAccentS = 0.0667 ;
63
+ g_hslAccent. s = 0.0667 ;
65
64
}
66
65
else {
67
- g_hslAccentS = pow (double (rgb2hsl ({
66
+ g_hslAccent. s = pow (double (rgb2hsl ({
68
67
(double )GetRValue (dwAccent) / 254.999999999 ,
69
68
(double )GetGValue (dwAccent) / 254.999999999 ,
70
69
(double )GetBValue (dwAccent) / 254.999999999 }).s ), double (0.85 ));
71
70
}
72
71
73
72
74
- g_balance1hslAccentS = g_hslAccentS ;
75
- g_balance2hslAccentS = (1 - g_hslAccentS );
73
+ g_balance1hslAccentS = g_hslAccent. s ;
74
+ g_balance2hslAccentS = (1 - g_hslAccent. s );
76
75
77
- g_defaulthslAccentH = 207 ;
78
- g_defaulthslAccentS = 1 ;
79
- g_defaulthslAccentL = (double )(rgb2hsl ({
76
+ g_hslDefaultAccent. h = 207 ;
77
+ g_hslDefaultAccent. s = 1 ;
78
+ g_hslDefaultAccent. l = (double )(rgb2hsl ({
80
79
(double )0 / 254.999999999 ,
81
80
(double )120 / 254.999999999 ,
82
81
(double )215 / 254.999999999 }).l );
83
82
84
- if (g_hslAccentS < 0.0666 ) {
85
- g_hslAccentS = 0.0666 ;
83
+ if (g_hslAccent. s < 0.0666 ) {
84
+ g_hslAccent. s = 0.0666 ;
86
85
}
87
86
if (accentColorChanges >= 1 ) {
88
- if (g_hslAccentS > 1 ) {
89
- g_hslAccentS = g_balance1hslAccentS + g_balance2hslAccentS;
87
+ if (g_hslAccent. s > 1 ) {
88
+ g_hslAccent. s = g_balance1hslAccentS + g_balance2hslAccentS;
90
89
}
91
90
}
92
91
93
- g_hslAccentL = ((double )(rgb2hsl ({
92
+ g_hslAccent. l = ((double )(rgb2hsl ({
94
93
(double )GetRValue (dwAccent) / 254.999999999 ,
95
94
(double )GetGValue (dwAccent) / 254.999999999 ,
96
95
(double )GetBValue (dwAccent) / 254.999999999 }).l ) -
0 commit comments