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

Function setColorScheme

packages/@react-spectrum/s2/src/style-utils.ts:148–190  ·  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': 'light dark',
155 light: 'light',
156 dark: 'dark'
157 }
158 }
159 },
160 colorScheme: '--s2-color-scheme',
161 // For backward compatibility in two cases:
162 // 1. When a component compiled with an earlier version of S2 is embedded in a newer provider.
163 // 2. When S2 CSS is compiled with lightningcss, setting color-scheme via a variable does not work.
164 '--lightningcss-light': {
165 type: 'transform', // arbitrary string
166 value: {
167 colorScheme: {
168 'light dark': {
169 default: 'initial',
170 '@media (prefers-color-scheme: dark)': ' '
171 },
172 light: 'initial',
173 dark: ' '
174 }
175 }
176 },
177 '--lightningcss-dark': {
178 type: 'transform', // arbitrary string
179 value: {
180 colorScheme: {
181 'light dark': {
182 default: ' ',
183 '@media (prefers-color-scheme: dark)': 'initial'
184 },
185 light: ' ',
186 dark: 'initial'
187 }
188 }
189 }
190 }) as const;
191
192export function staticColor(): Record<string, any> {
193 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