@rbxts/types 1.0.566 → 1.0.567

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.
@@ -1182,6 +1182,17 @@ interface Color3 {
1182
1182
  Lerp(this: Color3, goal: Color3, alpha: number): Color3;
1183
1183
  /** Returns the [hue, saturation, and value](https://en.wikipedia.org/wiki/HSL_and_HSV) of a Color3. This function is the inverse operation of the `Color3.fromHSV` constructor. */
1184
1184
  ToHSV(): LuaTuple<[number, number, number]>;
1185
+ /**
1186
+ * Converts the color to a six-character hexadecimal string representing the color in the format RRGGBB. It is not
1187
+ * prefixed with an octothorpe (#), although this can be concatenated easily.
1188
+ *
1189
+ * The returned string can be provided to `Color3.fromHex` to produce the original color.
1190
+ * ```lua
1191
+ * print(Color3.new(0, 1, 0):ToHex()) --> "00FF00"
1192
+ * print(BrickColor.new("Really red").Color:ToHex()) --> "FF0000"
1193
+ * ```
1194
+ */
1195
+ ToHex(): string;
1185
1196
  }
1186
1197
 
1187
1198
  interface Color3Constructor {
@@ -1191,6 +1202,19 @@ interface Color3Constructor {
1191
1202
  fromHSV: (hue: number, sat: number, val: number) => Color3;
1192
1203
  /** Returns the hue, saturation, and value of a Color3. */
1193
1204
  toHSV: (color: Color3) => LuaTuple<[number, number, number]>;
1205
+ /**
1206
+ * Returns a new Color3 from a six- or three-character [hexadecimal](https://en.wikipedia.org/wiki/Hexadecimal)
1207
+ * format. A preceding octothorpe (#) is ignored, if present. This function interprets the given string as a typical
1208
+ * web hex color in the format RRGGBB or RGB (shorthand for RRGGBB). For example, #FFAA00 produces an orange color,
1209
+ * and is the same as #FA0.
1210
+ *
1211
+ * The color returned can be converted back into hex using `Color3:toHex`, although it is not guaranteed to return
1212
+ * the exact same string as passed to this function.
1213
+ * ```lua
1214
+ * print(Color3.fromHex("#FF0000")) --> 1, 0, 0
1215
+ * ```
1216
+ */
1217
+ fromHex: (hex: string) => Color3;
1194
1218
  /** Returns a Color3 with the given red, green, and blue values. The numbers can range from 0 to 1, defaulting to 0 */
1195
1219
  new (red?: number, green?: number, blue?: number): Color3;
1196
1220
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rbxts/types",
3
- "version": "1.0.566",
3
+ "version": "1.0.567",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },