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

color-script

v1.0.0

Published

Programming language to operate with addition, substraction, multiplication and division using colors and numbers.

Downloads

3

Readme

color-script

Programming language to operate with addition, substraction, multiplication and division using colors and numbers.

Online version

You can go and play directly to the online version:

Installation

npm install --save color-script

Usage

const new_color_1 = require("color-script").parser.parse("#000000 + 2");
const new_color_2 = require("color-script").Color.create("#000000");

The Color API

The Color API is a embedded resource of the color-manipulator project. Use it at your own convenience.

The Parser API

The Parser API is the language interpreter. It will read any text as a color-script script and will return the color of each operation result in an array.

The syntax of the Parser API

The color-script parser follows a simple syntax where:

  • colors are like numbers
  • colors can be represented by rgb format, like rgb(255, 0, 255)
  • colors can be represented by hex format, like #FF00FF

The color-script parser acts as a calculator of multiple color or number operations.

Each operation is separated by a new line.

The allowed operations are: addition +, substraction -, multiplication * and division /.

Parenthesys are allowed too.

That is all.

Examples

This is a pallette of grays.

#111111 * 0
#111111 * 1
#111111 * 2
#111111 * 3
#111111 * 4
#111111 * 5
#111111 * 6
#111111 * 7
#111111 * 8
#111111 * 9
#111111 * 10
#111111 * 11
#111111 * 12
#111111 * 13
#111111 * 14
#111111 * 15

And so, with addition, substraction, and division, also between colors, and parenthesys allowed.

The colors multiplications happens like: red by red, green by green, blue by blue.

The división happens the same way: red by red, green by green, blue by blue.

The online version extra features

The online version also allows EJS templates syntax, so you can create variables and use them all along the script to not be repeating the same numbers, and centalize a value, and change it faster, all that. The color-script parser, though, does not allow creating variables by itself. The reason is too much complexity and time in not-so-different result of adding a layer of EJS templates.

So, you can enter scripts like this one:

<% const color1 = "#201030"; %>
<%-color1%> * 0
<%-color1%> * 1
<%-color1%> * 2
<%-color1%> * 3
<%-color1%> * 4
<%-color1%> * 5
<%-color1%> * 6
<%-color1%> * 7
<%-color1%> * 8
<%-color1%> * 9
<%-color1%> * 10
<%-color1%> * 11
<%-color1%> * 12
<%-color1%> * 13
<%-color1%> * 14
<%-color1%> * 15

Here, as you see, you don't need to change the value in 20 places, but in 1 and only. This feature, as said, is only added to the ColorScript UI Online Version.