@quenty/colorpalette 10.6.3-canary.500.0c613a3.0 → 10.7.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 +2 -5
- package/package.json +13 -14
- package/src/Shared/ColorPalette.lua +39 -46
- package/src/Shared/Font/FontPalette.lua +11 -18
package/CHANGELOG.md
CHANGED
|
@@ -3,12 +3,9 @@
|
|
|
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
|
+
# [10.7.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/colorpalette@10.6.2...@quenty/colorpalette@10.7.0) (2024-09-25)
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
### Bug Fixes
|
|
10
|
-
|
|
11
|
-
* Ensure backwards compatibility ([97995a8](https://github.com/Quenty/NevermoreEngine/commit/97995a812c8d1d8489104b16e7ac443fbb2effec))
|
|
8
|
+
**Note:** Version bump only for package @quenty/colorpalette
|
|
12
9
|
|
|
13
10
|
|
|
14
11
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quenty/colorpalette",
|
|
3
|
-
"version": "10.
|
|
3
|
+
"version": "10.7.0",
|
|
4
4
|
"description": "Color palette system for Roblox",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Roblox",
|
|
@@ -28,18 +28,17 @@
|
|
|
28
28
|
"access": "public"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@quenty/baseobject": "10.
|
|
32
|
-
"@quenty/blend": "12.
|
|
33
|
-
"@quenty/color3utils": "11.
|
|
34
|
-
"@quenty/colorpicker": "10.
|
|
35
|
-
"@quenty/loader": "10.
|
|
36
|
-
"@quenty/maid": "3.3.0",
|
|
37
|
-
"@quenty/math": "2.7.0",
|
|
38
|
-
"@quenty/
|
|
39
|
-
"@quenty/
|
|
40
|
-
"@quenty/
|
|
41
|
-
"@quenty/
|
|
42
|
-
"@quenty/valueobject": "13.5.1-canary.500.0c613a3.0"
|
|
31
|
+
"@quenty/baseobject": "^10.5.0",
|
|
32
|
+
"@quenty/blend": "^12.6.0",
|
|
33
|
+
"@quenty/color3utils": "^11.6.0",
|
|
34
|
+
"@quenty/colorpicker": "^10.7.0",
|
|
35
|
+
"@quenty/loader": "^10.5.0",
|
|
36
|
+
"@quenty/maid": "^3.3.0",
|
|
37
|
+
"@quenty/math": "^2.7.0",
|
|
38
|
+
"@quenty/rx": "^13.6.0",
|
|
39
|
+
"@quenty/signal": "^7.5.0",
|
|
40
|
+
"@quenty/table": "^3.5.0",
|
|
41
|
+
"@quenty/valueobject": "^13.6.0"
|
|
43
42
|
},
|
|
44
|
-
"gitHead": "
|
|
43
|
+
"gitHead": "41715b15e2b48b2d22ff4f5277a8d4b7a0d32ef3"
|
|
45
44
|
}
|
|
@@ -9,11 +9,13 @@ local ValueObject = require("ValueObject")
|
|
|
9
9
|
local ColorSwatch = require("ColorSwatch")
|
|
10
10
|
local ColorGradePalette = require("ColorGradePalette")
|
|
11
11
|
local Rx = require("Rx")
|
|
12
|
+
local Maid = require("Maid")
|
|
12
13
|
local Blend = require("Blend")
|
|
13
14
|
local Observable = require("Observable")
|
|
15
|
+
local Signal = require("Signal")
|
|
16
|
+
local Table = require("Table")
|
|
14
17
|
local ColorGradeUtils = require("ColorGradeUtils")
|
|
15
18
|
local LuvColor3Utils = require("LuvColor3Utils")
|
|
16
|
-
local ObservableMap = require("ObservableMap")
|
|
17
19
|
|
|
18
20
|
local ColorPalette = setmetatable({}, BaseObject)
|
|
19
21
|
ColorPalette.ClassName = "ColorPalette"
|
|
@@ -23,20 +25,23 @@ function ColorPalette.new()
|
|
|
23
25
|
local self = setmetatable(BaseObject.new(), ColorPalette)
|
|
24
26
|
|
|
25
27
|
self._gradePalette = self._maid:Add(ColorGradePalette.new())
|
|
28
|
+
self._gradeMaid = self._maid:Add(Maid.new())
|
|
29
|
+
self._colorMaid = self._maid:Add(Maid.new())
|
|
30
|
+
self._vividMaid = self._maid:Add(Maid.new())
|
|
26
31
|
|
|
27
|
-
self.
|
|
28
|
-
self._colorGradeMap = self._maid:Add(ObservableMap.new())
|
|
32
|
+
self._swatches = {}
|
|
29
33
|
self._colorValues = {}
|
|
34
|
+
self._colorGradeValues = {}
|
|
30
35
|
self._vividnessValues = {}
|
|
31
36
|
|
|
32
|
-
self.ColorSwatchAdded =
|
|
33
|
-
self.ColorGradeAdded =
|
|
37
|
+
self.ColorSwatchAdded = self._maid:Add(Signal.new()) -- :Fire(name)
|
|
38
|
+
self.ColorGradeAdded = self._maid:Add(Signal.new()) -- :Fire(name)
|
|
34
39
|
|
|
35
40
|
return self
|
|
36
41
|
end
|
|
37
42
|
|
|
38
43
|
function ColorPalette:GetSwatchNames()
|
|
39
|
-
return self.
|
|
44
|
+
return Table.keys(self._swatches)
|
|
40
45
|
end
|
|
41
46
|
|
|
42
47
|
function ColorPalette:ObserveSwatchNames()
|
|
@@ -47,20 +52,8 @@ function ColorPalette:ObserveSwatchNames()
|
|
|
47
52
|
})
|
|
48
53
|
end
|
|
49
54
|
|
|
50
|
-
function ColorPalette:ObserveSwatchNameList()
|
|
51
|
-
return self._swatchMap:ObserveKeyList()
|
|
52
|
-
end
|
|
53
|
-
|
|
54
|
-
function ColorPalette:ObserveSwatchNamesBrio()
|
|
55
|
-
return self._swatchMap:ObserveKeysBrio()
|
|
56
|
-
end
|
|
57
|
-
|
|
58
55
|
function ColorPalette:GetGradeNames()
|
|
59
|
-
return self.
|
|
60
|
-
end
|
|
61
|
-
|
|
62
|
-
function ColorPalette:ObserveGradeNameList()
|
|
63
|
-
return self._colorGradeMap:ObserveKeyList()
|
|
56
|
+
return Table.keys(self._colorGradeValues)
|
|
64
57
|
end
|
|
65
58
|
|
|
66
59
|
function ColorPalette:ObserveGradeNames()
|
|
@@ -71,10 +64,6 @@ function ColorPalette:ObserveGradeNames()
|
|
|
71
64
|
})
|
|
72
65
|
end
|
|
73
66
|
|
|
74
|
-
function ColorPalette:ObserveGradeNamesBrio()
|
|
75
|
-
return self._colorGradeMap:ObserveKeysBrio()
|
|
76
|
-
end
|
|
77
|
-
|
|
78
67
|
function ColorPalette:GetColorValues()
|
|
79
68
|
return self._colorValues
|
|
80
69
|
end
|
|
@@ -141,7 +130,7 @@ function ColorPalette:SetDefaultSurfaceName(surfaceName)
|
|
|
141
130
|
end
|
|
142
131
|
|
|
143
132
|
function ColorPalette:GetColorSwatch(colorName)
|
|
144
|
-
local swatch = self.
|
|
133
|
+
local swatch = self._swatches[colorName]
|
|
145
134
|
if not swatch then
|
|
146
135
|
error(string.format("No swatch with name %q", colorName))
|
|
147
136
|
end
|
|
@@ -247,7 +236,7 @@ function ColorPalette:GetColorValue(colorName)
|
|
|
247
236
|
end
|
|
248
237
|
|
|
249
238
|
function ColorPalette:GetGradeValue(gradeName)
|
|
250
|
-
local gradeValue = self.
|
|
239
|
+
local gradeValue = self._colorGradeValues[gradeName]
|
|
251
240
|
if not gradeValue then
|
|
252
241
|
error(string.format("No grade with name %q", gradeName))
|
|
253
242
|
end
|
|
@@ -284,7 +273,7 @@ end
|
|
|
284
273
|
function ColorPalette:GetSwatch(swatchName)
|
|
285
274
|
assert(type(swatchName) == "string", "Bad swatchName")
|
|
286
275
|
|
|
287
|
-
local swatch = self.
|
|
276
|
+
local swatch = self._swatches[swatchName]
|
|
288
277
|
if not swatch then
|
|
289
278
|
error(string.format("No swatch with name %q", swatchName))
|
|
290
279
|
end
|
|
@@ -292,10 +281,6 @@ function ColorPalette:GetSwatch(swatchName)
|
|
|
292
281
|
return swatch
|
|
293
282
|
end
|
|
294
283
|
|
|
295
|
-
--[=[
|
|
296
|
-
@param colorName string
|
|
297
|
-
@param color Observable<Color3> | Color3
|
|
298
|
-
]=]
|
|
299
284
|
function ColorPalette:SetColor(colorName, color)
|
|
300
285
|
assert(type(colorName) == "string", "Bad colorName")
|
|
301
286
|
|
|
@@ -303,7 +288,7 @@ function ColorPalette:SetColor(colorName, color)
|
|
|
303
288
|
error(string.format("No color grade with name %q", colorName))
|
|
304
289
|
end
|
|
305
290
|
|
|
306
|
-
|
|
291
|
+
self._colorMaid[colorName] = self._colorValues[colorName]:Mount(color)
|
|
307
292
|
end
|
|
308
293
|
|
|
309
294
|
function ColorPalette:SetVividness(gradeName, vividness)
|
|
@@ -313,19 +298,18 @@ function ColorPalette:SetVividness(gradeName, vividness)
|
|
|
313
298
|
error(string.format("No vividness with name %q", gradeName))
|
|
314
299
|
end
|
|
315
300
|
|
|
316
|
-
|
|
301
|
+
self._vividMaid[gradeName] = self._vividnessValues[gradeName]:Mount(vividness)
|
|
317
302
|
end
|
|
318
303
|
|
|
319
304
|
function ColorPalette:SetColorGrade(gradeName, grade)
|
|
320
305
|
assert(type(gradeName) == "string", "Bad colorName")
|
|
321
306
|
assert(grade, "Bad grade")
|
|
322
307
|
|
|
323
|
-
|
|
324
|
-
if not gradeValue then
|
|
308
|
+
if not self._colorGradeValues[gradeName] then
|
|
325
309
|
error(string.format("No color grade with name %q", gradeName))
|
|
326
310
|
end
|
|
327
311
|
|
|
328
|
-
|
|
312
|
+
self._gradeMaid[gradeName] = self._colorGradeValues[gradeName]:Mount(grade)
|
|
329
313
|
end
|
|
330
314
|
|
|
331
315
|
|
|
@@ -338,21 +322,26 @@ end
|
|
|
338
322
|
function ColorPalette:DefineColorGrade(gradeName, gradeValue, vividnessValue)
|
|
339
323
|
assert(type(gradeName) == "string", "Bad gradeName")
|
|
340
324
|
|
|
341
|
-
if self.
|
|
325
|
+
if self._colorGradeValues[gradeName] then
|
|
342
326
|
warn(string.format("[ColorPalette.DefineColorGrade] - Already defined grade of name %q", gradeName))
|
|
343
327
|
return
|
|
344
328
|
end
|
|
345
329
|
|
|
346
|
-
local colorGrade =
|
|
347
|
-
|
|
330
|
+
local colorGrade = ValueObject.new(0, "number")
|
|
331
|
+
self._maid:GiveTask(colorGrade)
|
|
332
|
+
|
|
333
|
+
local vividness = ValueObject.new(nil)
|
|
334
|
+
self._maid:GiveTask(vividness)
|
|
348
335
|
|
|
349
|
-
|
|
350
|
-
vividness:Mount(vividnessValue)
|
|
336
|
+
self._gradePalette:Add(gradeName, colorGrade, vividness)
|
|
351
337
|
|
|
338
|
+
self._colorGradeValues[gradeName] = colorGrade
|
|
352
339
|
self._vividnessValues[gradeName] = vividness
|
|
353
340
|
|
|
354
|
-
self
|
|
355
|
-
self
|
|
341
|
+
self:SetVividness(gradeName, vividnessValue)
|
|
342
|
+
self:SetColorGrade(gradeName, gradeValue or 0)
|
|
343
|
+
|
|
344
|
+
self.ColorGradeAdded:Fire(gradeName)
|
|
356
345
|
|
|
357
346
|
return colorGrade
|
|
358
347
|
end
|
|
@@ -360,17 +349,21 @@ end
|
|
|
360
349
|
function ColorPalette:DefineColorSwatch(colorName, value)
|
|
361
350
|
assert(type(colorName) == "string", "Bad colorName")
|
|
362
351
|
|
|
363
|
-
if self.
|
|
352
|
+
if self._swatches[colorName] then
|
|
364
353
|
warn(string.format("[ColorPalette.DefineColorGrade] -Already defined color of name %q", colorName))
|
|
365
354
|
return
|
|
366
355
|
end
|
|
367
356
|
|
|
368
|
-
local colorValue =
|
|
369
|
-
|
|
357
|
+
local colorValue = ValueObject.new(value or Color3.new(0, 0, 0), "Color3")
|
|
358
|
+
self._maid:GiveTask(colorValue)
|
|
359
|
+
|
|
360
|
+
local colorSwatch = ColorSwatch.new(colorValue)
|
|
361
|
+
self._maid:GiveTask(colorSwatch)
|
|
370
362
|
|
|
371
363
|
self._colorValues[colorName] = colorValue
|
|
364
|
+
self._swatches[colorName] = colorSwatch
|
|
372
365
|
|
|
373
|
-
self.
|
|
366
|
+
self.ColorSwatchAdded:Fire(colorName)
|
|
374
367
|
|
|
375
368
|
return colorSwatch
|
|
376
369
|
end
|
|
@@ -7,9 +7,10 @@
|
|
|
7
7
|
local require = require(script.Parent.loader).load(script)
|
|
8
8
|
|
|
9
9
|
local BaseObject = require("BaseObject")
|
|
10
|
+
local Signal = require("Signal")
|
|
11
|
+
local Table = require("Table")
|
|
10
12
|
local Rx = require("Rx")
|
|
11
13
|
local ValueObject = require("ValueObject")
|
|
12
|
-
local ObservableSet = require("ObservableSet")
|
|
13
14
|
|
|
14
15
|
local FontPalette = setmetatable({}, BaseObject)
|
|
15
16
|
FontPalette.ClassName = "FontPalette"
|
|
@@ -27,9 +28,7 @@ function FontPalette.new()
|
|
|
27
28
|
self._fontFaces = {}
|
|
28
29
|
self._defaultFontMap = {} -- [name] = Enum.Font.?
|
|
29
30
|
|
|
30
|
-
self.
|
|
31
|
-
|
|
32
|
-
self.FontAdded = assert(self._fontKeys.ItemAdded, "No ItemAdded") -- :Fire(name)
|
|
31
|
+
self.FontAdded = self._maid:Add(Signal.new()) -- :Fire(name)
|
|
33
32
|
|
|
34
33
|
return self
|
|
35
34
|
end
|
|
@@ -40,12 +39,13 @@ end
|
|
|
40
39
|
@return { string }
|
|
41
40
|
]=]
|
|
42
41
|
function FontPalette:GetFontNames()
|
|
43
|
-
return self.
|
|
42
|
+
return Table.keys(self._fonts)
|
|
44
43
|
end
|
|
45
44
|
|
|
46
45
|
--[=[
|
|
47
46
|
Observes all available font names as they are added starting with
|
|
48
47
|
existing fonts.
|
|
48
|
+
|
|
49
49
|
@return Observable<string>
|
|
50
50
|
]=]
|
|
51
51
|
function FontPalette:ObserveFontNames()
|
|
@@ -61,16 +61,6 @@ function FontPalette:ObserveFontNames()
|
|
|
61
61
|
})
|
|
62
62
|
end
|
|
63
63
|
|
|
64
|
-
--[=[
|
|
65
|
-
Observes all available font names as they are added starting with
|
|
66
|
-
existing fonts.
|
|
67
|
-
|
|
68
|
-
@return Observable<Brio<string>>
|
|
69
|
-
]=]
|
|
70
|
-
function FontPalette:ObserveFontNamesBrio()
|
|
71
|
-
return self._fontKeys:ObserveItemsBrio()
|
|
72
|
-
end
|
|
73
|
-
|
|
74
64
|
--[=[
|
|
75
65
|
Gets a font from name
|
|
76
66
|
|
|
@@ -191,8 +181,11 @@ function FontPalette:DefineFont(fontName, defaultFont)
|
|
|
191
181
|
error("Bad defaultFont")
|
|
192
182
|
end
|
|
193
183
|
|
|
194
|
-
local fontValue =
|
|
195
|
-
|
|
184
|
+
local fontValue = ValueObject.new(defaultFontEnum)
|
|
185
|
+
self._maid:GiveTask(fontValue)
|
|
186
|
+
|
|
187
|
+
local fontFaceValue = ValueObject.new(defaultFontFace)
|
|
188
|
+
self._maid:GiveTask(fontFaceValue)
|
|
196
189
|
|
|
197
190
|
self._fonts[fontName] = fontValue
|
|
198
191
|
self._fontFaces[fontName] = fontFaceValue
|
|
@@ -211,7 +204,7 @@ function FontPalette:DefineFont(fontName, defaultFont)
|
|
|
211
204
|
end
|
|
212
205
|
end))
|
|
213
206
|
|
|
214
|
-
self.
|
|
207
|
+
self.FontAdded:Fire(fontName)
|
|
215
208
|
|
|
216
209
|
return fontValue
|
|
217
210
|
end
|