use-styled-theme

1.0.0 • Public • Published

🎨 use-styled-theme

React hook for getting Styled Components theme values.

NPM JavaScript Style Guide

Install

npm i use-styled-theme || yarn add use-styled-theme

Usage

import React from 'react'
import { ThemeProvider } from "styled-components";
import useStyledTheme from 'use-styled-theme'

const Component = () => {
  const { color } = useStyledTheme();

  return (
    <div style={{ backgroundColor: color }}>
      <h1>{color}</h1>
    </div>
  );
};

const App = () => (
  <ThemeProvider theme={{ color: "#BADA55" }}>
    <Component />
  </ThemeProvider>
);

License

MIT © markoradak

Package Sidebar

Install

npm i use-styled-theme

Weekly Downloads

2

Version

1.0.0

License

MIT

Unpacked Size

4.27 kB

Total Files

6

Last publish

Collaborators

  • markoradak