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

@gdsc-yonsei/color

v1.0.0

Published

Color system for GDSC Yonsei & other chapters

Downloads

15

Readme

@gdsc-yonsei/color package

Semantic color system package for GDSC Yonsei chapter system.

For additional infos, refer to GDSC Yonsei chapter color system Figma page.

Getting Started

This package can be installed by using package manager.

We recommend using 'yarn' package manager.

# yarn (most recommmended)
yarn add @gdsc-yonsei/color

# npm
npm install --save @gdsc-yonsei/color

Usage

1. Semantic Colors 🎨

import { content, background } from '@gdsc-yonsei/color';

const ExampleComponent = () => {
   return (
      <main style={{ backgroundColor: background.common.primary.blue }}>
        <span style={{ color: content.tint.blue.a3.blue }}>
      </main>
   )
}

Semantic colors are color tokens which named after what they represents.

Colors are not exported itself, rather exported as a collection of usage.

We recommend using semantic colors using hooks(useSemanticColor) or css variables.

useSemanticColor hooks provides colorset of components according to predefined theme or custom theme. For more information, refer to the docs of useSemanticColor hooks.

If you wish to access color tokens by css variables, predefined css global variables are injected from <GlobalStylesProvider />. Childrens of <GlobalStylesProvider /> can access to css global variables by '--' prefix. Refer to example below for detailed usage.

🚨 Direct usage of color tokens is not recommended as each color tokens are automatically set by context. Import it when original color token string is required in particual situations.

import { useSemanticColor, ColorTheme } from '@gdsc-yonsei/color';

const ExampleComponent = () => {
   // get background color token object according to theme defined in <GlobalStylesProvider />
   const { background } = useSemanticColor();

   // for color token of particular color theme.
   const { button } = useSemanticColor(ColorTheme.Green); 

   return (
      <main style={{ backgroundColor: background.common.primary }}>
        <button style={{ backgroundColor: button.primary.background.common }}>
      </main>
   )
};
// if you are using styled-components or css
import styled from 'styled-components';

const Main = styled.main`
   // ...
   background-color: var(--background-common-primary);
   color: var(--background)
`;

const Button = styled.button`
   //...
   background-color: var(--button-primary-background-common);

   &:hover {
      background-color: var(--button-primary-background-active);
   }

   &:active {
      background-color: var(--button-primary-background-pressed);
   }
`

const ExampleComponent2 = () => {
   return (
      <Main>
         <Button />
         {...}
      </Main>
   )
};

| Name | Description | | :------------- | :--------------------------------------------------------- | | content | Common colors for components like text or icon. | | background | Defines background colors. | | button | Defines button colors. | | textButton | Defines text button colors. | | border | Defines border colors. | | line | Defines line colors | | tag | Defines tag colors. | | tabBar | Defines tab bar colors. |

2. GlobalStylesProvider & Theme 🌍

GlobalStylesProvider plays as a role of setting overall theme context and injecting css variables at the top of DOM tree.

Changing theme will automatically change all semantic color tokens. (No need to worry about changing colors according to themes :P )

Children components or elements which desire to use semantic color tokens should be under GlobalStylesProvider, so it is highly recommended to wrap overall application with <GlobalStylesProvider /> at the uppermost component.


Predefined theme can be set by importing 'ColorTheme' enum. ColorTheme enum has four members, Blue, Green, Yellow, and Red. If unset, default theme is Blue(ColorTheme.Blue).

Details of each color theme can be found in Figma page.

import { GlobalStylesProvider } from '@gdsc-yonsei/color';

const MyGorgeousApp = () => {
   // if not given, default theme is set as blue(ColorTheme.Blue).
   return (
      <GlobalStylesProvider>
         {...}
      </GlobalStylesProvider>
   )
};
import { GlobalStylesProvider, ColorTheme } from '@gdsc-yonsei/color';

const MyGorgeousGreenApp = () => {
   // Red theme is set!
   return (
      <GlobalStylesProvider theme={ColorTheme.Red}>
         {...}
      </GlobalStylesProvider>
   )
};

3. Utility Functions 🔧

GDSC Yonsei semantic color system providers color utilities for free transformation of semantic colors.

getHexcode

declare function getHexcode(string, number): string;

getHexcode converts color & transparency into color hexcode. When passing color string and its transparency, the function returns the corresponding hexcode.

getRgba

declare function getRgba(string, number): string;

getRgba provides the same result as getHexcode functions, but returns color code as RGBA format(rgba(R, G, B, A)).

Build & Publish 🛠️

@gdsc-yonsei/color and gdsc-ys-web monorepo uses yarn berry as a package manager.

Before build, make sure all dependencies are ready by installing all packages.

yarn

For ready-to-use build command, we recommend using command as follows at the root folder of monorepo package.

yarn color ready

If build command is successfully executed, use publish command as follows at the root folder of monorepo package.

gdsc-ys-web monorepo uses lerna-lite for manaing & publishing packages.

yarn lerna publish

Bug Report 🐛 & Contribution 🤝

Looking for contribution and bug reports, feel free to leave any issues of PRs to this repository!