@newlogic-digital/core 0.9.0 → 0.9.1

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/index.js CHANGED
@@ -15,7 +15,7 @@ import {
15
15
  root
16
16
  } from "./modules/Core.js";
17
17
 
18
- import { tailwindColors, tailwindVariables } from './modules/tailwind/index.js'
18
+ import { tailwindColors, tailwindColorsRgba, tailwindVariables } from './modules/tailwind/index.js'
19
19
 
20
20
  const defineConfig = (config) => new Core().init(config);
21
21
 
@@ -23,6 +23,7 @@ export {
23
23
  defineConfig,
24
24
  tailwindColors,
25
25
  tailwindVariables,
26
+ tailwindColorsRgba,
26
27
  Core,
27
28
  Utils,
28
29
  Styles,
@@ -15,6 +15,22 @@ const tailwindColors = (colors = []) => {
15
15
  return colors
16
16
  };
17
17
 
18
+ const tailwindColorsRgba = (colors = []) => {
19
+ colors.forEach(name => {
20
+ colors[name] = ({opacityVariable, opacityValue}) => {
21
+ if (opacityValue !== undefined) {
22
+ return `rgba(var(--color-${name}), ${opacityValue})`
23
+ }
24
+ if (opacityVariable !== undefined) {
25
+ return `rgba(var(--color-${name}), var(${opacityVariable}, 1))`
26
+ }
27
+ return `rgb(var(--color-${name}))`
28
+ };
29
+ });
30
+
31
+ return colors
32
+ };
33
+
18
34
  const tailwindVariables = (type, variables = [], values = {}) => {
19
35
  variables.forEach(name => {
20
36
  values[name] = `var(--${type}-${name})`;
@@ -24,4 +40,5 @@ const tailwindVariables = (type, variables = [], values = {}) => {
24
40
  };
25
41
 
26
42
  exports.tailwindColors = tailwindColors;
43
+ exports.tailwindColorsRgba = tailwindColorsRgba;
27
44
  exports.tailwindVariables = tailwindVariables;
@@ -11,6 +11,22 @@ const tailwindColors = (colors = []) => {
11
11
  return colors
12
12
  }
13
13
 
14
+ const tailwindColorsRgba = (colors = []) => {
15
+ colors.forEach(name => {
16
+ colors[name] = ({opacityVariable, opacityValue}) => {
17
+ if (opacityValue !== undefined) {
18
+ return `rgba(var(--color-${name}), ${opacityValue})`
19
+ }
20
+ if (opacityVariable !== undefined) {
21
+ return `rgba(var(--color-${name}), var(${opacityVariable}, 1))`
22
+ }
23
+ return `rgb(var(--color-${name}))`
24
+ }
25
+ })
26
+
27
+ return colors
28
+ }
29
+
14
30
  const tailwindVariables = (type, variables = [], values = {}) => {
15
31
  variables.forEach(name => {
16
32
  values[name] = `var(--${type}-${name})`
@@ -19,4 +35,4 @@ const tailwindVariables = (type, variables = [], values = {}) => {
19
35
  return values
20
36
  }
21
37
 
22
- export { tailwindColors, tailwindVariables }
38
+ export { tailwindColors, tailwindVariables, tailwindColorsRgba }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@newlogic-digital/core",
3
3
  "type": "module",
4
- "version": "0.9.0",
4
+ "version": "0.9.1",
5
5
  "main": "index.js",
6
6
  "author": "New Logic Studio s.r.o.",
7
7
  "description": "Set of tools that can be used to create modern web applications",