Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@khanacademy/wonder-blocks-color

Package Overview
Dependencies
Maintainers
1
Versions
52
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@khanacademy/wonder-blocks-color - npm Package Compare versions

Comparing version 1.1.15 to 1.1.16

18

docutils/swatch.js

@@ -22,2 +22,8 @@ // @flow

type DefaultProps = {|
width: $PropertyType<Props, "width">,
segments: $PropertyType<Props, "segments">,
use: $PropertyType<Props, "use">,
|};
const constants = {

@@ -28,3 +34,3 @@ segmentHeight: 64,

export default class Swatch extends React.Component<Props> {
static defaultProps = {
static defaultProps: DefaultProps = {
width: 256,

@@ -35,3 +41,3 @@ segments: 3,

getContent() {
getContent(): ?string {
const {use} = this.props;

@@ -46,3 +52,3 @@ if (use === "text") {

}
renderThreeSegments() {
renderThreeSegments(): React.Node {
const {color} = this.props;

@@ -69,3 +75,3 @@ const content = this.getContent();

}
renderTwoSegments() {
renderTwoSegments(): React.Node {
const {color} = this.props;

@@ -87,3 +93,3 @@ const content = this.getContent();

}
renderOneSegment() {
renderOneSegment(): React.Node {
const {color, use} = this.props;

@@ -110,3 +116,3 @@ const content = this.getContent();

}
render() {
render(): React.Node {
const {name, desc, use, segments, width} = this.props;

@@ -113,0 +119,0 @@ return (

@@ -7,4 +7,32 @@ // @flow

const Color = {
type ColorType = {|
// Product
blue: string,
purple: string,
green: string,
gold: string,
red: string,
// Neutral
offBlack: string,
offBlack64: string,
offBlack50: string,
offBlack32: string,
offBlack16: string,
offBlack8: string,
offWhite: string,
white: string,
white64: string,
white50: string,
// Brand
darkBlue: string,
teal: string,
lightBlue: string,
pink: string,
|};
const Color: ColorType = {
// Product
blue: "#1865f2",

@@ -11,0 +39,0 @@ purple: "#9059ff",

{
"name": "@khanacademy/wonder-blocks-color",
"version": "1.1.15",
"version": "1.1.16",
"design": "v2",

@@ -20,3 +20,3 @@ "publishConfig": {

"license": "MIT",
"gitHead": "d54b1f3b101a92dc4a53e0f6aa4621db2e2a5b6e"
"gitHead": "644907d5558f4ab46a8ecb3c7e22be8bd3a9920e"
}

@@ -20,3 +20,3 @@ // @flow

// with r,g,b,a keys.
const parse = (color: string) => {
const parse = (color: string): Color => {
if (typeof color !== "string") {

@@ -60,3 +60,3 @@ throw new Error(`Failed to parse color: ${color}`);

// Stringify the color in an `rgba()` or `#abcdef` format.
const format = (color: Color) => {
const format = (color: Color): string => {
const r = Math.round(color.r);

@@ -78,3 +78,3 @@ const g = Math.round(color.g);

// Adjust the alpha value of a color.
export const fade = (color: string, percentage: number) => {
export const fade = (color: string, percentage: number): string => {
if (percentage < 0 || percentage > 1) {

@@ -92,3 +92,3 @@ throw new Error("Percentage must be between 0 and 1");

// color to determine the linear blend.
export const mix = (color: string, background: string) => {
export const mix = (color: string, background: string): string => {
const colorObj = parse(color);

@@ -95,0 +95,0 @@ const bgObj = parse(background);

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc