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

base9-builder-node

v0.1.5

Published

For more info about base9 in general, go to [here](https://github.com/base9-theme/base9)

Downloads

3

Readme

Official Base9 Builder

For more info about base9 in general, go to here

CLI

Help page:

$ base9-builder help
base9 builder CLI

USAGE:
    base9-builder <SUBCOMMAND>

OPTIONS:
    -h, --help    Print help information

SUBCOMMANDS:
    help       Print this message or the help of the given subcommand(s)
    preview    prints a table of all generated colors to preview
    render     renders theme template

Example commands:

PALETTE="282936-E9E9F4-FF5555-FFB86C-F1FA8C-50FA7B-8BE9FD-BD93F9-FF79C6"

# preivew default palette in stdout
base9-builder preview -

# render mustache in stdout
base9-builder render $PALETTE template.mustache

# render mustache to file
base9-builder render $PALETTE template.mustache out.txt

NPM/WASM/Typescript

// Only required for browser version
import init from 'base9-builder';
await init();


import * as base9 from 'base9-builder';
const palette = "282936-E9E9F4-FF5555-FFB86C-F1FA8C-50FA7B-8BE9FD-BD93F9-FF79C6"

const colors = base9.getColors(palette);
console.log(colors.red.p100); // #ff5555

const data = base9.getData(palette);
console.log(data.foreground.p100.hex) // e9e9f4

const template = "foreground: {{foreground.p100.hex}}";
const rendered = base9.renderString(palette, template);
console.log(rendered); // foreground: e9e9f4

Rust crate

use base9_builder::{Palette, to_mustache_data};
use mustache::compile_str;

fn main() {
    let palette_str = "282936-E9E9F4-FF5555-FFB86C-F1FA8C-50FA7B-8BE9FD-BD93F9-FF79C6";
    let template_str = "primary: {{primary.p100.hex}}";
    let palette = Palette::from_str(palette_str).unwrap();
    let data = to_mustache_data(palette);
    let template = compile_str(&template_str).unwrap();

    template.render_data(&mut io::stdout(), &data).unwrap();
    // prints: "primary: ff5555"
}

Unstable features:

Future updates may break these features. Do not rely on them.

Randomly Generate Palette

Instead of specifying all 9 colors, you can only specify a subset of them and let the builder randomly generate the rest colors.

Use _ for a single unspecified color and ? for many unspecified color. ? can only be used at the end.

Examples:

  • ?: generate all 9 colors.
  • _-_-_-_-_-_-_-_-_: generate all 9 colors.
  • _-_-?: generate all 9 colors.
  • _-FFFFFF-?: foreground is #FFFFFF and generate the rest.
  • 000000-_-00FF00-?: background is #000000, primary color is #00FF00, generate the rest.

Get all Mustache Variables in JSON

For CLI:

PALETTE="282936-E9E9F4-FF5555-FFB86C-F1FA8C-50FA7B-8BE9FD-BD93F9-FF79C6"
base9-builder list-variables $PALETTE # prints all variables in json 

For rust crate:

use base9_builder::{Palette, to_data};
fn main() {
    let palette_str = "282936-E9E9F4-FF5555-FFB86C-F1FA8C-50FA7B-8BE9FD-BD93F9-FF79C6";
    let palette = Palette::from_str(palette_str).unwrap();
    let data = to_data(palette); // returns serde_json::Value
}