MCPcopy
hub / github.com/tw-in-js/twind / matchTheme

Function matchTheme

packages/core/src/rules.ts:176–191  ·  view source on GitHub ↗
(
  pattern: MaybeArray<string | RegExp>,

  /** Theme section to use (default: `$1` — The first matched group) */
  section?: '' | Section | KebabCase<Section>,

  /** The css property (default: value of {@link section}) */
  resolve?: keyof CSSProperties | ThemeRuleResolver<ThemeValue<Theme[Section]>, Theme>,

  convert?: ThemeMatchConverter<ThemeValue<Theme[Section]>, Theme>,
)

Source from the content-addressed store, hash-verified

174 * @returns
175 */
176export function matchTheme<
177 Theme extends BaseTheme = BaseTheme,
178 Section extends keyof Theme & string = keyof Theme & string,
179>(
180 pattern: MaybeArray<string | RegExp>,
181
182 /** Theme section to use (default: `$1` — The first matched group) */
183 section?: '' | Section | KebabCase<Section>,
184
185 /** The css property (default: value of {@link section}) */
186 resolve?: keyof CSSProperties | ThemeRuleResolver<ThemeValue<Theme[Section]>, Theme>,
187
188 convert?: ThemeMatchConverter<ThemeValue<Theme[Section]>, Theme>,
189): Rule<Theme> {
190 return [pattern, fromTheme(section, resolve, convert)]
191}
192
193/**
194 * @group Configuration

Callers 2

rules.tsFile · 0.90
filterFunction · 0.90

Calls 1

fromThemeFunction · 0.85

Tested by

no test coverage detected