Skip to content

Commit

Permalink
Merge branch 'release/v0.1.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
borulday committed Jul 25, 2018
2 parents d896a27 + 593aa12 commit ef46970
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "color-name-guru",
"version": "0.1.1",
"version": "0.1.2",
"description": "Color Name Guru gives color name suggestions for your iOS, OSX, Web and Android projects.",
"author": {
"name": "M.Gökay Borulday"
Expand Down
12 changes: 9 additions & 3 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@
* https://github.com/zeplin/zeplin-extension-documentation
*/

/**
* TODOs:
* - Add color name presentation options (camelCase, snake_case...etc)
*
*/

const SPACE = 2;
const messageKingdom = [
"🕺 Holly dance!",
Expand Down Expand Up @@ -54,7 +60,7 @@ function alternateColor(projectType, color) {
const nearestColorInformation = nearestColor.from(colors);

const alternateColor = nearestColorInformation({ r: color.r, g: color.g, b: color.b });
const alternateColorName = alternateColor.name + (color.a == 1 ? "" : color.a * 100);
const alternateColorName = alternateColor.name + (color.a == 1 ? "" : parseInt(color.a * 100));

let suggestion = "";
switch (projectType) {
Expand All @@ -75,9 +81,9 @@ function alternateColor(projectType, color) {
suggestion = "";
}

if (suggestion == color.name) {
if (suggestion.toLowerCase() == color.name.toLowerCase()) {
suggestion = messageKingdom[Math.floor(Math.random() * messageKingdom.length)];
}
}

return {
current: color.name,
Expand Down

0 comments on commit ef46970

Please sign in to comment.