Berry React
v4.0.0
v4.0.0
  • Introduction
  • Package
  • Getting Started
    • Pre-requisites
    • Quick Start
    • Mock backend
    • Deployment
    • Licensing
  • Setup
    • Seed
    • To Existing Project
  • Folder Structure
  • State Management
  • Multi Language
  • Authentication
    • Firebase
    • Auth0
    • AWS Cognito
    • Supabase
  • API Calls
  • Routing
    • New Menu
    • Login as First Page
    • Skip Login
    • Render Menu from the backend
    • Remove menu render via backend
  • Theme
    • Configuration
    • Presets
    • Style
      • Color
      • Typography
      • Overrides
      • Shadows
    • Layouts
    • Logo
  • How to
    • Remove eslint
    • Remove prettier
  • Components
    • Avatar
    • AnimateButton
    • Accordion
    • Breadcrumbs
    • Chip
    • ImageList
    • MainCard
    • Transitions
    • SubCard
  • Dependencies
  • Support
    • Roadmap
    • Changelog
    • FAQ
  • Berry Eco System
Powered by GitBook
On this page

Was this helpful?

  1. Theme
  2. Style

Color

Customize Theme Colors

To change the color of the theme, you can either apply color directly to src\theme\palette.tsx or define a new variable in src\assets\scss\_themes-vars.module.scss and replace it in palette.tsx

For instance, if you want to change the color that theme.palette.primary.light is being used in a theme, then update the following in src\themes\palette.tsx

import defaultColor from 'assets/scss/_themes-vars.module.scss';

/**
 * Color intention that you want to used in your theme
 */
export default function Palette(mode: ThemeMode, presetColor: PresetColor) {
  let colors: ColorProps;
  switch (presetColor) {
    case 'theme1':
      colors = theme1;
        ...
        ...
    };
    
  return createTheme({
    palette: {
      mode,
      common: {
        black: colors.darkPaper
      },
      ...
    }
  });
}
import defaultColor from 'assets/scss/_themes-vars.module.scss';

/**
 * Color intention that you want to used in your theme
 */
export default function Palette(mode, presetColor) {
  let colors: ColorProps;
  switch (presetColor) {
    case 'theme1':
      colors = theme1;
        ...
        ...
    };
    
  return createTheme({
    palette: {
      mode,
      common: {
        black: colors.darkPaper
      },
      ...
    }
  });
}
src/themes/palette.tsx
import defaultColor from 'assets/scss/_themes-vars.module.scss';

/**
 * Color intention that you want to used in your theme
 */
export default function Palette(mode: ThemeMode, presetColor: PresetColor) {
  let colors: ColorProps;
  switch (presetColor) {
    case 'theme1':
      colors = theme1;
        ...
        ...
    };
    
  return createTheme({
    palette: {
      mode,
      common: {
        black: colors.darkPaper
      },
      ...
    }
  });
}

Last updated 3 months ago

Was this helpful?