@quenty/color3utils 6.0.0-canary.367.e9fdcbc.0 → 6.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md
CHANGED
|
@@ -3,7 +3,112 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
-
# [6.0.0
|
|
6
|
+
# [6.0.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/color3utils@5.30.0...@quenty/color3utils@6.0.0) (2023-10-11)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* Fix LuvColor3Utils lerping logic ([b3bb154](https://github.com/Quenty/NevermoreEngine/commit/b3bb154f507977726a117b8d366600b73f04cc52))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
# [5.30.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/color3utils@5.29.0...@quenty/color3utils@5.30.0) (2023-09-21)
|
|
18
|
+
|
|
19
|
+
**Note:** Version bump only for package @quenty/color3utils
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
# [5.29.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/color3utils@5.28.0...@quenty/color3utils@5.29.0) (2023-09-04)
|
|
26
|
+
|
|
27
|
+
**Note:** Version bump only for package @quenty/color3utils
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
# [5.28.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/color3utils@5.27.0...@quenty/color3utils@5.28.0) (2023-08-23)
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
### Features
|
|
37
|
+
|
|
38
|
+
* Add Color3Utils.toWebHexString(color3) ([e99602a](https://github.com/Quenty/NevermoreEngine/commit/e99602a9a30dfeb5008f6f75b36cbbfc9043ef51))
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
# [5.27.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/color3utils@5.26.0...@quenty/color3utils@5.27.0) (2023-08-01)
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
### Features
|
|
48
|
+
|
|
49
|
+
* Add Color3Utils.toHexInteger(color3) ([4c0884f](https://github.com/Quenty/NevermoreEngine/commit/4c0884f2fa2c76420789b9637f0337fa591d5403))
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
# [5.26.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/color3utils@5.25.0...@quenty/color3utils@5.26.0) (2023-07-28)
|
|
56
|
+
|
|
57
|
+
**Note:** Version bump only for package @quenty/color3utils
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
# [5.25.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/color3utils@5.24.0...@quenty/color3utils@5.25.0) (2023-07-25)
|
|
64
|
+
|
|
65
|
+
**Note:** Version bump only for package @quenty/color3utils
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
# [5.24.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/color3utils@5.23.0...@quenty/color3utils@5.24.0) (2023-07-23)
|
|
72
|
+
|
|
73
|
+
**Note:** Version bump only for package @quenty/color3utils
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
# [5.23.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/color3utils@5.22.1...@quenty/color3utils@5.23.0) (2023-07-15)
|
|
80
|
+
|
|
81
|
+
**Note:** Version bump only for package @quenty/color3utils
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
## [5.22.1](https://github.com/Quenty/NevermoreEngine/compare/@quenty/color3utils@5.22.0...@quenty/color3utils@5.22.1) (2023-07-11)
|
|
88
|
+
|
|
89
|
+
**Note:** Version bump only for package @quenty/color3utils
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
# [5.22.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/color3utils@5.21.0...@quenty/color3utils@5.22.0) (2023-07-10)
|
|
96
|
+
|
|
97
|
+
**Note:** Version bump only for package @quenty/color3utils
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
# [5.21.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/color3utils@5.20.0...@quenty/color3utils@5.21.0) (2023-06-17)
|
|
104
|
+
|
|
105
|
+
**Note:** Version bump only for package @quenty/color3utils
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
# [5.20.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/color3utils@5.19.0...@quenty/color3utils@5.20.0) (2023-06-05)
|
|
7
112
|
|
|
8
113
|
**Note:** Version bump only for package @quenty/color3utils
|
|
9
114
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quenty/color3utils",
|
|
3
|
-
"version": "6.0.0
|
|
3
|
+
"version": "6.0.0",
|
|
4
4
|
"description": "Utility methods for Roblox Color3 values",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Roblox",
|
|
@@ -28,11 +28,12 @@
|
|
|
28
28
|
"access": "public"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@quenty/blend": "7.0.0
|
|
32
|
-
"@quenty/loader": "
|
|
33
|
-
"@quenty/
|
|
34
|
-
"@quenty/
|
|
35
|
-
"@quenty/
|
|
31
|
+
"@quenty/blend": "^7.0.0",
|
|
32
|
+
"@quenty/loader": "^7.0.0",
|
|
33
|
+
"@quenty/maid": "^2.6.0",
|
|
34
|
+
"@quenty/math": "^2.5.0",
|
|
35
|
+
"@quenty/rx": "^8.0.0",
|
|
36
|
+
"@quenty/valueobject": "^8.0.0"
|
|
36
37
|
},
|
|
37
|
-
"gitHead": "
|
|
38
|
+
"gitHead": "fdeae46099587019ec5fc15317dc673aed379400"
|
|
38
39
|
}
|
|
@@ -115,4 +115,50 @@ function Color3Utils.areEqual(a, b, epsilon)
|
|
|
115
115
|
and math.abs(a.b - b.b) <= epsilon
|
|
116
116
|
end
|
|
117
117
|
|
|
118
|
+
--[=[
|
|
119
|
+
Converts the color3 to the actual hex integer used in web and other
|
|
120
|
+
areas.
|
|
121
|
+
|
|
122
|
+
@param color3 Color3
|
|
123
|
+
@return number
|
|
124
|
+
]=]
|
|
125
|
+
function Color3Utils.toHexInteger(color3)
|
|
126
|
+
assert(typeof(color3) == "Color3", "Bad color3")
|
|
127
|
+
|
|
128
|
+
return bit32.bor(bit32.lshift(color3.r*0xFF, 16), bit32.lshift(color3.g*0xFF, 8), color3.b*0xFF)
|
|
129
|
+
end
|
|
130
|
+
|
|
131
|
+
--[=[
|
|
132
|
+
Converts the color3 to the actual hex integer used in web and other
|
|
133
|
+
areas.
|
|
134
|
+
|
|
135
|
+
```
|
|
136
|
+
Color3Utils.toHexString(Color3.fromRGB(0, 255, 0)) --> 00FF00
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
@param color3 Color3
|
|
140
|
+
@return number
|
|
141
|
+
]=]
|
|
142
|
+
function Color3Utils.toHexString(color3)
|
|
143
|
+
assert(typeof(color3) == "Color3", "Bad color3")
|
|
144
|
+
|
|
145
|
+
return string.format("%06X", Color3Utils.toHexInteger(color3))
|
|
146
|
+
end
|
|
147
|
+
|
|
148
|
+
--[=[
|
|
149
|
+
Converts the color3 to the standard web hex string
|
|
150
|
+
|
|
151
|
+
```
|
|
152
|
+
Color3Utils.toWebHexString(Color3.fromRGB(0, 255, 0)) --> #00FF00
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
@param color3 Color3
|
|
156
|
+
@return number
|
|
157
|
+
]=]
|
|
158
|
+
function Color3Utils.toWebHexString(color3)
|
|
159
|
+
assert(typeof(color3) == "Color3", "Bad color3")
|
|
160
|
+
|
|
161
|
+
return string.format("#%06X", Color3Utils.toHexInteger(color3))
|
|
162
|
+
end
|
|
163
|
+
|
|
118
164
|
return Color3Utils
|
|
@@ -33,7 +33,8 @@ function LuvColor3Utils.lerp(color0, color1, t)
|
|
|
33
33
|
local l0, u0, v0 = unpack(LuvColor3Utils.fromColor3(color0))
|
|
34
34
|
local l1, u1, v1 = unpack(LuvColor3Utils.fromColor3(color1))
|
|
35
35
|
|
|
36
|
-
local
|
|
36
|
+
local shortest_angle = ((((l1 - l0) % 360) + 540) % 360) - 180
|
|
37
|
+
local l = l0 + shortest_angle*t
|
|
37
38
|
local u = Math.lerp(u0, u1, t)
|
|
38
39
|
local v = Math.lerp(v0, v1, t)
|
|
39
40
|
|
|
@@ -41,6 +42,16 @@ function LuvColor3Utils.lerp(color0, color1, t)
|
|
|
41
42
|
end
|
|
42
43
|
end
|
|
43
44
|
|
|
45
|
+
function LuvColor3Utils.desaturate(color0, proportion)
|
|
46
|
+
local l0, u0, v0 = unpack(LuvColor3Utils.fromColor3(color0))
|
|
47
|
+
return LuvColor3Utils.toColor3({l0, u0*math.clamp(1 - proportion, 0, 1), v0})
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
function LuvColor3Utils.darken(color0, proportion)
|
|
51
|
+
local l0, u0, v0 = unpack(LuvColor3Utils.fromColor3(color0))
|
|
52
|
+
return LuvColor3Utils.toColor3({l0, u0, v0*math.clamp(1 - proportion, 0, 1)})
|
|
53
|
+
end
|
|
54
|
+
|
|
44
55
|
--[=[
|
|
45
56
|
Converts from Color3 to LUV
|
|
46
57
|
@param color3 Color3
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
--[[
|
|
2
|
+
@class LuvColor3Utils.story
|
|
3
|
+
]]
|
|
4
|
+
|
|
5
|
+
local require = require(game:GetService("ServerScriptService"):FindFirstChild("LoaderUtils", true).Parent).load(script)
|
|
6
|
+
|
|
7
|
+
local Maid = require("Maid")
|
|
8
|
+
local LuvColor3Utils = require("LuvColor3Utils")
|
|
9
|
+
|
|
10
|
+
return function(target)
|
|
11
|
+
local maid = Maid.new()
|
|
12
|
+
|
|
13
|
+
local start = Color3.fromRGB(184, 127, 100)
|
|
14
|
+
local finish = Color3.fromRGB(16, 60, 76)
|
|
15
|
+
|
|
16
|
+
for i=0, 100 do
|
|
17
|
+
local frame = Instance.new("Frame")
|
|
18
|
+
frame.BackgroundColor3 = LuvColor3Utils.lerp(start, finish, i/100)
|
|
19
|
+
frame.Size = UDim2.fromScale(1/(100 + 1), 0.5)
|
|
20
|
+
frame.Position = UDim2.fromScale(i/(100 + 1), 0)
|
|
21
|
+
frame.BorderSizePixel = 0
|
|
22
|
+
frame.Parent = target
|
|
23
|
+
maid:GiveTask(frame)
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
for i=0, 100 do
|
|
27
|
+
local frame = Instance.new("Frame")
|
|
28
|
+
frame.BackgroundColor3 = start:Lerp(finish, i/100)
|
|
29
|
+
frame.Size = UDim2.fromScale(1/(100 + 1), 0.5)
|
|
30
|
+
frame.Position = UDim2.fromScale(i/(100 + 1), 0.5)
|
|
31
|
+
frame.BorderSizePixel = 0
|
|
32
|
+
frame.Parent = target
|
|
33
|
+
maid:GiveTask(frame)
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
return function()
|
|
37
|
+
maid:DoCleaning()
|
|
38
|
+
end
|
|
39
|
+
end
|