Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function getType(obj) {
- if (obj === null) return 'null';
- if (obj === undefined) return 'undefined';
- return obj.__proto__.constructor.name;
- }
- const color = {}; // table to hold different color related classes and functions
- color.mono = class mono {
- constructor(v) {
- this.v = this.value = v;
- }
- }
- color.rgb = class rgb {
- constructor(r, g, b) {
- this.r = this.red = r;
- this.g = this.green = g;
- this.b = this.blue = b;
- }
- get G() {
- return `Green: '${this.g}'`;
- }
- get GRN = G;
- }
- color.toHex = function toHex(col) {
- console.log(getType(col));
- }
- color.map = class map { // an object to store and create color gradients
- constructor(numRange, colRange, interpFunc) {
- }
- }
- new color.rgb(255, 189, 20).G;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement