From ad82416aff898c2819f94ba15ceab844bd814398 Mon Sep 17 00:00:00 2001 From: Cameron Bernhardt Date: Wed, 9 Aug 2017 15:36:58 -0400 Subject: [PATCH 01/11] Add getValidThreadColors --- DOCS.md | 24 ++++++++++++++++++++++++ index.js | 1 + src/getValidThreadColors.js | 8 ++++++++ 3 files changed, 33 insertions(+) create mode 100644 src/getValidThreadColors.js diff --git a/DOCS.md b/DOCS.md index d4613fed..f3c6f32d 100644 --- a/DOCS.md +++ b/DOCS.md @@ -22,6 +22,7 @@ * [`api.getThreadPictures`](#getThreadPictures) * [`api.getUserID`](#getUserID) * [`api.getUserInfo`](#getUserInfo) +* [`api.getValidThreadColors`](#getValidThreadColors) * [`api.handleMessageRequest`](#handleMessageRequest) * [`api.listen`](#listen) * [`api.logout`](#logout) @@ -715,6 +716,29 @@ login({appState: JSON.parse(fs.readFileSync('appstate.json', 'utf8'))}, (err, ap --------------------------------------- + +### api.getValidThreadColors() + +Returns a list of all hexadecimal values currently accepted by [`api.changeThreadColor`](#changeThreadColor). These colors, listed below, are the ones present in the palette UI used for selecting thread colors on the Messenger client. Due to Facebook backend changes, the thread color can no longer be set to an arbitrary hex value. + +- `null` (default blue) +- `#44BEC7` +- `#FFC300` +- `#FA3C4C` +- `#D696BB` +- `#6699CC` +- `#13CF13` +- `#FF7E29` +- `#E68585` +- `#7646FF` +- `#20CEF5` +- `#67B868` +- `#D4A88C` +- `#FF5CA1` +- `#A695C7` + +--------------------------------------- + ### api.handleMessageRequest(threadID, accept[, callback]) diff --git a/index.js b/index.js index 845b6e51..fc0b0292 100644 --- a/index.js +++ b/index.js @@ -93,6 +93,7 @@ function buildAPI(globalOptions, html, jar) { 'getThreadPictures', 'getUserID', 'getUserInfo', + 'getValidThreadColors', 'handleMessageRequest', 'listen', 'logout', diff --git a/src/getValidThreadColors.js b/src/getValidThreadColors.js new file mode 100644 index 00000000..18df7922 --- /dev/null +++ b/src/getValidThreadColors.js @@ -0,0 +1,8 @@ +"use strict"; + +module.exports = function(defaultFuncs, api, ctx) { + return function getValidThreadColors() { + // Currently the only colors that can be passed to changeThreadColor(); may change if Facebook adds more + return ["#44bec7", "#ffc300", "#fa3c4c", "#d696bb", "#6699cc", "#13cf13", "#ff7e29", "#e68585", "#7646ff", "#20cef5", "#67b868", "#d4a88c", "#ff5ca1", "#a695c"]; + }; +}; From 0ee6e7f5b221c95d75a748534ede3311a1dd11ef Mon Sep 17 00:00:00 2001 From: Cameron Bernhardt Date: Wed, 9 Aug 2017 15:39:18 -0400 Subject: [PATCH 02/11] Terminology fix --- DOCS.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DOCS.md b/DOCS.md index f3c6f32d..1a6b0f0a 100644 --- a/DOCS.md +++ b/DOCS.md @@ -719,7 +719,7 @@ login({appState: JSON.parse(fs.readFileSync('appstate.json', 'utf8'))}, (err, ap ### api.getValidThreadColors() -Returns a list of all hexadecimal values currently accepted by [`api.changeThreadColor`](#changeThreadColor). These colors, listed below, are the ones present in the palette UI used for selecting thread colors on the Messenger client. Due to Facebook backend changes, the thread color can no longer be set to an arbitrary hex value. +Returns an array of all hexadecimal values currently accepted by [`api.changeThreadColor`](#changeThreadColor). These colors, listed below, are the ones present in the palette UI used for selecting thread colors on the Messenger client. Due to Facebook backend changes, the thread color can no longer be set to an arbitrary hex value. - `null` (default blue) - `#44BEC7` From 5297ed80e86f8dc5e45e9df2e5e226ba88d31758 Mon Sep 17 00:00:00 2001 From: Cameron Bernhardt Date: Wed, 9 Aug 2017 15:50:05 -0400 Subject: [PATCH 03/11] Force lowercase in API --- DOCS.md | 28 ++++++++++++++-------------- src/changeThreadColor.js | 2 +- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/DOCS.md b/DOCS.md index 1a6b0f0a..cbe59aa8 100644 --- a/DOCS.md +++ b/DOCS.md @@ -722,20 +722,20 @@ login({appState: JSON.parse(fs.readFileSync('appstate.json', 'utf8'))}, (err, ap Returns an array of all hexadecimal values currently accepted by [`api.changeThreadColor`](#changeThreadColor). These colors, listed below, are the ones present in the palette UI used for selecting thread colors on the Messenger client. Due to Facebook backend changes, the thread color can no longer be set to an arbitrary hex value. - `null` (default blue) -- `#44BEC7` -- `#FFC300` -- `#FA3C4C` -- `#D696BB` -- `#6699CC` -- `#13CF13` -- `#FF7E29` -- `#E68585` -- `#7646FF` -- `#20CEF5` -- `#67B868` -- `#D4A88C` -- `#FF5CA1` -- `#A695C7` +- `#44bec7` +- `#ffc300` +- `#fa3c4c` +- `#d696bb` +- `#6699cc` +- `#13cf13` +- `#ff7e29` +- `#e68585` +- `#7646ff` +- `#20cef5` +- `#67b868` +- `#d4a88c` +- `#ff5ca1` +- `#a695c7` --------------------------------------- diff --git a/src/changeThreadColor.js b/src/changeThreadColor.js index 7cc7e1c6..b96ca5bd 100644 --- a/src/changeThreadColor.js +++ b/src/changeThreadColor.js @@ -9,7 +9,7 @@ module.exports = function(defaultFuncs, api, ctx) { callback = function() {}; } var form = { - 'color_choice' : color, + 'color_choice' : color.toLowerCase(), // API only accepts lowercase letters in hex string 'thread_or_other_fbid' : threadID }; From 0914474d3fda5f6914a0f0f9b68e91f58a058d8e Mon Sep 17 00:00:00 2001 From: Cameron Bernhardt Date: Wed, 9 Aug 2017 16:06:07 -0400 Subject: [PATCH 04/11] Add thread color validation --- src/changeThreadColor.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/changeThreadColor.js b/src/changeThreadColor.js index b96ca5bd..ce03079e 100644 --- a/src/changeThreadColor.js +++ b/src/changeThreadColor.js @@ -8,8 +8,15 @@ module.exports = function(defaultFuncs, api, ctx) { if(!callback) { callback = function() {}; } + var loweredColor = color.toLowerCase(); // API only accepts lowercase letters in hex string + + var validColors = api.getValidThreadColors(); + if(!validColors.includes(loweredColor)) { + throw {error: "The color you are trying to use is not a valid thread color. Use api.getValidThreadColors to find acceptable values."}; + } + var form = { - 'color_choice' : color.toLowerCase(), // API only accepts lowercase letters in hex string + 'color_choice' : loweredColor 'thread_or_other_fbid' : threadID }; From baf596eb6fe2b9b20217680b4d0a73f4d6f18a07 Mon Sep 17 00:00:00 2001 From: Cameron Bernhardt Date: Wed, 9 Aug 2017 16:10:15 -0400 Subject: [PATCH 05/11] Fix indentation --- src/changeThreadColor.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/changeThreadColor.js b/src/changeThreadColor.js index ce03079e..5263f7d3 100644 --- a/src/changeThreadColor.js +++ b/src/changeThreadColor.js @@ -8,12 +8,12 @@ module.exports = function(defaultFuncs, api, ctx) { if(!callback) { callback = function() {}; } - var loweredColor = color.toLowerCase(); // API only accepts lowercase letters in hex string + var loweredColor = color.toLowerCase(); // API only accepts lowercase letters in hex string - var validColors = api.getValidThreadColors(); - if(!validColors.includes(loweredColor)) { - throw {error: "The color you are trying to use is not a valid thread color. Use api.getValidThreadColors to find acceptable values."}; - } + var validColors = api.getValidThreadColors(); + if(!validColors.includes(loweredColor)) { + throw {error: "The color you are trying to use is not a valid thread color. Use api.getValidThreadColors to find acceptable values."}; + } var form = { 'color_choice' : loweredColor From b309626ceb939324cb8c8f1cbed085f14f5a2c8f Mon Sep 17 00:00:00 2001 From: Cameron Bernhardt Date: Wed, 9 Aug 2017 22:36:46 -0400 Subject: [PATCH 06/11] Update thread color error checking --- DOCS.md | 2 +- src/changeThreadColor.js | 15 +++++++++------ src/getValidThreadColors.js | 2 +- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/DOCS.md b/DOCS.md index cbe59aa8..5ea2ce4e 100644 --- a/DOCS.md +++ b/DOCS.md @@ -721,7 +721,7 @@ login({appState: JSON.parse(fs.readFileSync('appstate.json', 'utf8'))}, (err, ap Returns an array of all hexadecimal values currently accepted by [`api.changeThreadColor`](#changeThreadColor). These colors, listed below, are the ones present in the palette UI used for selecting thread colors on the Messenger client. Due to Facebook backend changes, the thread color can no longer be set to an arbitrary hex value. -- `null` (default blue) +- `null` (default blue – not included in the returned array) - `#44bec7` - `#ffc300` - `#fa3c4c` diff --git a/src/changeThreadColor.js b/src/changeThreadColor.js index 5263f7d3..aa1259eb 100644 --- a/src/changeThreadColor.js +++ b/src/changeThreadColor.js @@ -8,15 +8,18 @@ module.exports = function(defaultFuncs, api, ctx) { if(!callback) { callback = function() {}; } - var loweredColor = color.toLowerCase(); // API only accepts lowercase letters in hex string + var loweredColor = color; - var validColors = api.getValidThreadColors(); - if(!validColors.includes(loweredColor)) { - throw {error: "The color you are trying to use is not a valid thread color. Use api.getValidThreadColors to find acceptable values."}; - } + if(loweredColor !== null) { + loweredColor = color.toLowerCase(); // API only accepts lowercase letters in hex string + var validColors = api.getValidThreadColors(); + if(!validColors.includes(loweredColor)) { + throw {error: "The color you are trying to use is not a valid thread color. Use api.getValidThreadColors() to find acceptable values."}; + } + } var form = { - 'color_choice' : loweredColor + 'color_choice' : loweredColor, 'thread_or_other_fbid' : threadID }; diff --git a/src/getValidThreadColors.js b/src/getValidThreadColors.js index 18df7922..0f5d807a 100644 --- a/src/getValidThreadColors.js +++ b/src/getValidThreadColors.js @@ -3,6 +3,6 @@ module.exports = function(defaultFuncs, api, ctx) { return function getValidThreadColors() { // Currently the only colors that can be passed to changeThreadColor(); may change if Facebook adds more - return ["#44bec7", "#ffc300", "#fa3c4c", "#d696bb", "#6699cc", "#13cf13", "#ff7e29", "#e68585", "#7646ff", "#20cef5", "#67b868", "#d4a88c", "#ff5ca1", "#a695c"]; + return ["#44bec7", "#ffc300", "#fa3c4c", "#d696bb", "#6699cc", "#13cf13", "#ff7e29", "#e68585", "#7646ff", "#20cef5", "#67b868", "#d4a88c", "#ff5ca1", "#a695c7"]; }; }; From aa9fa48eed4cb28c072462f6143d84b311acb4a4 Mon Sep 17 00:00:00 2001 From: Cameron Bernhardt Date: Wed, 9 Aug 2017 22:40:10 -0400 Subject: [PATCH 07/11] Fix spacing --- src/changeThreadColor.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/changeThreadColor.js b/src/changeThreadColor.js index aa1259eb..6282895e 100644 --- a/src/changeThreadColor.js +++ b/src/changeThreadColor.js @@ -18,6 +18,7 @@ module.exports = function(defaultFuncs, api, ctx) { throw {error: "The color you are trying to use is not a valid thread color. Use api.getValidThreadColors() to find acceptable values."}; } } + var form = { 'color_choice' : loweredColor, 'thread_or_other_fbid' : threadID From 1ee58a0b01141752db2370c020e0fc06ebb9c46c Mon Sep 17 00:00:00 2001 From: Cameron Bernhardt Date: Wed, 9 Aug 2017 22:41:11 -0400 Subject: [PATCH 08/11] Rename vars --- src/changeThreadColor.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/changeThreadColor.js b/src/changeThreadColor.js index 6282895e..67e2b390 100644 --- a/src/changeThreadColor.js +++ b/src/changeThreadColor.js @@ -8,19 +8,19 @@ module.exports = function(defaultFuncs, api, ctx) { if(!callback) { callback = function() {}; } - var loweredColor = color; + var validatedColor = color; - if(loweredColor !== null) { - loweredColor = color.toLowerCase(); // API only accepts lowercase letters in hex string + if(validatedColor !== null) { + validatedColor = color.toLowerCase(); // API only accepts lowercase letters in hex string var validColors = api.getValidThreadColors(); - if(!validColors.includes(loweredColor)) { + if(!validColors.includes(validatedColor)) { throw {error: "The color you are trying to use is not a valid thread color. Use api.getValidThreadColors() to find acceptable values."}; } } var form = { - 'color_choice' : loweredColor, + 'color_choice' : validatedColor, 'thread_or_other_fbid' : threadID }; From 775237035993b1384ec1a11483000a14dc7635d8 Mon Sep 17 00:00:00 2001 From: Cameron Bernhardt Date: Wed, 9 Aug 2017 23:30:51 -0400 Subject: [PATCH 09/11] Switch to using a dictionary --- DOCS.md | 42 ++++++++++++++++++------------------- index.js | 2 +- src/changeThreadColor.js | 14 ++++++------- src/getValidThreadColors.js | 8 ------- src/validThreadColors.js | 22 +++++++++++++++++++ 5 files changed, 50 insertions(+), 38 deletions(-) delete mode 100644 src/getValidThreadColors.js create mode 100644 src/validThreadColors.js diff --git a/DOCS.md b/DOCS.md index 5ea2ce4e..f2165dd2 100644 --- a/DOCS.md +++ b/DOCS.md @@ -22,7 +22,7 @@ * [`api.getThreadPictures`](#getThreadPictures) * [`api.getUserID`](#getUserID) * [`api.getUserInfo`](#getUserInfo) -* [`api.getValidThreadColors`](#getValidThreadColors) +* [`api.validThreadColors`](#validThreadColors) * [`api.handleMessageRequest`](#handleMessageRequest) * [`api.listen`](#listen) * [`api.logout`](#logout) @@ -716,26 +716,26 @@ login({appState: JSON.parse(fs.readFileSync('appstate.json', 'utf8'))}, (err, ap --------------------------------------- - -### api.getValidThreadColors() - -Returns an array of all hexadecimal values currently accepted by [`api.changeThreadColor`](#changeThreadColor). These colors, listed below, are the ones present in the palette UI used for selecting thread colors on the Messenger client. Due to Facebook backend changes, the thread color can no longer be set to an arbitrary hex value. - -- `null` (default blue – not included in the returned array) -- `#44bec7` -- `#ffc300` -- `#fa3c4c` -- `#d696bb` -- `#6699cc` -- `#13cf13` -- `#ff7e29` -- `#e68585` -- `#7646ff` -- `#20cef5` -- `#67b868` -- `#d4a88c` -- `#ff5ca1` -- `#a695c7` + +### api.validThreadColors + +Returns a dictionary mapping names of all currently valid thread colors to their hexadecimal values that are accepted by [`api.changeThreadColor`](#changeThreadColor). These colors, listed below, are the ones present in the palette UI used for selecting thread colors on the Messenger client. Due to Facebook backend changes, the thread color can no longer be set to an arbitrary hex value. + +- MessengerBlue: `null` +- Viking: `#44bec7` +- GoldenPoppy: `#ffc300` +- RadicalRed: `#fa3c4c` +- Shocking: `#d696bb` +- PictonBlue: `#6699cc` +- FreeSpeechGreen: `#13cf13` +- Pumpkin: `#ff7e29` +- LightCoral: `#e68585` +- MediumSlateBlue: `#7646ff` +- DeepSkyBlue: `#20cef5` +- Fern: `#67b868` +- Cameo: `#d4a88c` +- BrilliantRose: `#ff5ca1` +- BilobaFlower: `#a695c7` --------------------------------------- diff --git a/index.js b/index.js index fc0b0292..f4cf57ae 100644 --- a/index.js +++ b/index.js @@ -93,7 +93,7 @@ function buildAPI(globalOptions, html, jar) { 'getThreadPictures', 'getUserID', 'getUserInfo', - 'getValidThreadColors', + 'validThreadColors', 'handleMessageRequest', 'listen', 'logout', diff --git a/src/changeThreadColor.js b/src/changeThreadColor.js index 67e2b390..33aff47a 100644 --- a/src/changeThreadColor.js +++ b/src/changeThreadColor.js @@ -8,15 +8,13 @@ module.exports = function(defaultFuncs, api, ctx) { if(!callback) { callback = function() {}; } - var validatedColor = color; - if(validatedColor !== null) { - validatedColor = color.toLowerCase(); // API only accepts lowercase letters in hex string - - var validColors = api.getValidThreadColors(); - if(!validColors.includes(validatedColor)) { - throw {error: "The color you are trying to use is not a valid thread color. Use api.getValidThreadColors() to find acceptable values."}; - } + var validatedColor = (color !== null) ? color.toLowerCase() : color; // API only accepts lowercase letters in hex string + var colorList = Object.keys(api.validThreadColors).map(function(name) { + return api.validThreadColors[name]; + }); + if(!colorList.includes(validatedColor)) { + throw {error: "The color you are trying to use is not a valid thread color. Use api.validThreadColors to find acceptable values."}; } var form = { diff --git a/src/getValidThreadColors.js b/src/getValidThreadColors.js deleted file mode 100644 index 0f5d807a..00000000 --- a/src/getValidThreadColors.js +++ /dev/null @@ -1,8 +0,0 @@ -"use strict"; - -module.exports = function(defaultFuncs, api, ctx) { - return function getValidThreadColors() { - // Currently the only colors that can be passed to changeThreadColor(); may change if Facebook adds more - return ["#44bec7", "#ffc300", "#fa3c4c", "#d696bb", "#6699cc", "#13cf13", "#ff7e29", "#e68585", "#7646ff", "#20cef5", "#67b868", "#d4a88c", "#ff5ca1", "#a695c7"]; - }; -}; diff --git a/src/validThreadColors.js b/src/validThreadColors.js new file mode 100644 index 00000000..3d7b2512 --- /dev/null +++ b/src/validThreadColors.js @@ -0,0 +1,22 @@ +"use strict"; + +module.exports = function(defaultFuncs, api, ctx) { + // Currently the only colors that can be passed to changeThreadColor(); may change if Facebook adds more + return { + "MessengerBlue": null, + "Viking": "#44bec7", + "GoldenPoppy": "#ffc300", + "RadicalRed": "#fa3c4c", + "Shocking": "#d696bb", + "PictonBlue": "#6699cc", + "FreeSpeechGreen": "#13cf13", + "Pumpkin": "#ff7e29", + "LightCoral": "#e68585", + "MediumSlateBlue": "#7646ff", + "DeepSkyBlue": "#20cef5", + "Fern": "#67b868", + "Cameo": "#d4a88c", + "BrilliantRose": "#ff5ca1", + "BilobaFlower": "#a695c7" + }; +}; From 05a64fcf2c88ecc338b67a70368f1a95ccaabf05 Mon Sep 17 00:00:00 2001 From: Cameron Bernhardt Date: Wed, 9 Aug 2017 23:32:21 -0400 Subject: [PATCH 10/11] Wording fix --- src/validThreadColors.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/validThreadColors.js b/src/validThreadColors.js index 3d7b2512..ab8b3840 100644 --- a/src/validThreadColors.js +++ b/src/validThreadColors.js @@ -1,7 +1,7 @@ "use strict"; module.exports = function(defaultFuncs, api, ctx) { - // Currently the only colors that can be passed to changeThreadColor(); may change if Facebook adds more + // Currently the only colors that can be passed to api.changeThreadColor(); may change if Facebook adds more return { "MessengerBlue": null, "Viking": "#44bec7", From 7968a583960cf2c218df82ac5277a6b935796f40 Mon Sep 17 00:00:00 2001 From: Cameron Bernhardt Date: Thu, 10 Aug 2017 13:11:25 -0400 Subject: [PATCH 11/11] Rename to threadColors and move dep notice to CHANGELOG --- CHANGELOG.md | 1 + DOCS.md | 8 ++++---- index.js | 2 +- src/changeThreadColor.js | 6 +++--- src/{validThreadColors.js => threadColors.js} | 0 5 files changed, 9 insertions(+), 8 deletions(-) rename src/{validThreadColors.js => threadColors.js} (100%) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9e9388b9..b86e9519 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ * [Breaking change] [getThreadList](/DOCS.md#getThreadList): Removes deprecated fields in returned object, adds some new fields ([#488](https://github.com/Schmavery/facebook-chat-api/pull/488)) * [Breaking change] [getThreadInfo](/DOCS.md#getThreadInfo): Removes deprecated fields in returned object, adds some new fields ([#488](https://github.com/Schmavery/facebook-chat-api/pull/488)) * [New] [getEmojiUrl](/DOCS.md#getEmojiUrl): Adds utility function for getting the image URL for a Messenger-style emoji ([#477](https://github.com/Schmavery/facebook-chat-api/pull/477)) +* [Breaking change] [changeThreadColor](/DOCS.md#changeThreadColor): Due to Facebook backend changes, the thread color can no longer be set to an arbitrary hex value. Color validation and `api.threadColors` have been added to facilitate this change ([#512](https://github.com/Schmavery/facebook-chat-api/pull/512)) ## 1.4.0 (2017-04-28) * [Breaking change] [getThreadHistory](/DOCS.md#getThreadHistory): update parameters - no more start & end params; replaced with amount ([#453](https://github.com/Schmavery/facebook-chat-api/pull/453)) diff --git a/DOCS.md b/DOCS.md index f2165dd2..4fb34a0f 100644 --- a/DOCS.md +++ b/DOCS.md @@ -22,7 +22,7 @@ * [`api.getThreadPictures`](#getThreadPictures) * [`api.getUserID`](#getUserID) * [`api.getUserInfo`](#getUserInfo) -* [`api.validThreadColors`](#validThreadColors) +* [`api.threadColors`](#threadColors) * [`api.handleMessageRequest`](#handleMessageRequest) * [`api.listen`](#listen) * [`api.logout`](#logout) @@ -716,10 +716,10 @@ login({appState: JSON.parse(fs.readFileSync('appstate.json', 'utf8'))}, (err, ap --------------------------------------- - -### api.validThreadColors + +### api.threadColors -Returns a dictionary mapping names of all currently valid thread colors to their hexadecimal values that are accepted by [`api.changeThreadColor`](#changeThreadColor). These colors, listed below, are the ones present in the palette UI used for selecting thread colors on the Messenger client. Due to Facebook backend changes, the thread color can no longer be set to an arbitrary hex value. +A dictionary mapping names of all currently valid thread colors to their hexadecimal values that are accepted by [`api.changeThreadColor`](#changeThreadColor). These colors, listed below, are the ones present in the palette UI used for selecting thread colors on the Messenger client. - MessengerBlue: `null` - Viking: `#44bec7` diff --git a/index.js b/index.js index f4cf57ae..f0d6b084 100644 --- a/index.js +++ b/index.js @@ -93,7 +93,7 @@ function buildAPI(globalOptions, html, jar) { 'getThreadPictures', 'getUserID', 'getUserInfo', - 'validThreadColors', + 'threadColors', 'handleMessageRequest', 'listen', 'logout', diff --git a/src/changeThreadColor.js b/src/changeThreadColor.js index 33aff47a..0eb03abd 100644 --- a/src/changeThreadColor.js +++ b/src/changeThreadColor.js @@ -10,11 +10,11 @@ module.exports = function(defaultFuncs, api, ctx) { } var validatedColor = (color !== null) ? color.toLowerCase() : color; // API only accepts lowercase letters in hex string - var colorList = Object.keys(api.validThreadColors).map(function(name) { - return api.validThreadColors[name]; + var colorList = Object.keys(api.threadColors).map(function(name) { + return api.threadColors[name]; }); if(!colorList.includes(validatedColor)) { - throw {error: "The color you are trying to use is not a valid thread color. Use api.validThreadColors to find acceptable values."}; + throw {error: "The color you are trying to use is not a valid thread color. Use api.threadColors to find acceptable values."}; } var form = { diff --git a/src/validThreadColors.js b/src/threadColors.js similarity index 100% rename from src/validThreadColors.js rename to src/threadColors.js