@quenty/colorpalette 10.21.0 → 10.21.2-canary.547.11ae689.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,6 +3,29 @@
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
+ ## [10.21.2-canary.547.11ae689.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/colorpalette@10.21.0...@quenty/colorpalette@10.21.2-canary.547.11ae689.0) (2025-04-07)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * Add types to packages ([2374fb2](https://github.com/Quenty/NevermoreEngine/commit/2374fb2b043cfbe0e9b507b3316eec46a4e353a0))
12
+ * Bump package versions for republishing ([ba47c62](https://github.com/Quenty/NevermoreEngine/commit/ba47c62e32170bf74377b0c658c60b84306dc294))
13
+
14
+
15
+
16
+
17
+
18
+ ## [10.21.1](https://github.com/Quenty/NevermoreEngine/compare/@quenty/colorpalette@10.21.0...@quenty/colorpalette@10.21.1) (2025-04-07)
19
+
20
+
21
+ ### Bug Fixes
22
+
23
+ * Add types to packages ([2374fb2](https://github.com/Quenty/NevermoreEngine/commit/2374fb2b043cfbe0e9b507b3316eec46a4e353a0))
24
+
25
+
26
+
27
+
28
+
6
29
  # [10.21.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/colorpalette@10.20.4...@quenty/colorpalette@10.21.0) (2025-04-02)
7
30
 
8
31
  **Note:** Version bump only for package @quenty/colorpalette
package/LICENSE.md CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2014-2024 James Onnen (Quenty)
3
+ Copyright (c) 2014-2025 James Onnen (Quenty)
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quenty/colorpalette",
3
- "version": "10.21.0",
3
+ "version": "10.21.2-canary.547.11ae689.0",
4
4
  "description": "Color palette system for Roblox",
5
5
  "keywords": [
6
6
  "Roblox",
@@ -28,18 +28,18 @@
28
28
  "access": "public"
29
29
  },
30
30
  "dependencies": {
31
- "@quenty/baseobject": "^10.8.0",
32
- "@quenty/blend": "^12.18.0",
33
- "@quenty/color3utils": "^11.18.0",
34
- "@quenty/colorpicker": "^10.19.0",
35
- "@quenty/loader": "^10.8.0",
36
- "@quenty/maid": "^3.4.0",
37
- "@quenty/math": "^2.7.1",
38
- "@quenty/observablecollection": "^12.20.0",
39
- "@quenty/rx": "^13.17.0",
40
- "@quenty/signal": "^7.10.0",
41
- "@quenty/table": "^3.7.1",
42
- "@quenty/valueobject": "^13.17.0"
31
+ "@quenty/baseobject": "10.8.2-canary.547.11ae689.0",
32
+ "@quenty/blend": "12.18.2-canary.547.11ae689.0",
33
+ "@quenty/color3utils": "11.18.2-canary.547.11ae689.0",
34
+ "@quenty/colorpicker": "10.19.2-canary.547.11ae689.0",
35
+ "@quenty/loader": "10.8.2-canary.547.11ae689.0",
36
+ "@quenty/maid": "3.4.2-canary.547.11ae689.0",
37
+ "@quenty/math": "2.7.3-canary.547.11ae689.0",
38
+ "@quenty/observablecollection": "12.20.2-canary.547.11ae689.0",
39
+ "@quenty/rx": "13.17.2-canary.547.11ae689.0",
40
+ "@quenty/signal": "7.10.2-canary.547.11ae689.0",
41
+ "@quenty/table": "3.7.3-canary.547.11ae689.0",
42
+ "@quenty/valueobject": "13.17.2-canary.547.11ae689.0"
43
43
  },
44
- "gitHead": "e8ea56930e65322fcffc05a1556d5df988068f0b"
44
+ "gitHead": "11ae6894c9c40c596e521dc1d2a71977af63752f"
45
45
  }
@@ -134,7 +134,7 @@ function ColorPalette:ObserveColor(color, grade, vividness)
134
134
  end
135
135
  end
136
136
 
137
- function ColorPalette:SetDefaultSurfaceName(surfaceName)
137
+ function ColorPalette:SetDefaultSurfaceName(surfaceName: string)
138
138
  assert(type(surfaceName) == "string", "Bad surfaceName")
139
139
 
140
140
  self._gradePalette:SetDefaultSurfaceName(surfaceName)
@@ -178,7 +178,7 @@ function ColorPalette:_toGradeObservable(grade, fallbackColorSource)
178
178
  Rx.map(function(value)
179
179
  local luvColor = LuvColor3Utils.fromColor3(value)
180
180
  return luvColor[3]
181
- end)
181
+ end),
182
182
  })
183
183
  else
184
184
  error("Bad fallbackColorSource argument")
