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

@audentio/stuff

v1.4.1

Published

React component library by Audentio

Downloads

177

Readme

Theming

1. Creating the theme object

Things to note:

  1. Any key in the default theme can be overridden, and the default theme can be imported to be extended.
  2. Colors will be merged in by default, and therefore does not require extending the default theme.
  3. Brand colors, as well as a few others, are objects that contain multiple shades of the base color. When passing a new brand color, they must be sent within the generateShades() function.
  4. For more control of the theme, individual components can also be re-styled.
import { generateShades, theme as defaultTheme, ThemeType } from '@audentio/stuff/theme';

export const theme: ThemeType = {
    ...defaultTheme,
    colors: {
        light: {
            //  light color overrides - see below
        },
        dark: {
            //  dark color overrides - see below
        },
    },
    fonts: {
        ...defaultTheme.fonts,
        //  heading: 'Poppins',
    },
    styles: {
        // override component styles here
    },
};

List of theme color variables to override:

  • Brand colors : use generateShades(color)
    • primary - main brand color
    • secondary - complementary brand color
  • Typography
    • titleText - used for headings
    • bodyText - default color for text
    • faintText - used for subtle text
    • disabled - disabled inputs, buttons, etc
  • Page layout
    • cardBg - card background,
    • navBg - navigation header background
    • popoverBg - popover menu background
    • pageBg - "main" canvas page background
    • altBg - used for alternating sections, table rows, etc, background
    • canvasBg - canvas background,
    • border - used for borders and dividers
    • overlay - used along with modals, overlay canvases
  • Components
    • button - used for primary button background, as well as secondary & tertiary button text color
    • buttonText - used for primary button text
    • secondaryButton - secondary button (shadowed) background. defaults to transparent
    • tertiaryButton - tertiary button (outlined) background. defaults to transparent
    • tableHeaderBg - used for table header, table footer, and expanded row backgrounds
    • track - background for slider, switches, progress ocmponents
    • thumb - custom scrollbar thumb background - used for tabs and table
    • tooltip - tooltip background
    • selectControlHover - background for a hovered menu item within the select menu
    • inputHover - input background when hovered
    • inputFocus - input border color when focused
    • inputBg - 'filled' variant input background
    • progress - default background for progress component indicator
    • activeLink - color when a link is active

2. Using the theme object

Wrap your project in the ThemeProvider HOC and pass in your newly created theme object.

Optionally, a default color mode can be passed as well, defining the default color scheme used. Defaults to 'light'.

import { ThemeProvider } from '@audentio/stuff/ThemeProvider';

return (
    <ThemeProvider theme={theme} defaultMode="dark">
        <AppShell {...props} />
    </ThemeProvider>
);

3. (Optional) Switching color modes

To toggle between 'light' and 'dark' modes, or a custom mode, call the useColorMode() hook;

const { mode, setMode } = useColorMode();

return (
    <Button
        onClick={() => {
            setMode(mode === 'light' ? 'dark' : 'light');
        }}
    >
        <Text> Switch to {mode === 'light' ? 'dark' : 'light'} mode</Text>
    </Button>
);

4. (Optional) Overriding a component's style

This allows finer control over how components are styled. Within the styles key of the theme object, add each component. Component's default's styles can be imported if not all styles need to be changed.

For example, to change the style of <Button />.

import { buttonStyle } from '@audentio/stuff/Button/styles';
export const theme: ThemeType = {
    colors: {
        //  ...
    },
    styles: {
        button: (props, theme) => {
            const btnStyle = buttonStyle(props, theme);
            return {
                ...btnStyle,
                style: {
                    ...btnStyle.style,
                    textTransform: 'uppercase',
                },
            };
        },
        //  ... override component styles
    },
};

Resources

Spec / Planning doc

https://docs.google.com/document/d/1Ouq6UIUeEy9MNb__dRPS2Gur_73rtaYbEXcdZD0cyyY/edit#heading=h.2k18qvnpjtn5

Coding standard

https://docs.google.com/document/d/1MyEwOv-cMLiPwGB7xACWe1BrcrPf4kJYwmCyy1Xjuz0/edit

JS resources

https://docs.google.com/document/d/1-Hx6xVAyWfU5cdJ5T3hrOgk1Xq8pmpGlq-2JNDiV3HI/edit