<commit_before># emotion-theming

> A CSS-in-JS theming solution for React

_`emotion-theming` is a theming library inspired by [styled-components](https://github.com/styled-components/styled-components)_

## Table of Contents

- [Install](#install)
- [Usage](#usage)
- [API](#api)
  - [ThemeProvider](#themeprovider)
  - [withTheme](#withthemecomponent)
- [Credits](#credits)
- [License](#license)

## Install

```bash
# add --save if using npm@4 or lower
npm i emotion-theming

# or
yarn add emotion-theming
```

## Usage

Theming is accomplished by placing the `ThemeProvider` component, at the top of the React component tree and wrapping descendants with the `withTheme` higher-order component. This HOC gets the current theme and injects it as a "prop" into your own component.

The theme prop is automatically injected into components created with `styled`. The theme can also be accessed via passing a function to the css prop.

```jsx
// Page.js
import * as React from 'react'
/** @jsx jsx */
import { jsx } from '@emotion/core'
import styled from '@emotion/styled'

const Container = styled.div({<commit_msg>update table of contents links in emotion-theming readme (#1268)<commit_after># emotion-theming

> A CSS-in-JS theming solution for React

_`emotion-theming` is a theming library inspired by [styled-components](https://github.com/styled-components/styled-components)_

## Table of Contents

- [Install](#install)
- [Usage](#usage)
- [API](#api)
  - [ThemeProvider](#themeprovider-reactcomponenttype)
  - [withTheme](#withthemecomponent-reactcomponenttype-reactcomponenttype)
- [Credits](#credits)
- [License](#license)

## Install

```bash
# add --save if using npm@4 or lower
npm i emotion-theming

# or
yarn add emotion-theming
```

## Usage

Theming is accomplished by placing the `ThemeProvider` component, at the top of the React component tree and wrapping descendants with the `withTheme` higher-order component. This HOC gets the current theme and injects it as a "prop" into your own component.

The theme prop is automatically injected into components created with `styled`. The theme can also be accessed via passing a function to the css prop.

```jsx
// Page.js
import * as React from 'react'
/** @jsx jsx */
import { jsx } from '@emotion/core'
import styled from '@emotion/styled'

const Container = styled.div({
{'fraction_non_alphanumeric': 0.11220136518771331, 'fraction_numerical': 0.002559726962457338, 'mean_word_length': 4.677966101694915, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7039361', 'n_tokens_mistral': 723, 'n_tokens_neox': 680, 'n_words': 263}