0.0.5 • Published 6 months ago

mui-theme-variables v0.0.5

Weekly downloads
-
License
ISC
Repository
github
Last release
6 months ago

MUI-THEME-VARIABLES

Description

It is not the best way to write CSS code in a JavaScript file because the code becomes complicated, so this library enables you to use MUI theme properties as CSS variables, so you can use them in separate CSS and SCSS files.

Note

When you create a custom theme, the variables will change automatically

Installation

Installation is done using the npm install command:

$ npm install mui-theme-variables

Example

In the app.js file

import { useTheme } from "@mui/material/styles";
import { useVariables } from "mui-theme-variables";
import "./style.css"

const theme = useTheme();
const { variables } = useVariables(theme)

// put the variables in the style prop in the main container

<div style={variables}>
    <h1 className="h1">Hello world</h1>
</div>

In the CSS file

.h1 {
  color: var(--palette-primary-main);
}

In the SCSS file

.h1 {
  color: var(--palette-primary-main);
}

Variables

Variable Namedefault
--breakpoints-values-xs0
--breakpoints-values-sm600
--breakpoints-values-md900
--breakpoints-values-lg1200
--breakpoints-values-xl1536
--breakpoints-unitpx
--directionltr
--palette-modedark
--palette-common-black#000
--palette-common-white#fff
--palette-primary-main#90caf9
--palette-primary-light#e3f2fd
--palette-primary-dark#42a5f5
--palette-primary-contrast-textrgba(0, 0, 0, 0.87)
--palette-secondary-main#ce93d8
--palette-secondary-light#f3e5f5
--palette-secondary-dark#ab47bc
--palette-secondary-contrast-textrgba(0, 0, 0, 0.87)
--palette-error-main#f44336
--palette-error-light#e57373
--palette-error-dark#d32f2f
--palette-error-contrast-text#fff
--palette-warning-main#ffa726
--palette-warning-light#ffb74d
--palette-warning-dark#f57c00
--palette-warning-contrast-textrgba(0, 0, 0, 0.87)
--palette-info-main#29b6f6
--palette-info-light#4fc3f7
--palette-info-dark#0288d1
--palette-info-contrast-textrgba(0, 0, 0, 0.87)
--palette-success-main#66bb6a
--palette-success-light#81c784
--palette-success-dark#388e3c
--palette-success-contrast-textrgba(0, 0, 0, 0.87)
--palette-grey-50#fafafa
--palette-grey-100#f5f5f5
--palette-grey-200#eeeeee
--palette-grey-300#e0e0e0
--palette-grey-400#bdbdbd
--palette-grey-500#9e9e9e
--palette-grey-600#757575
--palette-grey-700#616161
--palette-grey-800#424242
--palette-grey-900#212121
--palette-grey--a100#f5f5f5
--palette-grey--a200#eeeeee
--palette-grey--a400#bdbdbd
--palette-grey--a700#616161
--palette-contrast-threshold3
--palette-tonal-offset0.2
--palette-text-primary#fff
--palette-text-secondaryrgba(255, 255, 255, 0.7)
--palette-text-disabledrgba(255, 255, 255, 0.5)
--palette-text-iconrgba(255, 255, 255, 0.5)
--palette-dividerrgba(255, 255, 255, 0.12)
--palette-background-paper#121212
--palette-background-default#121212
--palette-action-active#fff
--palette-action-hoverrgba(255, 255, 255, 0.08)
--palette-action-hover-opacity0.08
--palette-action-selectedrgba(255, 255, 255, 0.16)
--palette-action-selected-opacity0.16
--palette-action-disabledrgba(255, 255, 255, 0.3)
--palette-action-disabled-backgroundrgba(255, 255, 255, 0.12)
--palette-action-disabled-opacity0.38
--palette-action-focusrgba(255, 255, 255, 0.12)
--palette-action-focus-opacity0.12
--palette-action-activated-opacity0.24
--shape-border-radius4
--mixins-toolbar-min-height56
--mixins-toolbar-@media (min-width:0px)-@media (orientation: landscape)-min-height48
--mixins-toolbar-@media (min-width:600px)-min-height64
--shadows-0none
--shadows-10px 2px 1px -1px rgba(0,0,0,0.2),0px 1px 1px 0px rgba(0,0,0,0.14),0px 1px 3px 0px rgba(0,0,0,0.12)
--shadows-20px 3px 1px -2px rgba(0,0,0,0.2),0px 2px 2px 0px rgba(0,0,0,0.14),0px 1px 5px 0px rgba(0,0,0,0.12)
--shadows-30px 3px 3px -2px rgba(0,0,0,0.2),0px 3px 4px 0px rgba(0,0,0,0.14),0px 1px 8px 0px rgba(0,0,0,0.12)
--shadows-40px 2px 4px -1px rgba(0,0,0,0.2),0px 4px 5px 0px rgba(0,0,0,0.14),0px 1px 10px 0px rgba(0,0,0,0.12)
--shadows-50px 3px 5px -1px rgba(0,0,0,0.2),0px 5px 8px 0px rgba(0,0,0,0.14),0px 1px 14px 0px rgba(0,0,0,0.12)
--shadows-60px 3px 5px -1px rgba(0,0,0,0.2),0px 6px 10px 0px rgba(0,0,0,0.14),0px 1px 18px 0px rgba(0,0,0,0.12)
--shadows-70px 4px 5px -2px rgba(0,0,0,0.2),0px 7px 10px 1px rgba(0,0,0,0.14),0px 2px 16px 1px rgba(0,0,0,0.12)
--shadows-80px 5px 5px -3px rgba(0,0,0,0.2),0px 8px 10px 1px rgba(0,0,0,0.14),0px 3px 14px 2px rgba(0,0,0,0.12)
--shadows-90px 5px 6px -3px rgba(0,0,0,0.2),0px 9px 12px 1px rgba(0,0,0,0.14),0px 3px 16px 2px rgba(0,0,0,0.12)
--shadows-100px 6px 6px -3px rgba(0,0,0,0.2),0px 10px 14px 1px rgba(0,0,0,0.14),0px 4px 18px 3px rgba(0,0,0,0.12)
--shadows-110px 6px 7px -4px rgba(0,0,0,0.2),0px 11px 15px 1px rgba(0,0,0,0.14),0px 4px 20px 3px rgba(0,0,0,0.12)
--shadows-120px 7px 8px -4px rgba(0,0,0,0.2),0px 12px 17px 2px rgba(0,0,0,0.14),0px 5px 22px 4px rgba(0,0,0,0.12)
--shadows-130px 7px 8px -4px rgba(0,0,0,0.2),0px 13px 19px 2px rgba(0,0,0,0.14),0px 5px 24px 4px rgba(0,0,0,0.12)
--shadows-140px 7px 9px -4px rgba(0,0,0,0.2),0px 14px 21px 2px rgba(0,0,0,0.14),0px 5px 26px 4px rgba(0,0,0,0.12)
--shadows-150px 8px 9px -5px rgba(0,0,0,0.2),0px 15px 22px 2px rgba(0,0,0,0.14),0px 6px 28px 5px rgba(0,0,0,0.12)
--shadows-160px 8px 10px -5px rgba(0,0,0,0.2),0px 16px 24px 2px rgba(0,0,0,0.14),0px 6px 30px 5px rgba(0,0,0,0.12)
--shadows-170px 8px 11px -5px rgba(0,0,0,0.2),0px 17px 26px 2px rgba(0,0,0,0.14),0px 6px 32px 5px rgba(0,0,0,0.12)
--shadows-180px 9px 11px -5px rgba(0,0,0,0.2),0px 18px 28px 2px rgba(0,0,0,0.14),0px 7px 34px 6px rgba(0,0,0,0.12)
--shadows-190px 9px 12px -6px rgba(0,0,0,0.2),0px 19px 29px 2px rgba(0,0,0,0.14),0px 7px 36px 6px rgba(0,0,0,0.12)
--shadows-200px 10px 13px -6px rgba(0,0,0,0.2),0px 20px 31px 3px rgba(0,0,0,0.14),0px 8px 38px 7px rgba(0,0,0,0.12)
--shadows-210px 10px 13px -6px rgba(0,0,0,0.2),0px 21px 33px 3px rgba(0,0,0,0.14),0px 8px 40px 7px rgba(0,0,0,0.12)
--shadows-220px 10px 14px -6px rgba(0,0,0,0.2),0px 22px 35px 3px rgba(0,0,0,0.14),0px 8px 42px 7px rgba(0,0,0,0.12)
--shadows-230px 11px 14px -7px rgba(0,0,0,0.2),0px 23px 36px 3px rgba(0,0,0,0.14),0px 9px 44px 8px rgba(0,0,0,0.12)
--shadows-240px 11px 15px -7px rgba(0,0,0,0.2),0px 24px 38px 3px rgba(0,0,0,0.14),0px 9px 46px 8px rgba(0,0,0,0.12)
--typography-html-font-size16
--typography-font-family"Roboto", "Helvetica", "Arial", sans-serif
--typography-font-size14
--typography-font-weight-light300
--typography-font-weight-regular400
--typography-font-weight-medium500
--typography-font-weight-bold700
--typography-h1-font-family"Roboto", "Helvetica", "Arial", sans-serif
--typography-h1-font-weight300
--typography-h1-font-size6rem
--typography-h1-line-height1.167
--typography-h1-letter-spacing-0.01562em
--typography-h2-font-family"Roboto", "Helvetica", "Arial", sans-serif
--typography-h2-font-weight300
--typography-h2-font-size3.75rem
--typography-h2-line-height1.2
--typography-h2-letter-spacing-0.00833em
--typography-h3-font-family"Roboto", "Helvetica", "Arial", sans-serif
--typography-h3-font-weight400
--typography-h3-font-size3rem
--typography-h3-line-height1.167
--typography-h3-letter-spacing0em
--typography-h4-font-family"Roboto", "Helvetica", "Arial", sans-serif
--typography-h4-font-weight400
--typography-h4-font-size2.125rem
--typography-h4-line-height1.235
--typography-h4-letter-spacing0.00735em
--typography-h5-font-family"Roboto", "Helvetica", "Arial", sans-serif
--typography-h5-font-weight400
--typography-h5-font-size1.5rem
--typography-h5-line-height1.334
--typography-h5-letter-spacing0em
--typography-h6-font-family"Roboto", "Helvetica", "Arial", sans-serif
--typography-h6-font-weight500
--typography-h6-font-size1.25rem
--typography-h6-line-height1.6
--typography-h6-letter-spacing0.0075em
--typography-subtitle1-font-family"Roboto", "Helvetica", "Arial", sans-serif
--typography-subtitle1-font-weight400
--typography-subtitle1-font-size1rem
--typography-subtitle1-line-height1.75
--typography-subtitle1-letter-spacing0.00938em
--typography-subtitle2-font-family"Roboto", "Helvetica", "Arial", sans-serif
--typography-subtitle2-font-weight500
--typography-subtitle2-font-size0.875rem
--typography-subtitle2-line-height1.57
--typography-subtitle2-letter-spacing0.00714em
--typography-body1-font-family"Roboto", "Helvetica", "Arial", sans-serif
--typography-body1-font-weight400
--typography-body1-font-size1rem
--typography-body1-line-height1.5
--typography-body1-letter-spacing0.00938em
--typography-body2-font-family"Roboto", "Helvetica", "Arial", sans-serif
--typography-body2-font-weight400
--typography-body2-font-size0.875rem
--typography-body2-line-height1.43
--typography-body2-letter-spacing0.01071em
--typography-button-font-family"Roboto", "Helvetica", "Arial", sans-serif
--typography-button-font-weight500
--typography-button-font-size0.875rem
--typography-button-line-height1.75
--typography-button-letter-spacing0.02857em
--typography-button-text-transformuppercase
--typography-caption-font-family"Roboto", "Helvetica", "Arial", sans-serif
--typography-caption-font-weight400
--typography-caption-font-size0.75rem
--typography-caption-line-height1.66
--typography-caption-letter-spacing0.03333em
--typography-overline-font-family"Roboto", "Helvetica", "Arial", sans-serif
--typography-overline-font-weight400
--typography-overline-font-size0.75rem
--typography-overline-line-height2.66
--typography-overline-letter-spacing0.08333em
--typography-overline-text-transformuppercase
--typography-inherit-font-familyinherit
--typography-inherit-font-weightinherit
--typography-inherit-font-sizeinherit
--typography-inherit-line-heightinherit
--typography-inherit-letter-spacinginherit
--transitions-easing-ease-in-outcubic-bezier(0.4, 0, 0.2, 1)
--transitions-easing-ease-outcubic-bezier(0.0, 0, 0.2, 1)
--transitions-easing-ease-incubic-bezier(0.4, 0, 1, 1)
--transitions-easing-sharpcubic-bezier(0.4, 0, 0.6, 1)
--transitions-duration-shortest150
--transitions-duration-shorter200
--transitions-duration-short250
--transitions-duration-standard300
--transitions-duration-complex375
--transitions-duration-entering-screen225
--transitions-duration-leaving-screen195
--z-index-mobile-stepper1000
--z-index-fab1050
--z-index-speed-dial1050
--z-index-app-bar1100
--z-index-drawer1200
--z-index-modal1300
--z-index-snackbar1400
--z-index-tooltip1500
0.0.5

6 months ago

0.0.4

7 months ago

0.0.3

7 months ago

0.0.2

7 months ago

0.0.1

7 months ago