MCPcopy Create free account
hub / github.com/adobe/react-spectrum / setColorScheme

Function setColorScheme

packages/@react-spectrum/s2/src/style-utils.ts:148–193  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

146 * });
147 */
148export const setColorScheme = () =>
149 ({
150 '--s2-color-scheme': {
151 type: 'colorScheme',
152 value: {
153 colorScheme: {
154 'light dark': {
155 default: 'light',
156 '@media (prefers-color-scheme: dark)': 'dark'
157 },
158 light: 'light',
159 dark: 'dark'
160 }
161 }
162 },
163 colorScheme: '--s2-color-scheme',
164 // For backward compatibility in two cases:
165 // 1. When a component compiled with an earlier version of S2 is embedded in a newer provider.
166 // 2. When S2 CSS is compiled with lightningcss, setting color-scheme via a variable does not work.
167 '--lightningcss-light': {
168 type: 'transform', // arbitrary string
169 value: {
170 colorScheme: {
171 'light dark': {
172 default: 'initial',
173 '@media (prefers-color-scheme: dark)': ' '
174 },
175 light: 'initial',
176 dark: ' '
177 }
178 }
179 },
180 '--lightningcss-dark': {
181 type: 'transform', // arbitrary string
182 value: {
183 colorScheme: {
184 'light dark': {
185 default: ' ',
186 '@media (prefers-color-scheme: dark)': 'initial'
187 },
188 light: ' ',
189 dark: 'initial'
190 }
191 }
192 }
193 }) as const;
194
195export function staticColor(): Record<string, any> {
196 return {

Callers 7

Popover.tsxFile · 0.90
Modal.tsxFile · 0.90
Tooltip.tsxFile · 0.90
Provider.tsxFile · 0.90
CoachMark.tsxFile · 0.90
TableView.tsxFile · 0.90
ThemeSwitcherFunction · 0.50

Calls

no outgoing calls

Tested by

no test coverage detected