@quenty/colorpalette 5.0.0-canary.367.e9fdcbc.0 → 5.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,117 @@
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
- # [5.0.0-canary.367.e9fdcbc.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/colorpalette@4.23.0...@quenty/colorpalette@5.0.0-canary.367.e9fdcbc.0) (2023-06-05)
6
+ # [5.0.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/colorpalette@4.34.0...@quenty/colorpalette@5.0.0) (2023-10-11)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * GradePalette can take in Color3 value ([642796d](https://github.com/Quenty/NevermoreEngine/commit/642796d24e23f0691f0ee324e646c89c4396ee6e))
12
+ * Vividness handling for custom colors is more consistent ([539fbee](https://github.com/Quenty/NevermoreEngine/commit/539fbeed18aaaeefaa9772ba9ca4f7fd8084e710))
13
+
14
+
15
+
16
+
17
+
18
+ # [4.34.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/colorpalette@4.33.0...@quenty/colorpalette@4.34.0) (2023-09-21)
19
+
20
+ **Note:** Version bump only for package @quenty/colorpalette
21
+
22
+
23
+
24
+
25
+
26
+ # [4.33.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/colorpalette@4.32.0...@quenty/colorpalette@4.33.0) (2023-09-04)
27
+
28
+ **Note:** Version bump only for package @quenty/colorpalette
29
+
30
+
31
+
32
+
33
+
34
+ # [4.32.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/colorpalette@4.31.0...@quenty/colorpalette@4.32.0) (2023-08-23)
35
+
36
+
37
+ ### Bug Fixes
38
+
39
+ * Remove dead code ([b8719a7](https://github.com/Quenty/NevermoreEngine/commit/b8719a7abe0b7a34bc869064a5a1595499801598))
40
+ * Use table.clone instead of Table.copy ([44468bd](https://github.com/Quenty/NevermoreEngine/commit/44468bda58a95b5a17c5998807231124d2a55187))
41
+ * Vividness pass-though as messy ([9335e8d](https://github.com/Quenty/NevermoreEngine/commit/9335e8d2809de7c8768982addf03d6b64b60ea6a))
42
+
43
+
44
+ ### Features
45
+
46
+ * Add ColorGradeUtils.addGradeToColor(color, difference, vividness) ([715abf8](https://github.com/Quenty/NevermoreEngine/commit/715abf8b497fb1c087e29266eb7c88ed538a2870))
47
+
48
+
49
+
50
+
51
+
52
+ # [4.31.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/colorpalette@4.30.0...@quenty/colorpalette@4.31.0) (2023-08-01)
53
+
54
+ **Note:** Version bump only for package @quenty/colorpalette
55
+
56
+
57
+
58
+
59
+
60
+ # [4.30.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/colorpalette@4.29.0...@quenty/colorpalette@4.30.0) (2023-07-28)
61
+
62
+ **Note:** Version bump only for package @quenty/colorpalette
63
+
64
+
65
+
66
+
67
+
68
+ # [4.29.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/colorpalette@4.28.0...@quenty/colorpalette@4.29.0) (2023-07-25)
69
+
70
+ **Note:** Version bump only for package @quenty/colorpalette
71
+
72
+
73
+
74
+
75
+
76
+ # [4.28.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/colorpalette@4.27.0...@quenty/colorpalette@4.28.0) (2023-07-23)
77
+
78
+ **Note:** Version bump only for package @quenty/colorpalette
79
+
80
+
81
+
82
+
83
+
84
+ # [4.27.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/colorpalette@4.26.1...@quenty/colorpalette@4.27.0) (2023-07-15)
85
+
86
+ **Note:** Version bump only for package @quenty/colorpalette
87
+
88
+
89
+
90
+
91
+
92
+ ## [4.26.1](https://github.com/Quenty/NevermoreEngine/compare/@quenty/colorpalette@4.26.0...@quenty/colorpalette@4.26.1) (2023-07-11)
93
+
94
+ **Note:** Version bump only for package @quenty/colorpalette
95
+
96
+
97
+
98
+
99
+
100
+ # [4.26.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/colorpalette@4.25.0...@quenty/colorpalette@4.26.0) (2023-07-10)
101
+
102
+ **Note:** Version bump only for package @quenty/colorpalette
103
+
104
+
105
+
106
+
107
+
108
+ # [4.25.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/colorpalette@4.24.0...@quenty/colorpalette@4.25.0) (2023-06-17)
109
+
110
+ **Note:** Version bump only for package @quenty/colorpalette
111
+
112
+
113
+
114
+
115
+
116
+ # [4.24.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/colorpalette@4.23.0...@quenty/colorpalette@4.24.0) (2023-06-05)
7
117
 
8
118
  **Note:** Version bump only for package @quenty/colorpalette
9
119
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quenty/colorpalette",
3
- "version": "5.0.0-canary.367.e9fdcbc.0",
3
+ "version": "5.0.0",
4
4
  "description": "Color palette system for Roblox",
5
5
  "keywords": [
6
6
  "Roblox",
@@ -28,17 +28,17 @@
28
28
  "access": "public"
29
29
  },
30
30
  "dependencies": {
31
- "@quenty/baseobject": "6.2.1",
32
- "@quenty/blend": "7.0.0-canary.367.e9fdcbc.0",
33
- "@quenty/color3utils": "6.0.0-canary.367.e9fdcbc.0",
34
- "@quenty/colorpicker": "5.0.0-canary.367.e9fdcbc.0",
35
- "@quenty/loader": "6.2.1",
36
- "@quenty/maid": "2.5.0",
37
- "@quenty/math": "3.0.0-canary.367.e9fdcbc.0",
38
- "@quenty/rx": "7.11.0",
39
- "@quenty/signal": "2.4.0",
40
- "@quenty/table": "3.2.0",
41
- "@quenty/valueobject": "8.0.0-canary.367.e9fdcbc.0"
31
+ "@quenty/baseobject": "^7.0.0",
32
+ "@quenty/blend": "^7.0.0",
33
+ "@quenty/color3utils": "^6.0.0",
34
+ "@quenty/colorpicker": "^5.0.0",
35
+ "@quenty/loader": "^7.0.0",
36
+ "@quenty/maid": "^2.6.0",
37
+ "@quenty/math": "^2.5.0",
38
+ "@quenty/rx": "^8.0.0",
39
+ "@quenty/signal": "^3.0.0",
40
+ "@quenty/table": "^3.3.0",
41
+ "@quenty/valueobject": "^8.0.0"
42
42
  },
43
- "gitHead": "e9fdcbc6ea1d46e068bf42a08b833099e9005259"
43
+ "gitHead": "fdeae46099587019ec5fc15317dc673aed379400"
44
44
  }
@@ -148,12 +148,6 @@ function ColorPalette:GetColorSwatch(colorName)
148
148
  return swatch
149
149
  end
150
150
 
151
- function ColorPalette:SetColor(colorName, value)
152
- assert(type(colorName) == "string", "Bad colorName")
153
-
154
- self._swatches[colorName]:SetColor(value)
155
- end
156
-
157
151
  function ColorPalette:ObserveGradeOn(colorName, newSurfaceName, baseSurfaceName)
158
152
  return self._gradePalette:ObserveOn(colorName, newSurfaceName, baseSurfaceName)
159
153
  end
@@ -190,7 +184,7 @@ function ColorPalette:_toGradeObservable(grade, fallbackColorSource)
190
184
  end
191
185
  end
192
186
 
193
- function ColorPalette:_toVividnessObservable(vividness, grade, fallbackColorSource)
187
+ function ColorPalette:_toVividnessObservable(vividness, grade, colorOrObservable)
194
188
  if type(vividness) == "string" then
195
189
  return self._gradePalette:ObserveVividness(vividness)
196
190
  elseif type(vividness) == "number" then
@@ -205,25 +199,14 @@ function ColorPalette:_toVividnessObservable(vividness, grade, fallbackColorSour
205
199
  end
206
200
 
207
201
  if type(grade) == "string" then
208
- -- Fall back to the grade value
202
+ -- Fall back to the grade value's vividness
209
203
  return self._gradePalette:ObserveVividness(grade)
210
- end
211
-
212
- -- Otherwise fall back to name of color
213
- if type(fallbackColorSource) == "string" then
214
- return (self._gradePalette:ObserveVividness(fallbackColorSource))
215
- elseif typeof(fallbackColorSource) == "Color3" then
216
- local luvColor = LuvColor3Utils.fromColor3(fallbackColorSource)
217
- return Rx.of(luvColor[2])
218
- elseif Observable.isObservable(fallbackColorSource) then
219
- return fallbackColorSource:Pipe({
220
- Rx.map(function(value)
221
- local luvColor = LuvColor3Utils.fromColor3(value)
222
- return luvColor[2]
223
- end)
224
- })
204
+ elseif type(colorOrObservable) == "string" then
205
+ -- Fall back to color
206
+ return self._gradePalette:ObserveVividness(colorOrObservable)
225
207
  else
226
- error("Bad fallbackColorSource argument")
208
+ -- Vividness is pretty optional
209
+ return Rx.of(nil)
227
210
  end
228
211
  end
229
212
 
@@ -240,8 +223,8 @@ end
240
223
  function ColorPalette:_toVividness(vividness, grade, name)
241
224
  if type(vividness) == "string" then
242
225
  return self._gradePalette:GetVividness(vividness)
243
- elseif type(grade) == "number" then
244
- return grade
226
+ elseif type(vividness) == "number" then
227
+ return vividness
245
228
  elseif type(grade) == "string" then
246
229
  -- Fall back to the grade value
247
230
  return self._gradePalette:GetVividness(grade)
@@ -10,7 +10,7 @@ local ColorPickerStoryUtils = require("ColorPickerStoryUtils")
10
10
  local ColorPalette = require("ColorPalette")
11
11
  local ValueObject = require("ValueObject")
12
12
 
13
- local DARK_MODE_ENABLED = false
13
+ local DARK_MODE_ENABLED = true
14
14
 
15
15
  return function(target)
16
16
  local maid = Maid.new()
@@ -53,12 +53,14 @@ return function(target)
53
53
  palette:SetColorGrade("highlight", 70, 1)
54
54
  palette:SetColorGrade("action", palette:ObserveColorBaseGradeBetween("action", 70, 100), 0.1)
55
55
  palette:SetColorGrade("mouseOver", -15)
56
+ palette:SetVividness("text", 0.5)
57
+ palette:SetVividness("action", 0.5)
56
58
  end
57
59
 
58
60
  if DARK_MODE_ENABLED then
59
- light()
60
- else
61
61
  dark()
62
+ else
63
+ light()
62
64
  end
63
65
 
64
66
  local function sampleGui(labelText)
@@ -225,6 +227,12 @@ return function(target)
225
227
  Blend.New "UIPadding" {
226
228
  PaddingTop = UDim.new(0, 10);
227
229
  };
230
+
231
+ Blend.New "Frame" {
232
+ Name = "TestCustomColor";
233
+ Size = UDim2.new(0, 30, 0, 30);
234
+ BackgroundColor3 = palette:ObserveColor(Color3.new(0, 0, 1), "text");
235
+ };
228
236
  }
229
237
  }):Subscribe())
230
238
 
@@ -85,7 +85,6 @@ function ColorGradePalette:GetVividness(gradeName)
85
85
 
86
86
  assert(type(vividness) == "number", "Bad vividness retrieved")
87
87
  return vividness
88
-
89
88
  end
90
89
 
91
90
  function ColorGradePalette:Add(gradeName, colorGrade, vividness)
@@ -168,7 +167,17 @@ function ColorGradePalette:_observeGradeFromName(gradeName)
168
167
  if typeof(gradeName) == "Color3" then
169
168
  return Rx.of(ColorGradeUtils.getGrade(gradeName))
170
169
  elseif Observable.isObservable(gradeName) then
171
- return gradeName
170
+ return gradeName:Pipe({
171
+ Rx.map(function(value)
172
+ if typeof(value) == "Color3" then
173
+ return ColorGradeUtils.getGrade(value)
174
+ elseif typeof(value) == "number" then
175
+ return value
176
+ else
177
+ error("Bad grade value")
178
+ end
179
+ end)
180
+ })
172
181
  end
173
182
 
174
183
  local gradeObservable = self._grades[gradeName]
@@ -42,6 +42,11 @@ function ColorGradeUtils.addGrade(grade, difference)
42
42
  return finalGrade
43
43
  end
44
44
 
45
+ function ColorGradeUtils.addGradeToColor(color, difference)
46
+ local grade = ColorGradeUtils.getGrade(color)
47
+ return ColorGradeUtils.getGradedColor(color, ColorGradeUtils.addGrade(grade, difference))
48
+ end
49
+
45
50
  --[=[
46
51
  Ensures the given contrast between the color and the backing, with
47
52
  an adjustment to saturation to keep the UI loking good
@@ -65,7 +70,8 @@ function ColorGradeUtils.ensureGradeContrast(color, backing, amount)
65
70
  return color
66
71
  end
67
72
 
68
- local newRel = math.sign(rel)*amount
73
+ local direction = math.sign(rel) > 0 and 1 or -1
74
+ local newRel = direction*amount
69
75
 
70
76
  local newGrade = math.clamp(backingGrade + newRel, 0, 100)
71
77
  local otherNewGrade = math.clamp(backingGrade - newRel, 0, 100)