@quenty/colorpicker 4.3.1 → 4.3.2-canary.303.3e5dce0.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,14 @@
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
+ ## [4.3.2-canary.303.3e5dce0.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/colorpicker@4.3.1...@quenty/colorpicker@4.3.2-canary.303.3e5dce0.0) (2022-11-08)
7
+
8
+ **Note:** Version bump only for package @quenty/colorpicker
9
+
10
+
11
+
12
+
13
+
6
14
  ## [4.3.1](https://github.com/Quenty/NevermoreEngine/compare/@quenty/colorpicker@4.3.0...@quenty/colorpicker@4.3.1) (2022-11-04)
7
15
 
8
16
  **Note:** Version bump only for package @quenty/colorpicker
package/README.md CHANGED
@@ -11,11 +11,11 @@
11
11
  </a>
12
12
  </div>
13
13
 
14
- Color selector UI
14
+ A HSV color picker which allows you to select colors in the same way as Roblox Studio.
15
15
 
16
- <div align="center"><a href="https://quenty.github.io/NevermoreEngine/api/HSColorPicker">View docs →</a></div>
16
+ <div align="center"><a href="https://quenty.github.io/NevermoreEngine/api/HSVColorPicker">View docs →</a></div>
17
17
 
18
18
  ## Installation
19
19
  ```
20
20
  npm install @quenty/colorpicker --save
21
- ```
21
+ ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quenty/colorpicker",
3
- "version": "4.3.1",
3
+ "version": "4.3.2-canary.303.3e5dce0.0",
4
4
  "description": "Color picking UI system for Roblox.",
5
5
  "keywords": [
6
6
  "Roblox",
@@ -28,15 +28,15 @@
28
28
  "access": "public"
29
29
  },
30
30
  "dependencies": {
31
- "@quenty/baseobject": "^6.0.1",
32
- "@quenty/basicpane": "^7.1.1",
33
- "@quenty/blend": "^6.3.1",
34
- "@quenty/color3utils": "^5.3.1",
35
- "@quenty/inputobjectutils": "^4.0.0",
36
- "@quenty/instanceutils": "^7.1.1",
37
- "@quenty/loader": "^6.0.1",
38
- "@quenty/maid": "^2.4.0",
39
- "@quenty/math": "^2.2.0"
31
+ "@quenty/baseobject": "6.0.1",
32
+ "@quenty/basicpane": "7.1.1",
33
+ "@quenty/blend": "6.3.1",
34
+ "@quenty/color3utils": "5.3.1",
35
+ "@quenty/inputobjectutils": "4.0.0",
36
+ "@quenty/instanceutils": "7.1.1",
37
+ "@quenty/loader": "6.0.1",
38
+ "@quenty/maid": "2.4.0",
39
+ "@quenty/math": "2.2.0"
40
40
  },
41
- "gitHead": "8b9877c26a3fc753409a5114e56717837291279d"
41
+ "gitHead": "3e5dce0b249a270d35586e5897a36e84611e7834"
42
42
  }
