{"id":16982062,"url":"https://github.com/tenphi/node-color","last_synced_at":"2026-05-06T12:36:41.906Z","repository":{"id":2439785,"uuid":"3409703","full_name":"tenphi/node-color","owner":"tenphi","description":"NodeJS module for CSS color manipulations. The project is DEPRECATED.","archived":false,"fork":false,"pushed_at":"2012-02-11T07:05:13.000Z","size":104,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-26T18:15:46.323Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tenphi.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-02-10T18:18:34.000Z","updated_at":"2021-06-14T03:52:24.000Z","dependencies_parsed_at":"2022-09-17T21:53:32.455Z","dependency_job_id":null,"html_url":"https://github.com/tenphi/node-color","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tenphi%2Fnode-color","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tenphi%2Fnode-color/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tenphi%2Fnode-color/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tenphi%2Fnode-color/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tenphi","download_url":"https://codeload.github.com/tenphi/node-color/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244885515,"owners_count":20526293,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-14T02:07:12.580Z","updated_at":"2026-05-06T12:36:41.865Z","avatar_url":"https://github.com/tenphi.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"With this module you can simple manipulate color`s parameters.\r\n\r\nJust create one:\r\n\r\n```javascript\r\nvar color = require('color');\r\n\r\ncolor('#39f');\r\ncolor([51, 153, 255]); // rgb\r\ncolor([114, .5, .5], 'hsl'); // hsl\r\n```\r\n\r\nYou can also set additional parameter for opacity:\r\n\r\n```javascript\r\nvar clr = color([51, 153, 255, .5]); // 50% opacity\r\n```\r\n\r\nNow you can use LESS-like API for change color parameters:\r\n\r\n```javascript\r\nclr.lighten(.1); // return a color which is 10% *lighter* than base color\r\nclr.darken(.1); // return a color which is 10% *darker* than base color\r\n\r\nclr.saturate(.1);    // return a color 10% *more* saturated than base color\r\nclr.desaturate(.1);  // return a color 10% *less* saturated than base color\r\n\r\nclr.fadein(.1);      // return a color 10% *less* transparent than base color\r\nclr.fadeout(.1);     // return a color 10% *more* transparent than base color\r\nclr.fade(.5);        // return base color with 50% transparency\r\n\r\nclr.spin(10);         // return a color with a 10 degree larger in hue than base color\r\nclr.spin(-10);        // return a color with a 10 degree smaller hue than base color\r\n\r\nclr.mix(clr2);    // return a mix of base color and other color\r\n```\r\n\r\nNow, you can fetch your color:\r\n\r\n```javascript\r\ncolor('#39f').toString(); // \"#3399ff\"\r\ncolor('#39f') + ''; // \"#3399ff\"\r\ncolor('#39f').hex(); // \"#3399ff\"\r\ncolor('#39f').rgb(); // rgb(51, 153, 255)\r\ncolor([153, 153, 255, .5]); // rgba(51, 153, 255, 0.5)\r\n```\r\n\r\nGet/set absolute parameters of color:\r\n\r\n```javascript\r\nclr.lightness(.5).lightness(); // .5\r\nclr.saturation(.5).saturation(); // .5\r\nclr.hue(180).hue(); // 180\r\nclr.fade(.5).fade(); // .5\r\n```\r\n\r\nIt's not all! Also you have a really nice function that can calculate and set real (visible) lightness of your color. This value between 0 to 360. Check this out:\r\n\r\n```javascript\r\ncolor('#39f').luminance(); // 144.8760297633808\r\ncolor('#39f').luminance(200).hex(); // \"#9fcfff\"\r\n```\r\n\r\nIt can be very useful!\r\nLuminance calculating by following formula: `Math.sqrt(red*red*.241 + green*green*.691+blue*blue*.068);`\r\n\r\nColor module can store your colors. For example, this is some Twitter Bootstrap colors that defined by default:\r\n\r\n```javascript\r\ncolor({\r\n    black: '#000',\r\n    grayDarker: '#222',\r\n    grayDark: '#333',\r\n    gray: '#555',\r\n    grayLight: '#999',\r\n    grayLighter: '#eee',\r\n    white: '#fff',\r\n\r\n    blue: '#049cdb',\r\n    green: '#46a546',\r\n    red: '#9d261d',\r\n    yellow: '#ffc40d',\r\n    orange: '#f89406',\r\n    pink: '#c3325f',\r\n    purple: '#7a43b6'\r\n});\r\n\r\n_.color('myColor', '#303639'); /* store one color */\r\n```\r\n\r\nAnd then select them by their names:\r\n\r\n```javascript\r\ncolor('purple').lighten(.1).hex(); // \"#8752bf\"\r\n```\r\n\r\nIf you have some ideas how improve this module you can send them to my email: tenphi@gmail.com\r\n\r\nEnjoy!","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftenphi%2Fnode-color","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftenphi%2Fnode-color","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftenphi%2Fnode-color/lists"}