color-bits 1.0.2 → 1.0.3
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/README.md +7 -8
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -44,7 +44,7 @@ Due to the compact representation, `color-bits` preserves **at most 8 bits of pr
|
|
|
44
44
|
- Yes: `oklab(59.69% 0.1007 0.1191)`
|
|
45
45
|
- No: `oklab(from green l a b / 0.5)`
|
|
46
46
|
|
|
47
|
-
When parsing and converting non-sRGB color spaces, `color-bits` behaves the same as browsers
|
|
47
|
+
When parsing and converting non-sRGB color spaces, `color-bits` behaves the same as browsers do, which differs from the formal CSS spec! In technical terms: non-sRGB color spaces with a wider gamut are converted using clipping rather than gamut-mapping.
|
|
48
48
|
|
|
49
49
|
For performance reasons, the representation is `int32`, not `uint32`. It is expected if you see negative numbers when you print the color value.
|
|
50
50
|
|
|
@@ -52,8 +52,8 @@ Every function is tree-shakeable, so the bundle size cost should be from 1.5kb t
|
|
|
52
52
|
|
|
53
53
|
### 📚 Documentation
|
|
54
54
|
|
|
55
|
-
[
|
|
56
|
-
[
|
|
55
|
+
[Docs for color-bits](https://github.com/romgrk/color-bits/tree/master/docs/README.md)
|
|
56
|
+
[Docs for color-bits/string](https://github.com/romgrk/color-bits/tree/master/docs/string/README.md)
|
|
57
57
|
|
|
58
58
|
If you're storing and manipulating colors frequently, you should use the `color-bits` exports directly, e.g.
|
|
59
59
|
|
|
@@ -61,24 +61,23 @@ If you're storing and manipulating colors frequently, you should use the `color-
|
|
|
61
61
|
import * as Color from 'color-bits'
|
|
62
62
|
|
|
63
63
|
const background = Color.parse('#232323')
|
|
64
|
-
const seeThrough = Color.alpha(
|
|
64
|
+
const seeThrough = Color.alpha(background, 0.5)
|
|
65
65
|
const output = Color.format(seeThrough) // #RRGGBBAA string
|
|
66
66
|
```
|
|
67
67
|
|
|
68
|
-
The `color-bits/string`
|
|
68
|
+
The `color-bits/string` module wraps some of the functions to accept string colors as input/output, which may be useful if you're not storing the colors but just transforming them on the fly. It can be faster than calling the functions separately in some cases.
|
|
69
69
|
|
|
70
70
|
```tsx
|
|
71
71
|
import * as Color from 'color-bits/string'
|
|
72
72
|
|
|
73
|
-
const
|
|
74
|
-
const output = Color.alpha(backround, 0.5) // #RRGGBBAA string
|
|
73
|
+
const output = Color.alpha('#232323', 0.5) // #RRGGBBAA string
|
|
75
74
|
```
|
|
76
75
|
|
|
77
76
|
### 📜 License
|
|
78
77
|
|
|
79
78
|
I release any of the code I wrote here to the public domain. Feel free to copy/paste in part or in full without attribution.
|
|
80
79
|
|
|
81
|
-
Some parts of the codebase have been extracted from Chrome's devtools, MaterialUI, and stackoverflow, those contain a license notice or attribution in code comments, inline.
|
|
80
|
+
Some parts of the codebase have been extracted from Chrome's devtools, MaterialUI, and stackoverflow, those contain a license notice or attribution in code comments, inline. Everything is MIT-compatible.
|
|
82
81
|
|
|
83
82
|
<p align="center">
|
|
84
83
|
<small>🔴🟠🟡🟢🔵🟣</small>
|