diff --git a/.changeset/cyan-singers-invite.md b/.changeset/cyan-singers-invite.md
new file mode 100644
index 00000000000..4960a4248ea
--- /dev/null
+++ b/.changeset/cyan-singers-invite.md
@@ -0,0 +1,5 @@
+---
+"@primer/react": minor
+---
+
+Add support for `'dark'` and `'light'` in `colorMode` for ThemeProvider
diff --git a/src/ThemeProvider.tsx b/src/ThemeProvider.tsx
index 39a741f2444..b290c4af335 100644
--- a/src/ThemeProvider.tsx
+++ b/src/ThemeProvider.tsx
@@ -9,7 +9,7 @@ const defaultNightScheme = 'dark'
// eslint-disable-next-line @typescript-eslint/no-explicit-any
export type Theme = {[key: string]: any}
-type ColorMode = 'day' | 'night'
+type ColorMode = 'day' | 'night' | 'light' | 'dark'
type ColorModeWithAuto = ColorMode | 'auto'
export type ThemeProviderProps = {
@@ -202,7 +202,9 @@ function resolveColorMode(colorMode: ColorModeWithAuto, systemColorMode: ColorMo
function chooseColorScheme(colorMode: ColorMode, dayScheme: string, nightScheme: string) {
switch (colorMode) {
case 'day':
+ case 'light':
return dayScheme
+ case 'dark':
case 'night':
return nightScheme
}
diff --git a/src/__tests__/ThemeProvider.test.tsx b/src/__tests__/ThemeProvider.test.tsx
index 9159d021b0b..038938ef763 100644
--- a/src/__tests__/ThemeProvider.test.tsx
+++ b/src/__tests__/ThemeProvider.test.tsx
@@ -126,6 +126,16 @@ it('respects nightScheme prop', () => {
expect(screen.getByText('Hello')).toHaveStyleRule('color', 'gray')
})
+it('respects nightScheme prop with colorMode="dark"', () => {
+ render(
+
+ Hello
+
+ )
+
+ expect(screen.getByText('Hello')).toHaveStyleRule('color', 'gray')
+})
+
it('respects dayScheme prop', () => {
render(
@@ -136,6 +146,16 @@ it('respects dayScheme prop', () => {
expect(screen.getByText('Hello')).toHaveStyleRule('color', 'white')
})
+it('respects dayScheme prop with colorMode="light"', () => {
+ render(
+
+ Hello
+
+ )
+
+ expect(screen.getByText('Hello')).toHaveStyleRule('color', 'white')
+})
+
it('works in auto mode', () => {
render(