@irojs/iro-core
Advanced tools
Comparing version 1.0.1 to 1.0.2
@@ -97,2 +97,5 @@ export interface ColorChanges { | ||
kelvin: number; | ||
red: number; | ||
green: number; | ||
blue: number; | ||
rgb: RgbColor; | ||
@@ -99,0 +102,0 @@ rgba: RgbColor; |
@@ -90,3 +90,3 @@ // Some regular expressions for rgb() and hsl() Colors are borrowed from tinyColor | ||
var prototypeAccessors = { hsv: { configurable: true },hsva: { configurable: true },hue: { configurable: true },saturation: { configurable: true },value: { configurable: true },alpha: { configurable: true },kelvin: { configurable: true },rgb: { configurable: true },rgba: { configurable: true },hsl: { configurable: true },hsla: { configurable: true },rgbString: { configurable: true },rgbaString: { configurable: true },hexString: { configurable: true },hex8String: { configurable: true },hslString: { configurable: true },hslaString: { configurable: true } }; | ||
var prototypeAccessors = { hsv: { configurable: true },hsva: { configurable: true },hue: { configurable: true },saturation: { configurable: true },value: { configurable: true },alpha: { configurable: true },kelvin: { configurable: true },red: { configurable: true },green: { configurable: true },blue: { configurable: true },rgb: { configurable: true },rgba: { configurable: true },hsl: { configurable: true },hsla: { configurable: true },rgbString: { configurable: true },rgbaString: { configurable: true },hexString: { configurable: true },hex8String: { configurable: true },hslString: { configurable: true },hslaString: { configurable: true } }; | ||
/** | ||
@@ -408,2 +408,32 @@ * @desc Set the Color from any valid value | ||
prototypeAccessors.red.get = function () { | ||
var rgb = this.rgb; | ||
return rgb.r; | ||
}; | ||
prototypeAccessors.red.set = function (value) { | ||
this.rgb = Object.assign({}, this.rgb, | ||
{r: value}); | ||
}; | ||
prototypeAccessors.green.get = function () { | ||
var rgb = this.rgb; | ||
return rgb.g; | ||
}; | ||
prototypeAccessors.green.set = function (value) { | ||
this.rgb = Object.assign({}, this.rgb, | ||
{g: value}); | ||
}; | ||
prototypeAccessors.blue.get = function () { | ||
var rgb = this.rgb; | ||
return rgb.b; | ||
}; | ||
prototypeAccessors.blue.set = function (value) { | ||
this.rgb = Object.assign({}, this.rgb, | ||
{b: value}); | ||
}; | ||
prototypeAccessors.rgb.get = function () { | ||
@@ -666,4 +696,14 @@ var ref = IroColor.hsvToRgb(this.$); | ||
var hsva = color.hsva; | ||
var rgb = color.rgb; | ||
switch (props.sliderType) { | ||
case 'red': | ||
return rgb.r / 2.55; | ||
case 'green': | ||
return rgb.g / 2.55; | ||
case 'blue': | ||
return rgb.b / 2.55; | ||
case 'alpha': | ||
@@ -727,2 +767,7 @@ return hsva.a * 100; | ||
case 'red': | ||
case 'blue': | ||
case 'green': | ||
return percent * 2.55; | ||
default: | ||
@@ -766,6 +811,15 @@ return percent; | ||
var hsv = color.hsv; | ||
var rgb = color.rgb; | ||
switch (props.sliderType) { | ||
case 'red': | ||
return [[0, ("rgb(" + (0) + "," + (rgb.g) + "," + (rgb.b) + ")")], [100, ("rgb(" + (255) + "," + (rgb.g) + "," + (rgb.b) + ")")]]; | ||
case 'green': | ||
return [[0, ("rgb(" + (rgb.r) + "," + (0) + "," + (rgb.b) + ")")], [100, ("rgb(" + (rgb.r) + "," + (255) + "," + (rgb.b) + ")")]]; | ||
case 'blue': | ||
return [[0, ("rgb(" + (rgb.r) + "," + (rgb.g) + "," + (0) + ")")], [100, ("rgb(" + (rgb.r) + "," + (rgb.g) + "," + (255) + ")")]]; | ||
case 'alpha': | ||
var rgb = color.rgb; | ||
return [[0, ("rgba(" + (rgb.r) + "," + (rgb.g) + "," + (rgb.b) + ",0)")], [100, ("rgb(" + (rgb.r) + "," + (rgb.g) + "," + (rgb.b) + ")")]]; | ||
@@ -772,0 +826,0 @@ |
@@ -90,3 +90,3 @@ // Some regular expressions for rgb() and hsl() Colors are borrowed from tinyColor | ||
var prototypeAccessors = { hsv: { configurable: true },hsva: { configurable: true },hue: { configurable: true },saturation: { configurable: true },value: { configurable: true },alpha: { configurable: true },kelvin: { configurable: true },rgb: { configurable: true },rgba: { configurable: true },hsl: { configurable: true },hsla: { configurable: true },rgbString: { configurable: true },rgbaString: { configurable: true },hexString: { configurable: true },hex8String: { configurable: true },hslString: { configurable: true },hslaString: { configurable: true } }; | ||
var prototypeAccessors = { hsv: { configurable: true },hsva: { configurable: true },hue: { configurable: true },saturation: { configurable: true },value: { configurable: true },alpha: { configurable: true },kelvin: { configurable: true },red: { configurable: true },green: { configurable: true },blue: { configurable: true },rgb: { configurable: true },rgba: { configurable: true },hsl: { configurable: true },hsla: { configurable: true },rgbString: { configurable: true },rgbaString: { configurable: true },hexString: { configurable: true },hex8String: { configurable: true },hslString: { configurable: true },hslaString: { configurable: true } }; | ||
/** | ||
@@ -408,2 +408,32 @@ * @desc Set the Color from any valid value | ||
prototypeAccessors.red.get = function () { | ||
var rgb = this.rgb; | ||
return rgb.r; | ||
}; | ||
prototypeAccessors.red.set = function (value) { | ||
this.rgb = Object.assign({}, this.rgb, | ||
{r: value}); | ||
}; | ||
prototypeAccessors.green.get = function () { | ||
var rgb = this.rgb; | ||
return rgb.g; | ||
}; | ||
prototypeAccessors.green.set = function (value) { | ||
this.rgb = Object.assign({}, this.rgb, | ||
{g: value}); | ||
}; | ||
prototypeAccessors.blue.get = function () { | ||
var rgb = this.rgb; | ||
return rgb.b; | ||
}; | ||
prototypeAccessors.blue.set = function (value) { | ||
this.rgb = Object.assign({}, this.rgb, | ||
{b: value}); | ||
}; | ||
prototypeAccessors.rgb.get = function () { | ||
@@ -666,4 +696,14 @@ var ref = IroColor.hsvToRgb(this.$); | ||
var hsva = color.hsva; | ||
var rgb = color.rgb; | ||
switch (props.sliderType) { | ||
case 'red': | ||
return rgb.r / 2.55; | ||
case 'green': | ||
return rgb.g / 2.55; | ||
case 'blue': | ||
return rgb.b / 2.55; | ||
case 'alpha': | ||
@@ -727,2 +767,7 @@ return hsva.a * 100; | ||
case 'red': | ||
case 'blue': | ||
case 'green': | ||
return percent * 2.55; | ||
default: | ||
@@ -766,6 +811,15 @@ return percent; | ||
var hsv = color.hsv; | ||
var rgb = color.rgb; | ||
switch (props.sliderType) { | ||
case 'red': | ||
return [[0, ("rgb(" + (0) + "," + (rgb.g) + "," + (rgb.b) + ")")], [100, ("rgb(" + (255) + "," + (rgb.g) + "," + (rgb.b) + ")")]]; | ||
case 'green': | ||
return [[0, ("rgb(" + (rgb.r) + "," + (0) + "," + (rgb.b) + ")")], [100, ("rgb(" + (rgb.r) + "," + (255) + "," + (rgb.b) + ")")]]; | ||
case 'blue': | ||
return [[0, ("rgb(" + (rgb.r) + "," + (rgb.g) + "," + (0) + ")")], [100, ("rgb(" + (rgb.r) + "," + (rgb.g) + "," + (255) + ")")]]; | ||
case 'alpha': | ||
var rgb = color.rgb; | ||
return [[0, ("rgba(" + (rgb.r) + "," + (rgb.g) + "," + (rgb.b) + ",0)")], [100, ("rgb(" + (rgb.r) + "," + (rgb.g) + "," + (rgb.b) + ")")]]; | ||
@@ -772,0 +826,0 @@ |
@@ -95,3 +95,3 @@ (function (global, factory) { | ||
var prototypeAccessors = { hsv: { configurable: true },hsva: { configurable: true },hue: { configurable: true },saturation: { configurable: true },value: { configurable: true },alpha: { configurable: true },kelvin: { configurable: true },rgb: { configurable: true },rgba: { configurable: true },hsl: { configurable: true },hsla: { configurable: true },rgbString: { configurable: true },rgbaString: { configurable: true },hexString: { configurable: true },hex8String: { configurable: true },hslString: { configurable: true },hslaString: { configurable: true } }; | ||
var prototypeAccessors = { hsv: { configurable: true },hsva: { configurable: true },hue: { configurable: true },saturation: { configurable: true },value: { configurable: true },alpha: { configurable: true },kelvin: { configurable: true },red: { configurable: true },green: { configurable: true },blue: { configurable: true },rgb: { configurable: true },rgba: { configurable: true },hsl: { configurable: true },hsla: { configurable: true },rgbString: { configurable: true },rgbaString: { configurable: true },hexString: { configurable: true },hex8String: { configurable: true },hslString: { configurable: true },hslaString: { configurable: true } }; | ||
/** | ||
@@ -413,2 +413,32 @@ * @desc Set the Color from any valid value | ||
prototypeAccessors.red.get = function () { | ||
var rgb = this.rgb; | ||
return rgb.r; | ||
}; | ||
prototypeAccessors.red.set = function (value) { | ||
this.rgb = Object.assign({}, this.rgb, | ||
{r: value}); | ||
}; | ||
prototypeAccessors.green.get = function () { | ||
var rgb = this.rgb; | ||
return rgb.g; | ||
}; | ||
prototypeAccessors.green.set = function (value) { | ||
this.rgb = Object.assign({}, this.rgb, | ||
{g: value}); | ||
}; | ||
prototypeAccessors.blue.get = function () { | ||
var rgb = this.rgb; | ||
return rgb.b; | ||
}; | ||
prototypeAccessors.blue.set = function (value) { | ||
this.rgb = Object.assign({}, this.rgb, | ||
{b: value}); | ||
}; | ||
prototypeAccessors.rgb.get = function () { | ||
@@ -671,4 +701,14 @@ var ref = IroColor.hsvToRgb(this.$); | ||
var hsva = color.hsva; | ||
var rgb = color.rgb; | ||
switch (props.sliderType) { | ||
case 'red': | ||
return rgb.r / 2.55; | ||
case 'green': | ||
return rgb.g / 2.55; | ||
case 'blue': | ||
return rgb.b / 2.55; | ||
case 'alpha': | ||
@@ -732,2 +772,7 @@ return hsva.a * 100; | ||
case 'red': | ||
case 'blue': | ||
case 'green': | ||
return percent * 2.55; | ||
default: | ||
@@ -771,6 +816,15 @@ return percent; | ||
var hsv = color.hsv; | ||
var rgb = color.rgb; | ||
switch (props.sliderType) { | ||
case 'red': | ||
return [[0, ("rgb(" + (0) + "," + (rgb.g) + "," + (rgb.b) + ")")], [100, ("rgb(" + (255) + "," + (rgb.g) + "," + (rgb.b) + ")")]]; | ||
case 'green': | ||
return [[0, ("rgb(" + (rgb.r) + "," + (0) + "," + (rgb.b) + ")")], [100, ("rgb(" + (rgb.r) + "," + (255) + "," + (rgb.b) + ")")]]; | ||
case 'blue': | ||
return [[0, ("rgb(" + (rgb.r) + "," + (rgb.g) + "," + (0) + ")")], [100, ("rgb(" + (rgb.r) + "," + (rgb.g) + "," + (255) + ")")]]; | ||
case 'alpha': | ||
var rgb = color.rgb; | ||
return [[0, ("rgba(" + (rgb.r) + "," + (rgb.g) + "," + (rgb.b) + ",0)")], [100, ("rgb(" + (rgb.r) + "," + (rgb.g) + "," + (rgb.b) + ")")]]; | ||
@@ -777,0 +831,0 @@ |
import { IroColor } from './color'; | ||
import { IroColorPickerOptions } from './colorPickerOptions'; | ||
export declare type SliderShape = 'bar' | 'circle' | ''; | ||
export declare type SliderType = 'hue' | 'saturation' | 'value' | 'alpha' | 'kelvin' | ''; | ||
export declare type SliderType = 'red' | 'green' | 'blue' | 'alpha' | 'hue' | 'saturation' | 'value' | 'kelvin' | ''; | ||
export interface SliderOptions extends IroColorPickerOptions { | ||
@@ -6,0 +6,0 @@ color: IroColor; |
{ | ||
"name": "@irojs/iro-core", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "Core functionality for iro.js", | ||
@@ -5,0 +5,0 @@ "source": "src/index.ts", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
305015
3282