@khanacademy/wonder-blocks-color
Advanced tools
Comparing version 1.1.20 to 1.2.0
import _extends from '@babel/runtime/helpers/extends'; | ||
/** | ||
* A color manipulation library useful for dynamically | ||
* mixing colors together. | ||
*/ | ||
const color6Regexp = /^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i; | ||
@@ -11,4 +7,2 @@ const color3Regexp = /^#([0-9a-f])([0-9a-f])([0-9a-f])$/i; | ||
// Parse a color in #abcdef, rgb(...), or rgba(...) form into an object | ||
// with r,g,b,a keys. | ||
const parse = color => { | ||
@@ -53,5 +47,4 @@ if (typeof color !== "string") { | ||
throw new Error(`Failed to parse color: ${color}`); | ||
}; // Stringify the color in an `rgba()` or `#abcdef` format. | ||
}; | ||
const format = color => { | ||
@@ -72,5 +65,4 @@ const r = Math.round(color.r); | ||
} | ||
}; // Adjust the alpha value of a color. | ||
}; | ||
const fade = (color, percentage) => { | ||
@@ -85,5 +77,3 @@ if (percentage < 0 || percentage > 1) { | ||
})); | ||
}; // Mix a color into a background color, using the alpha channel of the base | ||
// color to determine the linear blend. | ||
}; | ||
const mix = (color, background) => { | ||
@@ -103,3 +93,2 @@ const colorObj = parse(color); | ||
const Color = { | ||
// Product | ||
blue: "#1865f2", | ||
@@ -110,3 +99,2 @@ purple: "#9059ff", | ||
red: "#d92916", | ||
// Neutral | ||
offBlack, | ||
@@ -122,4 +110,3 @@ offBlack64: fade(offBlack, 0.64), | ||
white50: fade(white, 0.5), | ||
// Brand | ||
darkBlue: "#0a2a66", | ||
darkBlue: "#0b2149", | ||
teal: "#14bf96", | ||
@@ -134,3 +121,2 @@ lightBlue: "#37c5fd", | ||
export default Color; | ||
export { SemanticColor, fade, mix }; | ||
export { SemanticColor, Color as default, fade, mix }; |
@@ -223,3 +223,3 @@ module.exports = | ||
// Brand | ||
darkBlue: "#0a2a66", | ||
darkBlue: "#0b2149", | ||
teal: "#14bf96", | ||
@@ -226,0 +226,0 @@ lightBlue: "#37c5fd", |
{ | ||
"name": "@khanacademy/wonder-blocks-color", | ||
"version": "1.1.20", | ||
"version": "1.2.0", | ||
"design": "v2", | ||
@@ -16,7 +16,6 @@ "publishConfig": { | ||
"devDependencies": { | ||
"wb-dev-build-settings": "^0.2.0" | ||
"wb-dev-build-settings": "^0.4.0" | ||
}, | ||
"author": "", | ||
"license": "MIT", | ||
"gitHead": "9ebea88533e702011165072f090a377e02fa3f0f" | ||
"license": "MIT" | ||
} |
@@ -57,3 +57,3 @@ // @flow | ||
// Brand | ||
darkBlue: "#0a2a66", | ||
darkBlue: "#0b2149", | ||
teal: "#14bf96", | ||
@@ -60,0 +60,0 @@ lightBlue: "#37c5fd", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
125427
928