@foxui/colors 0.4.6 → 0.4.8
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.
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
var _ = `precision mediump float;uniform vec2 resolution;uniform float hue_rad;precision mediump float;
|
|
2
2
|
#define M_PI 3.1415926536
|
|
3
|
-
float cbrt(float x){return sign(x)*pow(abs(x),1.0/3.0);}float srgb_transfer_function(float a){return .0031308>=a ? 12.92*a : 1.055*pow(a,.4166666666666667)-.055;}vec3 oklab_to_linear_srgb(vec3 c){float l_=c.x+0.3963377774*c.y+0.2158037573*c.z;float m_=c.x-0.1055613458*c.y-0.0638541728*c.z;float s_=c.x-0.0894841775*c.y-1.2914855480*c.z;float l=l_*l_*l_;float m=m_*m_*m_;float s=s_*s_*s_;return vec3(+4.0767416621*l-3.3077115913*m+0.2309699292*s,-1.2684380046*l+2.6097574011*m-0.3413193965*s,-0.0041960863*l-0.7034186147*m+1.7076147010*s);}float compute_max_saturation(float a,float b){float k0,k1,k2,k3,k4,wl,wm,ws;if(-1.88170328*a-0.80936493*b>1.0){k0=+1.19086277;k1=+1.76576728;k2=+0.59662641;k3=+0.75515197;k4=+0.56771245;wl=+4.0767416621;wm=-3.3077115913;ws=+0.2309699292;}else if(1.81444104*a-1.19445276*b>1.0){k0=+0.73956515;k1=-0.45954404;k2=+0.08285427;k3=+0.12541070;k4=+0.14503204;wl=-1.2684380046;wm=+2.6097574011;ws=-0.3413193965;}else{k0=+1.35733652;k1=-0.00915799;k2=-1.15130210;k3=-0.50559606;k4=+0.00692167;wl=-0.0041960863;wm=-0.7034186147;ws=+1.7076147010;}float S=k0+k1*a+k2*b+k3*a*a+k4*a*b;float k_l=+0.3963377774*a+0.2158037573*b;float k_m=-0.1055613458*a-0.0638541728*b;float k_s=-0.0894841775*a-1.2914855480*b;{float l_=1.0+S*k_l;float m_=1.0+S*k_m;float s_=1.0+S*k_s;float l=l_*l_*l_;float m=m_*m_*m_;float s=s_*s_*s_;float l_dS=3.0*k_l*l_*l_;float m_dS=3.0*k_m*m_*m_;float s_dS=3.0*k_s*s_*s_;float l_dS2=6.0*k_l*k_l*l_;float m_dS2=6.0*k_m*k_m*m_;float s_dS2=6.0*k_s*k_s*s_;float f=wl*l+wm*m+ws*s;float f1=wl*l_dS+wm*m_dS+ws*s_dS;float f2=wl*l_dS2+wm*m_dS2+ws*s_dS2;S=S-f*f1/(f1*f1-0.5*f*f2);}return S;}vec2 find_cusp(float a,float b){float S_cusp=compute_max_saturation(a,b);vec3 rgb_at_max=oklab_to_linear_srgb(vec3(1,S_cusp*a,S_cusp*b));float L_cusp=cbrt(1.0/max(max(rgb_at_max.r,rgb_at_max.g),rgb_at_max.b));float C_cusp=L_cusp*S_cusp;return vec2(L_cusp,C_cusp);}float toe_inv(float x){float k_1=0.206;float k_2=0.03;float k_3=(1.0+k_1)/(1.0+k_2);return(x*x+k_1*x)/(k_3*(x+k_2));}vec2 to_ST(vec2 cusp){float L=cusp.x;float C=cusp.y;return vec2(C/L,C/(1.0-L));}vec3 okhsv_to_srgb(vec3 hsv){float h=hsv.x;float s=hsv.y;float v=hsv.z;float a_=cos(2.0*M_PI*h);float b_=sin(2.0*M_PI*h);vec2 cusp=find_cusp(a_,b_);vec2 ST_max=to_ST(cusp);float S_max=ST_max.x;float T_max=ST_max.y;float S_0=0.5;float k=1.0-S_0/S_max;float L_v=1.0-s*S_0/(S_0+T_max-T_max*k*s);float C_v=s*T_max*S_0/(S_0+T_max-T_max*k*s);float L=v*L_v;float C=v*C_v;float L_vt=toe_inv(L_v);float C_vt=C_v*L_vt/L_v;float L_new=toe_inv(L);C=C*L_new/L;L=L_new;vec3 rgb_scale=oklab_to_linear_srgb(vec3(L_vt,a_*C_vt,b_*C_vt));float scale_L=cbrt(1.0/max(max(rgb_scale.r,rgb_scale.g),max(rgb_scale.b,0.0)));L=L*scale_L;C=C*scale_L;vec3 rgb=oklab_to_linear_srgb(vec3(L,C*a_,C*b_));return vec3(srgb_transfer_function(rgb.r),srgb_transfer_function(rgb.g),srgb_transfer_function(rgb.b));}void main(){vec2 uv=gl_FragCoord.xy/resolution;float l=uv.y;float h=hue_rad;vec3 hsl=vec3(h,uv.x,uv.y);vec3 hsvRGB=okhsv_to_srgb(hsl);gl_FragColor=vec4(hsvRGB,1.0);}`, a = "attribute vec4 position;void main(){gl_Position=position;}";
|
|
3
|
+
float cbrt(float x){return sign(x)*pow(abs(x),1.0/3.0);}float srgb_transfer_function(float a){return .0031308>=a ? 12.92*a : 1.055*pow(a,.4166666666666667)-.055;}vec3 oklab_to_linear_srgb(vec3 c){float l_=c.x+0.3963377774*c.y+0.2158037573*c.z;float m_=c.x-0.1055613458*c.y - 0.0638541728*c.z;float s_=c.x-0.0894841775*c.y - 1.2914855480*c.z;float l=l_*l_*l_;float m=m_*m_*m_;float s=s_*s_*s_;return vec3(+4.0767416621*l-3.3077115913*m+0.2309699292*s,-1.2684380046*l+2.6097574011*m-0.3413193965*s,-0.0041960863*l-0.7034186147*m+1.7076147010*s);}float compute_max_saturation(float a,float b){float k0,k1,k2,k3,k4,wl,wm,ws;if(-1.88170328*a-0.80936493*b>1.0){k0=+1.19086277;k1=+1.76576728;k2=+0.59662641;k3=+0.75515197;k4=+0.56771245;wl=+4.0767416621;wm=-3.3077115913;ws=+0.2309699292;}else if(1.81444104*a-1.19445276*b>1.0){k0=+0.73956515;k1=-0.45954404;k2=+0.08285427;k3=+0.12541070;k4=+0.14503204;wl=-1.2684380046;wm=+2.6097574011;ws=-0.3413193965;}else{k0=+1.35733652;k1=-0.00915799;k2=-1.15130210;k3=-0.50559606;k4=+0.00692167;wl=-0.0041960863;wm=-0.7034186147;ws=+1.7076147010;}float S=k0+k1*a+k2*b+k3*a*a+k4*a*b;float k_l=+0.3963377774*a+0.2158037573*b;float k_m=-0.1055613458*a-0.0638541728*b;float k_s=-0.0894841775*a-1.2914855480*b;{float l_=1.0+S*k_l;float m_=1.0+S*k_m;float s_=1.0+S*k_s;float l=l_*l_*l_;float m=m_*m_*m_;float s=s_*s_*s_;float l_dS=3.0*k_l*l_*l_;float m_dS=3.0*k_m*m_*m_;float s_dS=3.0*k_s*s_*s_;float l_dS2=6.0*k_l*k_l*l_;float m_dS2=6.0*k_m*k_m*m_;float s_dS2=6.0*k_s*k_s*s_;float f=wl*l+wm*m+ws*s;float f1=wl*l_dS+wm*m_dS+ws*s_dS;float f2=wl*l_dS2+wm*m_dS2+ws*s_dS2;S=S-f*f1/(f1*f1 - 0.5*f*f2);}return S;}vec2 find_cusp(float a,float b){float S_cusp=compute_max_saturation(a,b);vec3 rgb_at_max=oklab_to_linear_srgb(vec3(1,S_cusp*a,S_cusp*b));float L_cusp=cbrt(1.0/max(max(rgb_at_max.r,rgb_at_max.g),rgb_at_max.b));float C_cusp=L_cusp*S_cusp;return vec2(L_cusp,C_cusp);}float toe_inv(float x){float k_1=0.206;float k_2=0.03;float k_3=(1.0+k_1)/(1.0+k_2);return(x*x+k_1*x)/(k_3*(x+k_2));}vec2 to_ST(vec2 cusp){float L=cusp.x;float C=cusp.y;return vec2(C/L,C/(1.0-L));}vec3 okhsv_to_srgb(vec3 hsv){float h=hsv.x;float s=hsv.y;float v=hsv.z;float a_=cos(2.0*M_PI*h);float b_=sin(2.0*M_PI*h);vec2 cusp=find_cusp(a_,b_);vec2 ST_max=to_ST(cusp);float S_max=ST_max.x;float T_max=ST_max.y;float S_0=0.5;float k=1.0-S_0/S_max;float L_v=1.0-s*S_0/(S_0+T_max - T_max*k*s);float C_v=s*T_max*S_0/(S_0+T_max-T_max*k*s);float L=v*L_v;float C=v*C_v;float L_vt=toe_inv(L_v);float C_vt=C_v*L_vt/L_v;float L_new=toe_inv(L);C=C*L_new/L;L=L_new;vec3 rgb_scale=oklab_to_linear_srgb(vec3(L_vt,a_*C_vt,b_*C_vt));float scale_L=cbrt(1.0/max(max(rgb_scale.r,rgb_scale.g),max(rgb_scale.b,0.0)));L=L*scale_L;C=C*scale_L;vec3 rgb=oklab_to_linear_srgb(vec3(L,C*a_,C*b_));return vec3(srgb_transfer_function(rgb.r),srgb_transfer_function(rgb.g),srgb_transfer_function(rgb.b));}void main(){vec2 uv=gl_FragCoord.xy/resolution;float l=uv.y;float h=hue_rad;vec3 hsl=vec3(h,uv.x,uv.y);vec3 hsvRGB=okhsv_to_srgb(hsl);gl_FragColor=vec4(hsvRGB,1.0);}`, a = "attribute vec4 position;void main(){gl_Position=position;}";
|
|
4
4
|
const l = _, t = a;
|
|
5
5
|
export {
|
|
6
6
|
l as f_shader,
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@foxui/colors",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "0.4.
|
|
4
|
+
"version": "0.4.8",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": [
|
|
7
7
|
"**/*.css"
|
|
@@ -18,36 +18,36 @@
|
|
|
18
18
|
"types": "./dist/types.d.ts",
|
|
19
19
|
"svelte": "./dist/index.js",
|
|
20
20
|
"devDependencies": {
|
|
21
|
-
"@eslint/compat": "^
|
|
22
|
-
"@eslint/js": "^
|
|
23
|
-
"@sveltejs/adapter-auto": "^
|
|
24
|
-
"@sveltejs/adapter-static": "^3.0.
|
|
25
|
-
"@sveltejs/kit": "^2.
|
|
26
|
-
"@sveltejs/package": "^2.
|
|
27
|
-
"@sveltejs/vite-plugin-svelte": "^
|
|
28
|
-
"@tailwindcss/forms": "^0.5.
|
|
29
|
-
"@tailwindcss/typography": "^0.5.
|
|
30
|
-
"@tailwindcss/vite": "^4.
|
|
31
|
-
"eslint": "^
|
|
32
|
-
"eslint-config-prettier": "^10.
|
|
33
|
-
"eslint-plugin-svelte": "^3.
|
|
34
|
-
"globals": "^
|
|
35
|
-
"prettier": "^3.
|
|
36
|
-
"prettier-plugin-svelte": "^3.
|
|
37
|
-
"prettier-plugin-tailwindcss": "^0.
|
|
38
|
-
"svelte": "^5.
|
|
39
|
-
"svelte-check": "^4.
|
|
40
|
-
"tailwindcss": "^4.
|
|
41
|
-
"typescript": "^5.
|
|
42
|
-
"typescript-eslint": "^8.
|
|
43
|
-
"vite": "^
|
|
44
|
-
"vite-plugin-glsl": "^1.
|
|
21
|
+
"@eslint/compat": "^2.0.2",
|
|
22
|
+
"@eslint/js": "^10.0.1",
|
|
23
|
+
"@sveltejs/adapter-auto": "^7.0.1",
|
|
24
|
+
"@sveltejs/adapter-static": "^3.0.10",
|
|
25
|
+
"@sveltejs/kit": "^2.53.0",
|
|
26
|
+
"@sveltejs/package": "^2.5.7",
|
|
27
|
+
"@sveltejs/vite-plugin-svelte": "^6.2.4",
|
|
28
|
+
"@tailwindcss/forms": "^0.5.11",
|
|
29
|
+
"@tailwindcss/typography": "^0.5.19",
|
|
30
|
+
"@tailwindcss/vite": "^4.2.0",
|
|
31
|
+
"eslint": "^10.0.1",
|
|
32
|
+
"eslint-config-prettier": "^10.1.8",
|
|
33
|
+
"eslint-plugin-svelte": "^3.15.0",
|
|
34
|
+
"globals": "^17.3.0",
|
|
35
|
+
"prettier": "^3.8.1",
|
|
36
|
+
"prettier-plugin-svelte": "^3.5.0",
|
|
37
|
+
"prettier-plugin-tailwindcss": "^0.7.2",
|
|
38
|
+
"svelte": "^5.53.2",
|
|
39
|
+
"svelte-check": "^4.4.3",
|
|
40
|
+
"tailwindcss": "^4.2.0",
|
|
41
|
+
"typescript": "^5.9.3",
|
|
42
|
+
"typescript-eslint": "^8.56.0",
|
|
43
|
+
"vite": "^7.3.1",
|
|
44
|
+
"vite-plugin-glsl": "^1.5.5"
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@texel/color": "^1.1.
|
|
47
|
+
"@texel/color": "^1.1.11",
|
|
48
48
|
"@use-gesture/vanilla": "^10.3.1",
|
|
49
|
-
"bits-ui": "^
|
|
50
|
-
"@foxui/core": "0.4.
|
|
49
|
+
"bits-ui": "^2.16.2",
|
|
50
|
+
"@foxui/core": "0.4.8"
|
|
51
51
|
},
|
|
52
52
|
"peerDependencies": {
|
|
53
53
|
"svelte": ">=5",
|