@@ -1,4 +1,6 @@
1
1
  --[=[
2
+ The actual cursor for the HSV (it's a plus). See [HSVColorPicker].
3
+
2
4
  @class HSColorPickerCursor
3
5
  ]=]
4
6
 
@@ -52,6 +54,11 @@ function HSColorPickerCursor.new()
52
54
  return self
53
55
  end
54
56
 
57
+ --[=[
58
+ Hints the background color so contrast can be set appropriately.
59
+
60
+ @param color Color3
61
+ ]=]
55
62
  function HSColorPickerCursor:HintBackgroundColor(color)
56
63
  assert(typeof(color) == "Color3", "Bad color")
57
64
 
@@ -66,18 +73,38 @@ function HSColorPickerCursor:SetHorizontalHairVisible(visible)
66
73
  self._horizontalHairVisible.Value = visible
67
74
  end
68
75
 
76
+ --[=[
77
+ Sets the size of the cursor.
78
+
79
+ @param height number
80
+ ]=]
69
81
  function HSColorPickerCursor:SetHeight(height)
70
82
  self._height.Value = height
71
83
  end
72
84
 
85
+ --[=[
86
+ Sets the Vector2 position in scale (from 0 to 1).
87
+
88
+ @param position Vector2
89
+ ]=]
73
90
  function HSColorPickerCursor:SetPosition(position)
74
91
  self._position.Value = position
75
92
  end
76
93
 
94
+ --[=[
95
+ Gets the position of the cursor in scale
96
+
97
+ @return Vector2
98
+ ]=]
77
99
  function HSColorPickerCursor:GetPosition()
78
100
  return self._position.Value
79
101
  end
80
102
 
103
+ --[=[
104
+ Sets the transparency of the cusor
105
+
106
+ @param transparency number
107
+ ]=]
81
108
  function HSColorPickerCursor:SetTransparency(transparency)
82
109
  assert(type(transparency) == "number", "Bad transparency")
83
110
 
@@ -143,4 +170,4 @@ function HSColorPickerCursor:_render()
143
170
  end
144
171
 
145
172
 
146
- return HSColorPickerCursor
173
+ return HSColorPickerCursor
@@ -1,4 +1,7 @@
1
1
  --[=[
2
+ Picker for hue and Saturation in HSV. See [HSVColorPicker] for the full color picker,
3
+ which also allows you to select "Value".
4
+
2
5
  @class HSColorPicker
3
6
  ]=]
4
7
 
@@ -6,9 +9,9 @@ local require = require(script.Parent.loader).load(script)
6
9
 
7
10
  local BaseObject = require("BaseObject")
8
11
  local Blend = require("Blend")
12
+ local ColorPickerCursorPreview = require("ColorPickerCursorPreview")
9
13
  local ColorPickerInput = require("ColorPickerInput")
10
14
  local HSColorPickerCursor = require("HSColorPickerCursor")
11
- local ColorPickerCursorPreview = require("ColorPickerCursorPreview")
12
15
 
13
16
  local HSColorPicker = setmetatable({}, BaseObject)
14
17
  HSColorPicker.ClassName = "HSColorPicker"
@@ -78,6 +81,11 @@ function HSColorPicker.new()
78
81
  return self
79
82
  end
80
83
 
84
+ --[=[
85
+ Gets whether the color picker is pressed or not.
86
+
87
+ @return BoolValue
88
+ ]=]
81
89
  function HSColorPicker:GetIsPressedValue()
82
90
  return self._input:GetIsPressedValue()
83
91
  end
@@ -93,37 +101,70 @@ function HSColorPicker:_updateHintedColors()
93
101
  self._preview:SetColor(hinted)
94
102
  end
95
103
 
104
+ --[=[
105
+ Sets the HSVColor as a Vector3
106
+ @param hsvColor Vector3
107
+ ]=]
96
108
  function HSColorPicker:SetHSVColor(hsvColor)
97
109
  assert(typeof(hsvColor) == "Vector3", "Bad hsvColor")
98
110
 
99
111
  self._hsvColorValue.Value = hsvColor
100
112
  end
101
113
 
114
+ --[=[
115
+ Gets the color as an HSV Vector3
116
+ @return Vector3
117
+ ]=]
102
118
  function HSColorPicker:GetHSVColor()
103
119
  return self._hsvColorValue.Value
104
120
  end
105
121
 
122
+ --[=[
123
+ Sets the color
124
+
125
+ @param color Color3
126
+ ]=]
106
127
  function HSColorPicker:SetColor(color)
107
128
  local h, s, v = Color3.toHSV(color)
108
129
  self._hsvColorValue.Value = Vector3.new(h, s, v)
109
130
  end
110
131
 
132
+ --[=[
133
+ Gets the color
134
+
135
+ @return Color3
136
+ ]=]
111
137
  function HSColorPicker:GetColor()
112
138
  local current = self._hsvColorValue.Value
113
139
  local h, s, v = current.x, current.y, current.z
114
140
  return Color3.fromHSV(h, s, v)
115
141
  end
116
142
 
143
+ --[=[
144
+ Gets the size value for the HSColorPicker.
145
+
146
+ @return Vector3
147
+ ]=]
117
148
  function HSColorPicker:GetSizeValue()
118
149
  return self._sizeValue
119
150
  end
120
151
 
152
+ --[=[
153
+ Sets the transparency of the HSColorPicker
154
+
155
+ @param transparency number
156
+ ]=]
121
157
  function HSColorPicker:SetTransparency(transparency)
122
158
  assert(type(transparency) == "number", "Bad transparency")
123
159
 
124
160
  self._transparency.Value = transparency
125
161
  end
126
162
 
163
+ --[=[
164
+ Sets the size of the color picker. This is in "line height" units.
165
+
166
+ @param height number
167
+ ]=]
127
168
  function HSColorPicker:SetSize(height)
128
169
  assert(type(height) == "number", "Bad height")
129
170
 
@@ -162,4 +203,4 @@ function HSColorPicker:_render()
162
203
  };
163
204
  end
164
205
 
165
- return HSColorPicker
206
+ return HSColorPicker
@@ -1,4 +1,7 @@
1
1
  --[=[
2
+ A HSV color picker component which can be used to select colors using
3
+ an interface standard to Roblox Studio.
4
+
2
5
  @class HSVColorPicker
3
6
  ]=]
4
7
 
