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

@poncegl/theme

v0.0.3

Published

A simple React Native library, to keep your color palette organized.

Downloads

6

Readme

@poncegl/theme

A simple React Native library, to keep your color palette organized.

Demo

demo-@poncegl-theme

Installation

  npm i @poncegl/theme
  yarn add @poncegl/theme

Usage/Examples

Wrap your application with the ThemeProvider component. Enable DarkMode Android and iOS support.

import {ThemeProvider} from '@poncegl/theme';

export default function App(): JSX.Element {
  return (
    <ThemeProvider>
      <Main />
    </ThemeProvider>
  );
}

Hook

Access the color palette from any component with the custom hook useTheme.

import {useTheme} from '@poncegl/theme';

export default function Main(): JSX.Element {
  const {colors} = useTheme();

  return (
    <SafeAreaView
      style={[
        styles.content,
        {
          backgroundColor: colors.background,
        },
      ]}>
      <View style={styles.content}>
        <Text
          style={{
            color: colors.text,
          }}>
          Main
        </Text>
      </View>
    </SafeAreaView>
  );
}

Convert hexadecimal to RGBA colors

The function 'hexToRGBA' receives two parameters, a hexadecimal color and a number representing the opacity you want it to have.

The function returns the same color converted to RGBA with the indicated opacity.

import {hexToRGBA} from '@poncegl/theme';

Custom color palette

The ThemeProvider component receives the options prop is an object of type OptionsTheme.

import {hexToRGBA, OptionsTheme, ThemeProvider} from '@poncegl/theme';

import Main from './src/content/main';

const myCustomTheme: OptionsTheme = {
  colors: {
    primary: hexToRGBA('#1e40af', 1),
    accent: hexToRGBA('#1e3a8a', 1),
    text: hexToRGBA('#ffffff', 1),
    background: hexToRGBA('#9ca3af', 1),
    surface: hexToRGBA('#60a5fa', 1),
    info: hexToRGBA('#1d4ed8', 1),
    error: hexToRGBA('#dc2626', 1),
    success: hexToRGBA('#4ade80', 1),
    onSurface: hexToRGBA('#ffffff', 1),
    white: hexToRGBA('#ffffff', 1),
    black: hexToRGBA('#000000', 1),
    disabled: hexToRGBA('#1e3a8a', 0.5),
    placeholder: hexToRGBA('#ffffff', 0.7),
    backdrop: hexToRGBA('#000000', 0.5),
    notification: hexToRGBA('#000000', 0.5),
    tooltip: hexToRGBA('#f97316', 1),
  },v
};

export default function App(): JSX.Element {
  return (
    <ThemeProvider options={myCustomTheme}>
      <Main />
    </ThemeProvider>
  );
}

ColorsTheme

property: the name inside the object colors initial value: is the initial color of the available colors rgba: is the color created via hexToRGBA type: is the data type, ColorValue comes from React Native

| property | initial value | rgba | sample | type | |--------------|--------------|------------------------|--------------------------------------------------------------|------------| | primary | blue[800] | rgba(30, 64, 175, 1) | #1e40af | ColorValue | | accent | blue[900] | rgba(30, 58, 138, 1) | #1e3a8a | ColorValue | | text | white | rgba(255, 255, 255, 1) | #ffffff | ColorValue | | background | gray[400] | rgba(156, 163, 175, 1) | #9ca3af | ColorValue | | surface | blue[400] | rgba(96, 165, 250, 1) | #60a5fa | ColorValue | | info | blue[700] | rgba(29, 78, 216, 1) | #1d4ed8 | ColorValue | | error | red[600] | rgba(220, 38, 38, 1) | #dc2626 | ColorValue | | success | green[400] | rgba(74, 222, 128, 1) | #4ade80 | ColorValue | | onSurface | white | rgba(255, 255, 255, 1) | #ffffff | ColorValue | | white | white | rgba(255, 255, 255, 1) | #ffffff | ColorValue | | black | black | rgba(0, 0, 0, 1) | #000000 | ColorValue | | disabled | blue[900] | rgba(30, 58, 138, 0.5) | #1e3b8a80 | ColorValue | | placeholder | white | rgba(255, 255, 255, 1) | #ffffffb3 | ColorValue | | backdrop | black | rgba(0, 0, 0, 1) | #00000080 | ColorValue | | notification | black | rgba(0, 0, 0, 1) | #00000080 | ColorValue | | tooltip | orange[500] | rgba(249, 115, 22, 1) | #f97316 | ColorValue |

Colors

More colors available

import {blue, green, pink} from '@poncegl/theme';

Authors