From 0dba016aa641e924df8270bcfbf4159eb6b792b7 Mon Sep 17 00:00:00 2001 From: Dany Castillo <31006608+dcastil@users.noreply.github.com> Date: Fri, 24 Jan 2025 21:19:28 +0100 Subject: [PATCH] add color-scheme utilities --- src/lib/default-config.ts | 17 ++++++++++++----- src/lib/types.ts | 1 + tests/class-map.test.ts | 1 + tests/tailwind-css-versions.test.ts | 1 + 4 files changed, 15 insertions(+), 5 deletions(-) diff --git a/src/lib/default-config.ts b/src/lib/default-config.ts index 68fb031..bfaa275 100644 --- a/src/lib/default-config.ts +++ b/src/lib/default-config.ts @@ -1606,6 +1606,18 @@ export const getDefaultConfig = () => { * @see https://tailwindcss.com/docs/appearance */ appearance: [{ appearance: ['none', 'auto'] }], + /** + * Caret Color + * @see https://tailwindcss.com/docs/just-in-time-mode#caret-color-utilities + */ + 'caret-color': [{ caret: [colors] }], + /** + * Color Scheme + * @see https://tailwindcss.com/docs/color-scheme + */ + 'color-scheme': [ + { scheme: ['normal', 'dark', 'light', 'light-dark', 'only-dark', 'only-light'] }, + ], /** * Cursor * @see https://tailwindcss.com/docs/cursor @@ -1653,11 +1665,6 @@ export const getDefaultConfig = () => { ], }, ], - /** - * Caret Color - * @see https://tailwindcss.com/docs/just-in-time-mode#caret-color-utilities - */ - 'caret-color': [{ caret: [colors] }], /** * Field Sizing * @see https://tailwindcss.com/docs/field-sizing diff --git a/src/lib/types.ts b/src/lib/types.ts index c58346b..27c841e 100644 --- a/src/lib/types.ts +++ b/src/lib/types.ts @@ -267,6 +267,7 @@ export type DefaultClassGroupIds = | 'col-end' | 'col-start-end' | 'col-start' + | 'color-scheme' | 'columns' | 'container' | 'content' diff --git a/tests/class-map.test.ts b/tests/class-map.test.ts index 19f5744..4b94fb5 100644 --- a/tests/class-map.test.ts +++ b/tests/class-map.test.ts @@ -215,6 +215,7 @@ test('class map has correct class groups at first part', () => { row: ['row-end', 'row-start', 'row-start-end'], saturate: ['saturate'], scale: ['scale', 'scale-x', 'scale-y'], + scheme: ['color-scheme'], scroll: [ 'scroll-behavior', 'scroll-m', diff --git a/tests/tailwind-css-versions.test.ts b/tests/tailwind-css-versions.test.ts index 63a3449..218e607 100644 --- a/tests/tailwind-css-versions.test.ts +++ b/tests/tailwind-css-versions.test.ts @@ -75,6 +75,7 @@ test('supports Tailwind CSS v4.0 features', () => { 'ring-4 ring-orange inset-ring-3 inset-ring-blue', ) expect(twMerge('field-sizing-content field-sizing-fixed')).toBe('field-sizing-fixed') + expect(twMerge('scheme-normal scheme-dark')).toBe('scheme-dark') // TODO: Remove proto expect(twMerge('')).toBe('')