@weser/theming 0.0.10 → 0.0.12

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/dist/alpha.js CHANGED
@@ -1,12 +1,3 @@
1
- function normalizeAlpha(alpha) {
2
- if (alpha < 0) {
3
- return 0;
4
- }
5
- if (alpha > 1) {
6
- return 1;
7
- }
8
- return alpha;
9
- }
10
1
  export default function alpha(reference, alpha) {
11
- return `hsl(from ${reference} h s l / ${normalizeAlpha(alpha)})`;
2
+ return `hsl(from ${reference} h s l / max(0, min(1, ${alpha})))`;
12
3
  }
@@ -0,0 +1 @@
1
+ export default function darken(color: string, amount: number): string;
package/dist/darken.js ADDED
@@ -0,0 +1,4 @@
1
+ export default function darken(color, amount) {
2
+ const percentage = amount * 100;
3
+ return `hsl(from ${color} h s calc(max(0, min(100, l - ${percentage}))))`;
4
+ }
package/dist/index.d.ts CHANGED
@@ -4,3 +4,5 @@ export { default as createTheme } from './createTheme.js';
4
4
  export { default as createThemes } from './createThemes.js';
5
5
  export { default as alpha } from './alpha.js';
6
6
  export { default as a } from './alpha.js';
7
+ export { default as lighten } from './lighten.js';
8
+ export { default as darken } from './darken.js';
package/dist/index.js CHANGED
@@ -4,3 +4,5 @@ export { default as createTheme } from './createTheme.js';
4
4
  export { default as createThemes } from './createThemes.js';
5
5
  export { default as alpha } from './alpha.js';
6
6
  export { default as a } from './alpha.js';
7
+ export { default as lighten } from './lighten.js';
8
+ export { default as darken } from './darken.js';
@@ -0,0 +1 @@
1
+ export default function lighten(color: string, amount: number): string;
@@ -0,0 +1,4 @@
1
+ export default function lighten(color, amount) {
2
+ const percentage = amount * 100;
3
+ return `hsl(from ${color} h s calc(max(0, min(100, l + ${percentage}))))`;
4
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@weser/theming",
3
- "version": "0.0.10",
3
+ "version": "0.0.12",
4
4
  "description": "Utils for theming with CSS variables",
5
5
  "author": "Robin Weser <robin@weser.io>",
6
6
  "license": "MIT",
@@ -48,5 +48,5 @@
48
48
  "rimraf": "^3.0.2",
49
49
  "typescript": "^5.4.5"
50
50
  },
51
- "gitHead": "6dd1ad00ab8dacea2878edc99085324ea5d03588"
51
+ "gitHead": "8a4cafba91346a2a5bb4301317df661e176eb1d3"
52
52
  }