Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#### A React theme switching library that makes it easy to apply color-blind accessible UI themes.

<img width="1434" height="314" alt="스크린샷 2025-10-27 오전 9 05 44" src="https://github.com/user-attachments/assets/c009bd8c-974c-4e99-b28b-86acb9df26d9" />
<img width="1434" height="314" alt="colbrush" src="https://github.com/user-attachments/assets/c009bd8c-974c-4e99-b28b-86acb9df26d9" />

---

Expand Down Expand Up @@ -236,3 +236,4 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

3 changes: 2 additions & 1 deletion src/core/constants/regex.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export const variableRegex = /(--color-[\w-]+):\s*(#[0-9a-fA-F]{3,8})/g;
export const variableRegex =
/(--color-[\w-]+):\s*([#a-fA-F0-9]{3,8}|(?:oklch|lab|rgb|hsl)\([^)]+\))/g;
export const variationRegex =
/^--(.+?)-(50|100|200|300|400|500|600|700|800|900)$/i;
8 changes: 5 additions & 3 deletions src/core/utils/colorScale.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@ const CLAMP01 = (x: number) => Math.max(0, Math.min(1, x));

type ColorCtor = typeof ColorModule;

const Color = ((ColorModule as unknown as { default?: ColorCtor }).default ?? ColorModule) as ColorCtor;
const Color = ((ColorModule as unknown as { default?: ColorCtor }).default ??
ColorModule) as ColorCtor;

function hexToOKLCH(hex: string) {
const c = new Color(hex);
function hexToOKLCH(color: string) {
const normalizedColor = color.replace(/,(?=\s*\d)/g, ' ');
const c = new Color(normalizedColor);
const o = c.to('oklch');
return { l: o.l, c: o.c, h: o.h ?? 0 };
}
Expand Down