From 7dbcecacdc71f95a8be03d36c468639ac89b0672 Mon Sep 17 00:00:00 2001 From: Kseninia Mikhaylova Date: Mon, 30 Sep 2024 14:14:55 +0300 Subject: [PATCH] text color fix --- utils/contrast_color.ts | 2 +- utils/material.ts | 13 ++----------- 2 files changed, 3 insertions(+), 12 deletions(-) diff --git a/utils/contrast_color.ts b/utils/contrast_color.ts index 2f3e908..7093e14 100644 --- a/utils/contrast_color.ts +++ b/utils/contrast_color.ts @@ -7,7 +7,7 @@ export const contrastColor = (color: ralTypes) => { if (hex) { const hsl = { h: 0, s: 0, l: 0 } new Color(hex).getHSL(hsl) - if (hsl.l < 0.5) { + if (hsl.l < 0.45) { return '#fff' } else { return '#000' diff --git a/utils/material.ts b/utils/material.ts index 12d7b49..94fa2ee 100644 --- a/utils/material.ts +++ b/utils/material.ts @@ -82,22 +82,13 @@ const m_onBeforeCompile = (shader) => { } ${shader.fragmentShader} ` - // .replace( - // `#include `, - // ` - // float noise_v = noise(diffuseColor.rg); - // float clamped_noise = clamp(noise_v, -0.15, 0.15); - // diffuseColor.rgb *= clamped_noise; - // #include - // ` - // ) .replace( `#include `, `#include float noise_v = noise(gl_FragColor.rg); - float clamped_noise = clamp(noise_v, -0.05, 0.05); - gl_FragColor.rgb -= clamp(vec3(clamped_noise), 0.0, 1.0); + float clamped_noise = clamp(noise_v, 0.85, 1.0); + gl_FragColor.rgb *= vec3(clamped_noise); ` ); };