@lakuna/color 1.0.0 → 1.1.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.
@@ -3,7 +3,7 @@ import type Rgb from "../types/Rgb.js";
3
3
  /**
4
4
  * Split a hexadecimal value into sRGB values.
5
5
  * @param hex - The hexidecimal representation of the number (i.e. `0x50c878`).
6
- * @returns R, G, and B sRGB values (each in the range `[0x00,0xff]`), in that order.
6
+ * @returns An sRGB color.
7
7
  * @public
8
8
  */
9
9
  export default function hexToRgb(hex: number): Rgb {
@@ -0,0 +1,11 @@
1
+ import type Rgb from "../types/Rgb.js";
2
+
3
+ /**
4
+ * Convert sRGB values into the numerical hexadecimal representation of the color.
5
+ * @param rgb - The sRGB representation of the number.
6
+ * @returns The numerical hexadecimal representation of the color.
7
+ * @public
8
+ */
9
+ export default function rgbToHex(rgb: Rgb): number {
10
+ return rgb[0] * 0x10000 + rgb[1] * 0x100 + rgb[2];
11
+ }