@@ -235,7 +235,7 @@ function ColorPalette:_toVividness(vividness, grade, name)
235
235
  end
236
236
  end
237
237
 
238
- function ColorPalette:GetColorValue(colorName)
238
+ function ColorPalette:GetColorValue(colorName: string)
239
239
  assert(type(colorName) == "string", "Bad colorName")
240
240
 
241
241
  local colorValue = self._colorValues[colorName]
@@ -264,7 +264,6 @@ function ColorPalette:GetVividnessValue(gradeName)
264
264
  return vividnessValue
265
265
  end
266
266
 
267
-
268
267
  function ColorPalette:ObserveModifiedGrade(gradeName, amount, multiplier)
269
268
  return self._gradePalette:ObserveModified(gradeName, amount, multiplier)
270
269
  end
@@ -277,7 +276,7 @@ function ColorPalette:ObserveVividness(name)
277
276
  return self._gradePalette:ObserveVividness(name)
278
277
  end
279
278
 
280
- function ColorPalette:GetSwatch(swatchName)
279
+ function ColorPalette:GetSwatch(swatchName: string)
281
280
  assert(type(swatchName) == "string", "Bad swatchName")
282
281
 
283
282
  local swatch = self._swatchMap:Get(swatchName)
@@ -10,6 +10,7 @@ local BaseObject = require("BaseObject")
10
10
  local Rx = require("Rx")
11
11
  local ValueObject = require("ValueObject")
12
12
  local ObservableSet = require("ObservableSet")
13
+ local _Observable = require("Observable")
13
14
 
14
15
  local FontPalette = setmetatable({}, BaseObject)
15
16
  FontPalette.ClassName = "FontPalette"
@@ -39,7 +40,7 @@ end
39
40
 
40
41
  @return { string }
41
42
  ]=]
42
- function FontPalette:GetFontNames()
43
+ function FontPalette:GetFontNames(): { string }
43
44
  return self._fontKeys:GetList()
44
45
  end
45
46
 
@@ -57,7 +58,7 @@ function FontPalette:ObserveFontNames()
57
58
  warn("[FontPalette.ObserveFontNames] - Calling when FontPalette is already dead")
58
59
  return {}
59
60
  end
60
- end)
61
+ end),
61
62
  })
62
63
  end
63
64
 
@@ -77,7 +78,7 @@ end
77
78
  @param fontName string
78
79
  @return Enum.Font
79
80
  ]=]
80
- function FontPalette:GetFont(fontName)
81
+ function FontPalette:GetFont(fontName: string): Enum.Font
81
82
  assert(type(fontName) == "string", "Bad fontName")
82
83
 
83
84
  return self:GetFontValue(fontName).Value
@@ -89,7 +90,7 @@ end
89
90
  @param fontName string
90
91
  @return Observe<Enum.Font>
91
92
  ]=]
92
- function FontPalette:ObserveFont(fontName)
93
+ function FontPalette:ObserveFont(fontName: string): _Observable.Observable<Enum.Font>
93
94
  assert(type(fontName) == "string", "Bad fontName")
94
95
 
95
96
  return self:GetFontValue(fontName):Observe()
@@ -99,11 +100,15 @@ end
99
100
  Observes the curent font face defined for the font name
100
101
 
101
102
  @param fontName string
102
- @param weight FontWeight | Observable<FontWeight> | nil
103
- @param style FontStyle | Observable<FontStyle> | nil
103
+ @param weight (FontWeight | Observable<FontWeight>)?
104
+ @param style (FontStyle | Observable<FontStyle>)?
104
105
  @return Observable<Font>
105
106
  ]=]
106
- function FontPalette:ObserveFontFace(fontName, weight, style)
107
+ function FontPalette:ObserveFontFace(
108
+ fontName: string,
109
+ weight: (Enum.FontWeight | _Observable.Observable<Enum.FontWeight>)?,
110
+ style: (Enum.FontStyle | _Observable.Observable<Enum.FontWeight>)?
111
+ )
107
112
  assert(type(fontName) == "string", "Bad fontName")
108
113
 
109
114
  if weight == nil and style == nil then
@@ -111,13 +116,13 @@ function FontPalette:ObserveFontFace(fontName, weight, style)
111
116
  end
112
117
 
113
118
  return Rx.combineLatest({
114
- font = self:GetFontFaceValue(fontName):Observe();
115
- weight = weight;
116
- style = style;
119
+ font = self:GetFontFaceValue(fontName):Observe(),
120
+ weight = weight,
121
+ style = style,
117
122
  }):Pipe({
118
123
  Rx.map(function(state)
119
124
  return Font.new(state.font.Family, state.weight or state.font.Weight, state.style or state.font.Style)
120
- end);
125
+ end),
121
126
  })
122
127
  end
123
128
 
@@ -125,9 +130,9 @@ end
125
130
  Gets a font value object for a given font.
126
131
 
127
132
  @param fontName string
128
- @return ValueObject<Enum.Font>
133
+ @return ValueObject<Font>
129
134
  ]=]
130
- function FontPalette:GetFontFaceValue(fontName)
135
+ function FontPalette:GetFontFaceValue(fontName: string): Font
131
136
  assert(type(fontName) == "string", "Bad fontName")
132
137
 
133
138
  local fontValue = self._fontFaces[fontName]
@@ -142,9 +147,9 @@ end
142
147
  Gets a font value object for a given font.
143
148
 
144
149
  @param fontName string
145
- @return ValueObject<Enum.Font>
150
+ @return ValueObject<Font>
146
151
  ]=]
147
- function FontPalette:GetFontValue(fontName)
152
+ function FontPalette:GetFontValue(fontName: string): ValueObject.ValueObject<Enum.Font>
148
153
  assert(type(fontName) == "string", "Bad fontName")
149
154
 
150
155
  local fontValue = self._fonts[fontName]
@@ -159,7 +164,7 @@ end
159
164
  Gets the default font map
160
165
  @return { string: Font }
161
166
  ]=]
162
- function FontPalette:GetDefaultFontMap()
167
+ function FontPalette:GetDefaultFontMap(): { string: Font }
163
168
  return self._defaultFontMap
164
169
  end
165
170
 
@@ -170,13 +175,13 @@ end
170
175
  @param defaultFont Enum.Font | Font
171
176
  @return ValueObject<Enum.Font | Font>
172
177
  ]=]
173
- function FontPalette:DefineFont(fontName, defaultFont)
178
+ function FontPalette:DefineFont(fontName: string, defaultFont: Enum.Font | Font): ValueObject.ValueObject<Enum.Font | Font>?
174
179
  assert(type(fontName) == "string", "Bad fontName")
175
180
  assert(typeof(defaultFont) == "EnumItem" or typeof(defaultFont) == "Font", "Bad defaultFont")
176
181
 
177
182
  if self._fonts[fontName] then
178
183
  warn(string.format("Already defined defaultFont of name %q", fontName))
179
- return
184
+ return nil
180
185
  end
181
186
 
182
187
  local defaultFontEnum
@@ -216,7 +221,7 @@ function FontPalette:DefineFont(fontName, defaultFont)
216
221
  return fontValue
217
222
  end
218
223
 
219
- function FontPalette:_tryToGetFontFace(fontFace)
224
+ function FontPalette:_tryToGetFontFace(fontFace: Font)
220
225
  local assetName = string.gmatch(fontFace.Family, "rbxasset://fonts/families/([%w]+).json$")()
221
226
 
222
227
  local fontEnum
@@ -27,7 +27,7 @@ function ColorGradePalette.new()
27
27
  return self
28
28
  end
29
29
 
30
- function ColorGradePalette:SetDefaultSurfaceName(gradeName)
30
+ function ColorGradePalette:SetDefaultSurfaceName(gradeName: string)
31
31
  assert(type(gradeName) == "string", "Bad gradeName")
32
32
 
33
33
  self._defaultSurfaceName.Value = gradeName
@@ -41,7 +41,7 @@ function ColorGradePalette:HasGrade(gradeName)
41
41
  end
42
42
  end
43
43
 
44
- function ColorGradePalette:GetGrade(gradeName)
44
+ function ColorGradePalette:GetGrade(gradeName: string)
45
45
  assert(type(gradeName) == "string", "Bad gradeName")
46
46
 
47
47
  local observable = self._grades[gradeName]
@@ -64,7 +64,7 @@ function ColorGradePalette:GetGrade(gradeName)
64
64
  return grade, self:GetVividness(gradeName)
65
65
  end
66
66
 
67
- function ColorGradePalette:GetVividness(gradeName)
67
+ function ColorGradePalette:GetVividness(gradeName: string)
68
68
  assert(type(gradeName) == "string", "Bad gradeName")
69
69
 
70
70
  local observable = self._vividness[gradeName]
@@ -98,7 +98,7 @@ function ColorGradePalette:ObserveGrade(gradeName)
98
98
  return self:_observeGradeFromName(gradeName)
99
99
  end
100
100
 
101
- function ColorGradePalette:ObserveVividness(gradeName)
101
+ function ColorGradePalette:ObserveVividness(gradeName: string)
102
102
  assert(type(gradeName) == "string", "Bad gradeName")
103
103
  assert(self._vividness[gradeName], "No vividness for gradeName")
104
104
 
