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

ralative

v1.0.5

Published

A node library that provides all official RAL color numbers, names and hex values. It can generate analogous and split complementary colors from a base color

Downloads

23

Readme

The RALative node.js module

I've written this module in order to allow easy use of the RAL color wheel in JS solutions and specifically in the ProtoNFT Avatar Generator my team is building for the NFT Hack Hackathon and the Women in Blockchain community.

Some of the code here has been adpated from a Flutter app my team has written a few months ago, named ColorMatch. It had some bugs in it actually, so I'm glad I got the chance to rebuild and extend it in JS.

Changelog

RALative 1.0.5

  • Trying to export everyting, hoping it would work better with React

RALative 1.0.4

  • Trying to using the revealing module pattern. Hoping this would make it work better universally (in React as well as node.js)
  • removed direct references to value array and using get methods instead

RALative 1.0.3

  • exporting ralName, ralHexCode and ralNumber for direct referencing in scripts

RALative 1.0.2

  • Added an example folder
  • Fixed minor naming bugs and other exports problems
  • All functions manually tested and seem to be working
  • No safeguards yet, but fully functional

RALative 1.0.1

  • Added getRalNumbersArray()
  • Added getRalHexCodeArray()
  • Added getRalNamesArray()

Add the library to your solution


$ npm install ralative --save

Import in your JS


const ralative = require("ralative");

Available functions

getRalNumbersArray()

Returns an array of all RAL numbers in the format "RAL XXXX"

For example,


const RALNUMBERARRAY = ralative.getRalNumbersArray();

getRalHexCodeArray()

Returns an array of all RAL hex codes in the format "#123456"

For example,


const RALHEXARRAY = ralative.getRalHexCodeArray();

getRalNamesArray()

Returns an array of all RAL hex codes in the format "Green beige"

For example,


const COLORNAMEARRAY = ralative.getRalNamesArray();

getRalFromHex(hex)

This function expects a hex code from the offical RAL list as input and will return the RAL number in the format "RAL XXXX", where XXXX is the RAL number

For example


const RAL1000 = ralative.getRalFromHex("#CCC58F");

getHexFromRalNumber(ral)

This function expects an official RAL number in the format "RAL XXXX" as input and will return the corresponding hex value

For example,


const hexCCC58F = ralative.getHexFromRalNumber("RAL 1000");

getRalNamefromRalNumber(ral)

This function expects an official RAL number in the format "RAL XXXX" as input and will return the corresponding official color name in English

For example,


const GREEN_BEIGE = ralative.getRalNamefromRalNumber("RAL 1000");

getHarmoniousRalNumbers(ral)

This function expects an official RAL number in the format "RAL XXXX" as input and will return an Array with two adjacent RAL numbers in it

For example,


//returns ["RAL 1000", "RAL 1002" ]
const ANALOGOUS1001 = ralative.getHarmoniousRalNumbers("RAL 1001");

From here you could easily get the hex values for each of the RALs retured from the function by doing


let firstAnalogousHex = ralative.getHexFromRal(ANALOGOUS1001[0]);

let secondAnalogousHex = ralative.getHexFromRal(ANALOGOUS1001[1]);

getVibrantRalNumbers(ral)

This function expects an official RAL number in the format "RAL XXXX" as input and will return an Array with two split complementary RAL numbers in it

For example,


//returns ["RAL 1020", "RAL 8024" ]
const VIBRANT6001 = ralative.getVibrantRalNumbers("RAL 6001");

From here you could easily get the hex values for each of the RALs retured from the function by doing


let firstVibranHex = ralative.getHexFromRal(VIBRANT6001[0]);

let secondVibrantHex = ralative.getHexFromRal(VIBRANT6001[1]);

getColorHexObject()

This function will return an object with color names and their corresponding hex values

For example,


//returns an object with all color names and their hex values
const COLORHEXOBJ = ralative.getColorHexObject();