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

@taktikal/branding

v2.1.1

Published

## What is this package for?

Downloads

2

Readme

@taktikal/branding

What is this package for?

Taktikal does a lot of white-label "branded UI". Companies provide their primary color, and we generate a color system from that primary color which our UI components make use of.

This package is responsible for generating themes based on primary colors, and passing those themes on to UI components. It also provides Taktikal's own theme, for use within non-branded UI.

Getting started

This package requires @taktikal/stylesheets as a peer dependency, so install it first.

npm i -S @taktikal/stylesheets@latest

This package extends @taktikal/stylesheet's CSSVariables interface with the theme variables from our color system. It does that via cssVariables.d.ts. You will need to reference cssVariables.d.ts in your project's tsconfig.json.

{
  "compilerOptions": {
    "types": [
      "@taktikal/branding/cssVariables"
      // ...
    ]
  }
}

If your project wants the default theme to be Taktikal's theme, you can provide it via TaktikalThemeStylesheetContext. If your project uses Next.js, add this to the root of your custom App (_app.tsx).

return (
  <TaktikalThemeStylesheetContext>
    ...
  </TaktikalThemeStylesheetContext>
);

You can provide a branded theme with BrandedThemeStylesheetContext.

return (
  <BrandedThemeStylesheetContext colorPrimary={colorPrimary}>
    ...
  </BrandedThemeStylesheetContext>
);

It takes a single required prop of colorPrimary which should be a hex color string.

It also accepts an optional apply boolean prop. By default it's true, but if set to false the TaktikalThemeStylesheetContext will be used instead. This is just a convenience for the case where you have a "use branded UI" boolean.

return (
  <BrandedThemeStylesheetContext
    colorPrimary={colorPrimary}
    apply={shouldUseBrandedUI}
  >
    ...
  </BrandedThemeStylesheetContext>
);

Usage

This package just provides values that @taktikal/stylesheets can make use of. You see how @taktikal/stylesheets is used here.

This package extends CSSVariables like so:

interface CSSVariables {
  dominant500: string;
  unsafe_primary: string;

  black500: string;

  light500: string;
  light700: string;
  light800: string;
  light900: string;

  medium100: string;
  medium200: string;
  medium300: string;
  medium400: string;
  medium500: string;
  medium600: string;
  medium700: string;
  medium800: string;

  dark100: string;
  dark200: string;
  dark300: string;
  dark400: string;

  /**
   * Number from 0-100.
   *
   * 0 is black, 100 is white.
   */
  primaryBrightness: number;
  isPrimaryLight: boolean;
  isBranded: boolean;
}