Skip to content

Latest commit

 

History

History
73 lines (56 loc) · 1.6 KB

README.md

File metadata and controls

73 lines (56 loc) · 1.6 KB

@yungerdev/theme

A Mantine theme object based on the Nord palette. (LightDark)

Installation

# With yarn
yarn add @yungerdev/theme
# With npm
npm install @yungerdev/theme

Usage

Basic usage

import { MantineProvider } from "@mantine/core";
import { theme } from "@yungerdev/theme";

function Demo() {
  return (
    <MantineProvider theme={theme} withGlobalStyles withNormalizeCSS>
      <App />
    </MantineProvider>
  );
}

Additional styles can be provided under the MantineProvider

import { MantineProvider } from "@mantine/core";
import { theme, Scrollbar, TextSelection } from "@yungerdev/theme";

function Demo() {
  return (
    <MantineProvider theme={theme} withGlobalStyles withNormalizeCSS>
      <Scrollbar />
      <TextSelection />
      <App />
    </MantineProvider>
  );
}

With a custom colorScheme and ColorSchemeProvider

import { useState } from "react";
import { MantineProvider, ColorSchemeProvider, ColorScheme } from "@mantine/core";
import { theme } from "@yungerdev/theme";

function Demo() {
  const [colorScheme, setColorScheme] = useState<ColorScheme>("light");

  const toggleColorScheme = (value?: ColorScheme) =>
    setColorScheme(value || (colorScheme === "dark" ? "light" : "dark"));

  return (
    <ColorSchemeProvider colorScheme={colorScheme} toggleColorScheme={toggleColorScheme}>
      <MantineProvider theme={{ ...theme, colorScheme }} withGlobalStyles withNormalizeCSS>
        <App />
      </MantineProvider>
    </ColorSchemeProvider>
  );
}

License

MIT