npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@react-md/theme

v5.1.6

Published

The base package for including a theme for react-md. This is required by most other packages.

Downloads

10,066

Readme

@react-md/theme

This package is used for creating a color theme within react-md. It also exposes some utility Components and mixins for updating the theme at runtime through CSS Variables.

Installation

This package can be installed through npm if you want access to all the SCSS variables, functions, and mixins or by using the pre-compiled bundles hosted on https://unpkg.com.

npm install --save @react-md/theme

Documentation

Full usage and documentation can be found on the main documentation site at the theme page, but there will be a few examples in this README.

Defining a theme

Starting with v2.0.0, react-md will use both SCSS and css variables to define themes. This allows you to use the nice dynamic themes with css variables in evergreen browsers but also support the older ones if needed.

The default theme is:

$rmd-theme-primary: $rmd-purple-500 !default;
$rmd-theme-secondary: $rmd-pink-a-400 !default;

// the background color for your app. Normally applied to the base <html> tag
$rmd-theme-background: #fafafa !default;

// the background color for "surfaces" (things like dialogs, menus, cards, etc)
$rmd-theme-surface: #fff !default;

This can be overridden by setting these variables to new colors that are included in react-md, or a custom color by re-defining these values before importing the main theme file.

Using the default dark theme

If you override the $rmd-theme-light variable to be false, the default theme will be:

$rmd-theme-primary: $rmd-purple-500 !default;
$rmd-theme-secondary: $rmd-pink-a-400 !default;

// the background color for your app. Normally applied to the base <html> tag
$rmd-theme-background: #303030 !default;

// the background color for "surfaces" (things like dialogs, menus, cards, etc)
$rmd-theme-surface: $md-grey-800 !default;

With a material design color

If the theme colors are one of the material design colors, you can use some of the existing SCSS variables to update your theme.

Example:

@import "@react-md/theme/dist/color-palette";

$rmd-theme-primary: $rmd-blue-500;
$rmd-theme-secondary: $rmd-orange-a-400;

@import "@react-md/theme/dist/mixins";

@include react-md-theme;

Note that the theme variables were overridden before importing the main theme file. You might have problems overriding the theme if you define them after.

With any color

Since your company might have specific branding colors, it is also possible to define a theme that does not have material design colors at all.

$my-awesome-company-purple: #9b59b6;
$my-awesome-company-orange: #e67e22;

$rmd-theme-primary: $my-awesome-company-purple;
$rmd-theme-secondary: $my-awesome-company-orange;

@import "@react-md/theme/dist/mixins";

@include react-md-theme;

Recommended base project files

To make including custom styles easy, it might be helpful to create the following files in your project:

  • src/_branding.scss - A file that contains the color variables for your company's branding
  • src/_react-md-overrides.scss - A file that contains the react-md variable overrides with new values
  • src/_all.scss - A file that is used as a quick import to include all available variables, mixins, and functions within any file in your app for convenience
  • src/index.scss - A file that is used to generate your base styles

Example:

// in src/_branding.scss
$my-awesome-company-purple: #9b59b6;
$my-awesome-company-orange: #e67e22;
// in src/_react-md-overrides.scss
@import "branding";

$rmd-theme-primary: $my-awesome-company-purple;
$rmd-theme-secondary: $my-awesome-company-orange;
// in src/_all.scss
@import "my-awesome-company-branding";
@import "my-awesome-company-react-md-overrides";

@import "@react-md/theme/dist/mixins";
// in src/index.scss
@import "all";

@include react-md-theme;