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.
- Trying to export everyting, hoping it would work better with React
- 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
- exporting ralName, ralHexCode and ralNumber for direct referencing in scripts
- 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
- Added getRalNumbersArray()
- Added getRalHexCodeArray()
- Added getRalNamesArray()
$ npm install ralative --save
const ralative = require("ralative");
Returns an array of all RAL numbers in the format "RAL XXXX"
For example,
const RALNUMBERARRAY = ralative.getRalNumbersArray();
Returns an array of all RAL hex codes in the format "#123456"
For example,
const RALHEXARRAY = ralative.getRalHexCodeArray();
Returns an array of all RAL hex codes in the format "Green beige"
For example,
const COLORNAMEARRAY = ralative.getRalNamesArray();
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");
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");
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");
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]);
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]);
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();