@@ -14,6 +17,17 @@ local HSVColorPicker = setmetatable({}, BaseObject)
14
17
  HSVColorPicker.ClassName = "HSVColorPicker"
15
18
  HSVColorPicker.__index = HSVColorPicker
16
19
 
20
+ --[=[
21
+ Creates a new color picker!
22
+
23
+ ```lua
24
+ local picker = HSVColorPicker.new()
25
+ picker:SetColor(Color3.new(0.5, 0.5, 0.5))
26
+ picker.Gui.Parent = screenGui
27
+ ```
28
+
29
+ @return HSVColorPicker
30
+ ]=]
17
31
  function HSVColorPicker.new()
18
32
  local self = setmetatable(BaseObject.new(), HSVColorPicker)
19
33
 
@@ -78,6 +92,12 @@ function HSVColorPicker.new()
78
92
  return self
79
93
  end
80
94
 
95
+ --[=[
96
+ Sets the height of the HSVColorPicker. This impacts the [GetSizeValue] return
97
+ size. This is a general interface to size things.
98
+
99
+ @param height number
100
+ ]=]
81
101
  function HSVColorPicker:SetSize(height)
82
102
  assert(type(height) == "number", "Bad height")
83
103
 
@@ -85,6 +105,12 @@ function HSVColorPicker:SetSize(height)
85
105
  self._valuePicker:SetSize(height)
86
106
  end
87
107
 
108
+ --[=[
109
+ Syncs the color picker with the Color3Value.
110
+
111
+ @param color3Value Color3Value
112
+ @return maid
113
+ ]=]
88
114
  function HSVColorPicker:SyncValue(color3Value)
89
115
  local maid = Maid.new()
90
116
 
@@ -108,35 +134,70 @@ function HSVColorPicker:SyncValue(color3Value)
108
134
  return maid
109
135
  end
110
136
 
137
+ --[=[
138
+ Hints what the background color of the HSVColorPicker. This impacts
139
+ some UI elements to ensure proper contrast.
140
+
141
+ @param color Color3
142
+ ]=]
111
143
  function HSVColorPicker:HintBackgroundColor(color)
112
144
  self._valuePicker:HintBackgroundColor(color)
113
145
  end
114
146
 
147
+ --[=[
148
+ Set the current color in HSV formet.
149
+
150
+ @param hsvColor Vector3
151
+ ]=]
115
152
  function HSVColorPicker:SetHSVColor(hsvColor)
116
153
  assert(typeof(hsvColor) == "Vector3", "Bad hsvColor")
117
154
 
118
155
  self._hsvColorValue.Value = hsvColor
119
156
  end
120
157
 
158
+ --[=[
159
+ Get the current color in HSV formet as a Vector3.
160
+
161
+ @return Vector3
162
+ ]=]
121
163
  function HSVColorPicker:GetHSVColor()
122
164
  return self._hsvColorValue.Value
123
165
  end
124
166
 
167
+ --[=[
168
+ Set the current color.
169
+
170
+ @param color Color3
171
+ ]=]
125
172
  function HSVColorPicker:SetColor(color)
126
173
  local h, s, v = Color3.toHSV(color)
127
174
  self._hsvColorValue.Value = Vector3.new(h, s, v)
128
175
  end
129
176
 
177
+ --[=[
178
+ Get the current color.
179
+
180
+ @return Color3
181
+ ]=]
130
182
  function HSVColorPicker:GetColor()
131
183
  local current = self._hsvColorValue.Value
132
184
  local h, s, v = current.x, current.y, current.z
133
185
  return Color3.fromHSV(h, s, v)
134
186
  end
135
187
 
188
+ --[=[
189
+ A size value that defines the aspect ratio and size of this picker. See [SetSize]
190
+ @return Vector3
191
+ ]=]
136
192
  function HSVColorPicker:GetSizeValue()
137
193
  return self._sizeValue
138
194
  end
139
195
 
196
+ --[=[
197
+ Sets the transparency of the color
198
+
199
+ @param transparency number
200
+ ]=]
140
201
  function HSVColorPicker:SetTransparency(transparency)
141
202
  assert(type(transparency) == "number", "Bad transparency")
142
203
 
@@ -205,4 +266,4 @@ function HSVColorPicker:_render()
205
266
  };
206
267
  end
207
268
 
208
- return HSVColorPicker
269
+ return HSVColorPicker
@@ -1,4 +1,5 @@
1
1
  --[=[
2
+ Picker for value in HSV. See [HSVColorPicker]
2
3
  @class ValueColorPicker
3
4
  ]=]
4
5
 
@@ -250,4 +251,4 @@ function ValueColorPicker:_render()
250
251
  };
251
252
  end
252
253
 
253
- return ValueColorPicker
254
+ return ValueColorPicker