@@ -1,3 +1,4 @@
1
+ --!strict
1
2
  --[=[
2
3
  Helps with color grades, which is the concept where the darkness of the color
3
4
  goes from 0 to 100, with a grade of 100 being white, and a grade of 0 being
@@ -22,9 +23,9 @@ local ColorGradeUtils = {}
22
23
 
23
24
  @param grade number
24
25
  @param difference number
25
- @return Color3
26
+ @return number
26
27
  ]=]
27
- function ColorGradeUtils.addGrade(grade, difference)
28
+ function ColorGradeUtils.addGrade(grade: number, difference: number): number
28
29
  local finalGrade = grade + difference
29
30
 
30
31
  if finalGrade > 100 or finalGrade < 0 then
@@ -42,7 +43,7 @@ function ColorGradeUtils.addGrade(grade, difference)
42
43
  return finalGrade
43
44
  end
44
45
 
45
- function ColorGradeUtils.addGradeToColor(color, difference)
46
+ function ColorGradeUtils.addGradeToColor(color: Color3, difference: number): Color3
46
47
  local grade = ColorGradeUtils.getGrade(color)
47
48
  return ColorGradeUtils.getGradedColor(color, ColorGradeUtils.addGrade(grade, difference))
48
49
  end
@@ -56,7 +57,7 @@ end
56
57
  @param amount number -- Between 0 and 100
57
58
  @return Color3
58
59
  ]=]
59
- function ColorGradeUtils.ensureGradeContrast(color, backing, amount)
60
+ function ColorGradeUtils.ensureGradeContrast(color: Color3, backing: Color3, amount: number): Color3
60
61
  local l, u, v = unpack(LuvColor3Utils.fromColor3(color))
61
62
  local _, _, bv = unpack(LuvColor3Utils.fromColor3(backing))
62
63
 
@@ -71,7 +72,7 @@ function ColorGradeUtils.ensureGradeContrast(color, backing, amount)
71
72
  end
72
73
 
73
74
  local direction = math.sign(rel) > 0 and 1 or -1
74
- local newRel = direction*amount
75
+ local newRel = direction * amount
75
76
 
76
77
  local newGrade = math.clamp(backingGrade + newRel, 0, 100)
77
78
  local otherNewGrade = math.clamp(backingGrade - newRel, 0, 100)
@@ -84,10 +85,10 @@ function ColorGradeUtils.ensureGradeContrast(color, backing, amount)
84
85
  end
85
86
 
86
87
  -- The further away from the original color the more we reduce vividness
87
- local proportion = math.min(amount, math.abs(finalGrade - grade))/amount
88
- u = math.clamp((1 - 0.5*proportion)*u, 0, 100)
88
+ local proportion = math.min(amount, math.abs(finalGrade - grade)) / amount
89
+ u = math.clamp((1 - 0.5 * proportion) * u, 0, 100)
89
90
 
90
- return LuvColor3Utils.toColor3({l, u, 100 - finalGrade})
91
+ return LuvColor3Utils.toColor3({ l, u, 100 - finalGrade })
91
92
  end
92
93
 
93
94
  --[=[
@@ -96,7 +97,7 @@ end
96
97
  @param color Color3
97
98
  @return number
98
99
  ]=]
99
- function ColorGradeUtils.getGrade(color)
100
+ function ColorGradeUtils.getGrade(color: Color3): number
100
101
  assert(typeof(color) == "Color3", "Bad color")
101
102
  local _, _, v = unpack(LuvColor3Utils.fromColor3(color))
102
103
 
@@ -108,10 +109,10 @@ end
108
109
 
109
110
  @param baseColor Color3
110
111
  @param colorGrade number -- 0 to 100
111
- @param vividness number | nil
112
+ @param vividness number?
112
113
  @return Color3
113
114
  ]=]
114
- function ColorGradeUtils.getGradedColor(baseColor, colorGrade, vividness)
115
+ function ColorGradeUtils.getGradedColor(baseColor: Color3, colorGrade: number, vividness: number?): Color3
115
116
  assert(typeof(baseColor) == "Color3", "Bad baseColor")
116
117
  assert(type(vividness) == "number" or vividness == nil, "Bad vividness")
117
118
  assert(type(colorGrade) == "number", "Bad colorGrade")
@@ -36,7 +36,7 @@ function ColorSwatch.new(color, vividness)
36
36
  return self
37
37
  end
38
38
 
39
- function ColorSwatch:GetGraded(colorGrade)
39
+ function ColorSwatch:GetGraded(colorGrade: number)
40
40
  assert(type(colorGrade) == "number", "Bad colorGrade")
41
41
 
42
42
  return ColorGradeUtils.getGradedColor(self._color.Value, colorGrade, self._vividness.Value)