@mathigon/core
Advanced tools
Comparing version 0.6.2 to 0.6.3
@@ -363,3 +363,4 @@ 'use strict'; | ||
const rgbaRegex = /rgba?\(([0-9,]+), ?([0-9,]+), ?([0-9,]+)(, ?([0-9,]+))?\)/; | ||
const rainbow = ['#22ab24', '#0f82f2', '#cd0e66', '#fd8c00']; | ||
const rainbow = ['#22ab24', '#009ea6', '#0f82f2', '#6d3bbf', | ||
'#cd0e66', '#eb4726', '#fd8c00']; | ||
function pad2(str) { | ||
@@ -462,5 +463,10 @@ return str.length === 1 ? '0' + str : str; | ||
/** Generates a rainbow gradient with a given number of steps. */ | ||
static gradient(from, to, steps) { | ||
return tabulate(x => getColourAt([from, to], x / (steps - 1)), steps); | ||
static gradient(colors, steps) { | ||
return tabulate(x => getColourAt(colors, x / (steps - 1)), steps); | ||
} | ||
static shades(color, steps, range = 0.5) { | ||
const light = Color.mix('#fff', color, range); | ||
const dark = Color.mix('#000', color, range); | ||
return Color.gradient([light, color, dark], steps); | ||
} | ||
/** Linearly interpolates two colours or hex strings. */ | ||
@@ -467,0 +473,0 @@ static mix(c1, c2, p = 0.5) { |
@@ -359,3 +359,4 @@ // ============================================================================= | ||
const rgbaRegex = /rgba?\(([0-9,]+), ?([0-9,]+), ?([0-9,]+)(, ?([0-9,]+))?\)/; | ||
const rainbow = ['#22ab24', '#0f82f2', '#cd0e66', '#fd8c00']; | ||
const rainbow = ['#22ab24', '#009ea6', '#0f82f2', '#6d3bbf', | ||
'#cd0e66', '#eb4726', '#fd8c00']; | ||
function pad2(str) { | ||
@@ -458,5 +459,10 @@ return str.length === 1 ? '0' + str : str; | ||
/** Generates a rainbow gradient with a given number of steps. */ | ||
static gradient(from, to, steps) { | ||
return tabulate(x => getColourAt([from, to], x / (steps - 1)), steps); | ||
static gradient(colors, steps) { | ||
return tabulate(x => getColourAt(colors, x / (steps - 1)), steps); | ||
} | ||
static shades(color, steps, range = 0.5) { | ||
const light = Color.mix('#fff', color, range); | ||
const dark = Color.mix('#000', color, range); | ||
return Color.gradient([light, color, dark], steps); | ||
} | ||
/** Linearly interpolates two colours or hex strings. */ | ||
@@ -463,0 +469,0 @@ static mix(c1, c2, p = 0.5) { |
{ | ||
"name": "@mathigon/core", | ||
"version": "0.6.2", | ||
"version": "0.6.3", | ||
"description": "TypeScript utilities library containing function wrappers, string and array helper functions, event classes and color utilities.", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -14,3 +14,4 @@ // ============================================================================= | ||
const rainbow = ['#22ab24', '#0f82f2', '#cd0e66', '#fd8c00']; | ||
const rainbow = ['#22ab24', '#009ea6', '#0f82f2', '#6d3bbf', | ||
'#cd0e66', '#eb4726', '#fd8c00']; | ||
@@ -132,6 +133,12 @@ | ||
/** Generates a rainbow gradient with a given number of steps. */ | ||
static gradient(from: Color|string, to: Color|string, steps: number) { | ||
return tabulate(x => getColourAt([from, to], x / (steps - 1)), steps); | ||
static gradient(colors: (Color|string)[], steps: number) { | ||
return tabulate(x => getColourAt(colors, x / (steps - 1)), steps); | ||
} | ||
static shades(color: Color|string, steps: number, range = 0.5) { | ||
const light = Color.mix('#fff', color, range); | ||
const dark = Color.mix('#000', color, range); | ||
return Color.gradient([light, color, dark], steps); | ||
} | ||
/** Linearly interpolates two colours or hex strings. */ | ||
@@ -138,0 +145,0 @@ static mix(c1: Color|string, c2: Color|string, p = 0.5) { |
@@ -76,3 +76,3 @@ // ============================================================================= | ||
let resolve: ((value: T | PromiseLike<T>) => void) = () => undefined; | ||
let reject: ((reason: any) => void) = () => undefined; | ||
let reject: ((reason?: any) => void) = () => undefined; | ||
@@ -79,0 +79,0 @@ const promise = new Promise<T>((_resolve, _reject) => { |
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
66531
3954
24
1874
1
0