jb-core 0.8.0 → 0.9.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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/theme/colors.ts +31 -2
package/package.json CHANGED
@@ -14,7 +14,7 @@
14
14
  "react component",
15
15
  "event"
16
16
  ],
17
- "version": "0.8.0",
17
+ "version": "0.9.0",
18
18
  "bugs": "https://github.com/javadbat/jb-core/issues",
19
19
  "license": "MIT",
20
20
  "files": [
package/theme/colors.ts CHANGED
@@ -4,8 +4,19 @@ export const colors = {
4
4
  single:{
5
5
  black:"oklch(0.14 0 0)",
6
6
  white:"oklch(1 0 0)",
7
+ highlight:"oklch(0.93 0.2302 125.18)"
8
+ },
9
+ primary:{
10
+ main:'oklch(0.6 0.26 256)',
11
+ hover:getHoverColor(0.6,0.26,256),
12
+ pressed:getPressedColor(0.6,0.26,256)
13
+ },
14
+ secondary:{
15
+ main:'oklch(0.6 0.26 286)',
16
+ hover:getHoverColor(0.6,0.26,286),
17
+ pressed:getPressedColor(0.6,0.26,286),
7
18
  }
8
- };
19
+ } as const;
9
20
  export function defineColors() {
10
21
  defineColorCodes();
11
22
  defineTextColors();
@@ -15,7 +26,13 @@ function defineColorCodes(){
15
26
  name: "--jb-primary",
16
27
  syntax: "<color>",
17
28
  inherits: true,
18
- initialValue: "oklch(0.6 0.26 256)",
29
+ initialValue: colors.primary.main,
30
+ });
31
+ setCssProperty({
32
+ name: "--jb-secondary",
33
+ syntax: "<color>",
34
+ inherits: true,
35
+ initialValue: colors.secondary.main,
19
36
  });
20
37
  setCssProperty({
21
38
  name: "--jb-neutral",
@@ -35,6 +52,12 @@ function defineColorCodes(){
35
52
  inherits: true,
36
53
  initialValue: colors.single.white ,
37
54
  });
55
+ setCssProperty({
56
+ name: "--jb-highlight",
57
+ syntax: "<color>",
58
+ inherits: true,
59
+ initialValue: colors.single.highlight ,
60
+ });
38
61
  setCssProperty({
39
62
  name: "--jb-green",
40
63
  syntax: "<color>",
@@ -86,4 +109,10 @@ function defineTextColors() {
86
109
  //
87
110
  export function getNeutralColor(index: number) {
88
111
  return `oklch(${(6 * (3+index*1.3))*0.01} ${(14+(index*0.09))*0.001} 258.36)`;
112
+ }
113
+ export function getHoverColor(lightness:number, chroma:number, hue:number){
114
+ return `oklch(${lightness + 0.07} ${chroma + 0.07} ${hue})`;
115
+ }
116
+ export function getPressedColor(lightness:number, chroma:number, hue:number){
117
+ return `oklch(${lightness - 0.1} ${chroma - 0.05} ${hue})`;
89
118
  }