🎉 initiate project *astro_rewrite*

This commit is contained in:
sindrekjelsrud 2023-07-19 21:31:30 +02:00
parent ffd4d5e86c
commit 2ba37bfbe3
8658 changed files with 2268794 additions and 2538 deletions

21
node_modules/s.color/LICENSE generated vendored Normal file
View file

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2020 Leonard Grosoli
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

324
node_modules/s.color/README.md generated vendored Normal file
View file

@ -0,0 +1,324 @@
<span id="BADGE_GENERATION_MARKER_0"></span>
[![circleci](https://img.shields.io/circleci/build/github/TheRealSyler/s.color)](https://app.circleci.com/github/TheRealSyler/s.color/pipelines) [![Custom](https://codecov.io/gh/TheRealSyler/s.color/branch/master/graph/badge.svg)](https://codecov.io/gh/TheRealSyler/s.color) [![npmV](https://img.shields.io/npm/v/s.color?color=green)](https://www.npmjs.com/package/s.color) [![min](https://img.shields.io/bundlephobia/min/s.color)](https://bundlephobia.com/result?p=s.color) [![install](https://badgen.net/packagephobia/install/s.color)](https://packagephobia.now.sh/result?p=s.color) [![githubLastCommit](https://img.shields.io/github/last-commit/TheRealSyler/s.color)](https://github.com/TheRealSyler/s.color)
<span id="BADGE_GENERATION_MARKER_1"></span>
> Note: if you want a reliable library use something like color instead.
<span id="DOC_GENERATION_MARKER_0"></span>
# Docs
- **[ColorConverters](#colorconverters)**
- [RGBToHSV](#rgbtohsv)
- [HSVToRGB](#hsvtorgb)
- [StringToRGB](#stringtorgb)
- [StringToHVS](#stringtohvs)
- [HSVToHEX](#hsvtohex)
- [RGBToHEX](#rgbtohex)
- **[ColorTypes](#colortypes)**
- [RGBColor](#rgbcolor)
- [HSVColor](#hsvcolor)
- [StringColor](#stringcolor)
- **[HandleGet](#handleget)**
- [HandleGetHex](#handlegethex)
- **[HandleSet](#handleset)**
- [ConvertString](#convertstring)
- [HandleConvertHexString](#handleconverthexstring)
- **[UtilityFunction](#utilityfunction)**
- [GetReadableTextColor](#getreadabletextcolor)
- [ShiftHue](#shifthue)
- **[index](#index)**
- **[interfaces](#interfaces)**
- [GetColorTypeHex](#getcolortypehex)
- [GetColorType](#getcolortype)
- [GetColorOptions](#getcoloroptions)
- **[regex](#regex)**
- [isValidHex](#isvalidhex)
- [isValidRGB](#isvalidrgb)
- **[utils](#utils)**
- [GetReadableTextColor](#getreadabletextcolor)
- [ShiftHue](#shifthue)
- [convertCssColorToHex](#convertcsscolortohex)
- **[validators](#validators)**
- [isValidStringColor](#isvalidstringcolor)
### ColorConverters
##### RGBToHSV
```typescript
/**
* Takes an `RGBColor` and converts it to `HSVColor`
*/
function RGBToHSV(color: RGBColor, is255?: boolean): HSVColor;
```
##### HSVToRGB
```typescript
/**
* Takes an `HSVColor` and converts it to `RGBColor`
*/
function HSVToRGB(hsv: HSVColor, is100?: boolean): RGBColor;
```
##### StringToRGB
```typescript
/**
* Takes an `StringColor` and converts it to `RGBColor`,
* If input string is invalid `null` will be returned.
*/
function StringToRGB(input: string, return255?: boolean, alpha255?: boolean): RGBColor;
```
##### StringToHVS
```typescript
/**
* Takes an `StringColor` and converts it to `HSVColor`,
* If input string is invalid `null` will be returned.
*/
function StringToHVS(input: string, return255?: boolean, alpha255?: boolean): HSVColor;
```
##### HSVToHEX
```typescript
/**
* Takes an `HSVColor` and converts it to `String` (HEX Format)
*/
function HSVToHEX(hsv: HSVColor, options?: {
type?: GetColorTypeHex;
isLong?: boolean;
}
```
##### RGBToHEX
```typescript
/**
* Takes an `RGBColor` and converts it to `String` (HEX Format)
*/
function RGBToHEX(color: RGBColor, type?: GetColorTypeHex): string;
```
### ColorTypes
##### RGBColor
```typescript
/**
* Represents a color in the rgb(a) format.
*
*
* Range `[0 - 1]`
*/
class RGBColor {
/**
* Range [0-1]
*/
r: number;
/**
* Range [0-1]
*/
g: number;
/**
* Range [0-1]
*/
b: number;
/**
* Range [0-1]
*/
a: number;
constructor(r: number, g: number, b: number, a?: number);
}
```
##### HSVColor
```typescript
/**
* Represents a color in the hsv(a) format.
*
*
* Range `[h 0 - 360, v/s/a 0 - 1]`
*/
class HSVColor {
/**
* Range [0-360]
*/
h: number;
/**
* Range [0-100]
*/
s: number;
/**
* Range [0-100]
*/
v: number;
/**
* Range [0-1]
*/
a: number;
constructor(h: number, s: number, v: number, a?: number);
}
```
##### StringColor
```typescript
/**
* Represents a color in a string format.
* Valid strings are `#000 | #0000 | #000000 | #00000000`
* Or `rgb(0, 0, 0, 0) | rgba(0, 0, 0, 0, 0)` Range [rgb 0-255, a: 0-1]
*
*/
class StringColor {
color: string;
constructor(color: string);
}
```
### HandleGet
##### HandleGetHex
```typescript
function HandleGetHex(type: GetColorType, color: RGBColor, options?: GetColorOptions): string;
```
### HandleSet
##### ConvertString
```typescript
function ConvertString(input: string, return255?: boolean, alpha255?: boolean): RGBColor;
```
##### HandleConvertHexString
```typescript
/**
* **assumes that the input is valid**
*/
function HandleConvertHexString(text: string, return255?: boolean, alpha255?: boolean): RGBColor;
```
### UtilityFunction
##### GetReadableTextColor
```typescript
function GetReadableTextColor(color: RGBColor | HSVColor | StringColor | string): RGBColor | HSVColor | "#000" | "#fff";
```
##### ShiftHue
```typescript
/**
* Shifts the hue of the `HSVColor` by the Value
*/
function ShiftHue(hsv: HSVColor, value: number): HSVColor;
```
### index
### interfaces
##### GetColorTypeHex
```typescript
type GetColorTypeHex = 'hex' | 'hex-short' | 'hex-without-alpha' | 'hex-without-alpha-short';
```
##### GetColorType
```typescript
type GetColorType = 'rgb' | GetColorTypeHex | 'rgba' | 'object' | 'hsv';
```
##### GetColorOptions
```typescript
interface GetColorOptions {
/**
* if true `#fff` will be output as `#FFF`
*/
UpperCaseHex: boolean;
}
```
### regex
##### isValidHex
```typescript
function isValidHex(text: string): boolean;
```
##### isValidRGB
```typescript
function isValidRGB(text: string): boolean;
```
### utils
##### GetReadableTextColor
```typescript
function GetReadableTextColor(color: RGBColor | HSVColor | StringColor | string): RGBColor | HSVColor | "#000" | "#fff";
```
##### ShiftHue
```typescript
/**
* Shifts the hue of the `HSVColor` by the Value
*/
function ShiftHue(hsv: HSVColor, value: number): HSVColor;
```
##### convertCssColorToHex
```typescript
/**Returns the hex value of the color string or the input string */
function convertCssColorToHex(color: string): string;
```
### validators
##### isValidStringColor
```typescript
function isValidStringColor(input: string): string;
```
_Generated with_ **[suf-cli](https://www.npmjs.com/package/suf-cli)**
<span id="DOC_GENERATION_MARKER_1"></span>
# License
<span id="LICENSE_GENERATION_MARKER_0"></span>
Copyright (c) 2020 Leonard Grosoli Licensed under the MIT license.
<span id="LICENSE_GENERATION_MARKER_1"></span>

31
node_modules/s.color/lib/ColorConverters.d.ts generated vendored Executable file
View file

@ -0,0 +1,31 @@
import { RGBColor, HSVColor } from './ColorTypes';
import { GetColorTypeHex } from './interfaces';
/**
* Takes an `RGBColor` and converts it to `HSVColor`
*/
export declare function RGBToHSV(color: RGBColor, is255?: boolean): HSVColor;
/**
* Takes an `HSVColor` and converts it to `RGBColor`
*/
export declare function HSVToRGB(hsv: HSVColor, is100?: boolean): RGBColor;
/**
* Takes an `StringColor` and converts it to `RGBColor`,
* If input string is invalid `null` will be returned.
*/
export declare function StringToRGB(input: string, return255?: boolean, alpha255?: boolean): RGBColor;
/**
* Takes an `StringColor` and converts it to `HSVColor`,
* If input string is invalid `null` will be returned.
*/
export declare function StringToHVS(input: string, return255?: boolean, alpha255?: boolean): HSVColor;
/**
* Takes an `HSVColor` and converts it to `String` (HEX Format)
*/
export declare function HSVToHEX(hsv: HSVColor, options?: {
type?: GetColorTypeHex;
isLong?: boolean;
}): string;
/**
* Takes an `RGBColor` and converts it to `String` (HEX Format)
*/
export declare function RGBToHEX(color: RGBColor, type?: GetColorTypeHex): string;

118
node_modules/s.color/lib/ColorConverters.js generated vendored Executable file
View file

@ -0,0 +1,118 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var ColorTypes_1 = require("./ColorTypes");
var HandleSet_1 = require("./HandleSet");
var validators_1 = require("./validators");
var HandleGet_1 = require("./HandleGet");
var utils_1 = require("./utils");
/**
* Takes an `RGBColor` and converts it to `HSVColor`
*/
function RGBToHSV(color, is255) {
var isLong = is255 ? true : color.b > 1 || color.g > 1 || color.r > 1;
if (isLong) {
color = { a: color.a, b: color.b / 255, g: color.g / 255, r: color.r / 255 };
}
var cMax = Math.max(color.r, color.g, color.b);
var cMin = Math.min(color.r, color.g, color.b);
var diff = cMax - cMin;
// Hue
var hue = cMax === 1 && cMin === 1
? 0
: cMax === 0 && cMin === 0
? 0
: cMax === color.r
? (60 * ((color.g - color.b) / diff) + 360) % 360
: cMax === color.g
? (60 * ((color.b - color.r) / diff) + 120) % 360
: cMax === color.b
? (60 * ((color.r - color.g) / diff) + 240) % 360
: 0;
// Saturation
var saturation;
//
if (cMax === 0) {
saturation = 0;
}
else {
saturation = (diff / cMax) * 100;
}
return new ColorTypes_1.HSVColor(hue ? hue : 0, saturation, cMax * 100, color.a);
}
exports.RGBToHSV = RGBToHSV;
/**
* Takes an `HSVColor` and converts it to `RGBColor`
*/
function HSVToRGB(hsv, is100) {
var isLong = is100 ? true : hsv.s > 1 || hsv.v > 1;
if (isLong) {
hsv = { a: hsv.a, h: hsv.h, s: hsv.s / 100, v: hsv.v / 100 };
}
var f = function (n, k) {
if (k === void 0) { k = (n + hsv.h / 60) % 6; }
return hsv.v - hsv.v * hsv.s * Math.max(Math.min(k, 4 - k, 1), 0);
};
if (isLong) {
return new ColorTypes_1.RGBColor(f(5) * 255, f(3) * 255, f(1) * 255, hsv.a);
}
else {
return new ColorTypes_1.RGBColor(f(5), f(3), f(1), hsv.a);
}
}
exports.HSVToRGB = HSVToRGB;
/**
* Takes an `StringColor` and converts it to `RGBColor`,
* If input string is invalid `null` will be returned.
*/
function StringToRGB(input, return255, alpha255) {
input = utils_1.convertCssColorToHex(input);
if (validators_1.isValidStringColor(input)) {
return HandleSet_1.ConvertString(input, return255, alpha255);
}
return null;
}
exports.StringToRGB = StringToRGB;
/**
* Takes an `StringColor` and converts it to `HSVColor`,
* If input string is invalid `null` will be returned.
*/
function StringToHVS(input, return255, alpha255) {
input = utils_1.convertCssColorToHex(input);
if (validators_1.isValidStringColor(input)) {
return RGBToHSV(HandleSet_1.ConvertString(input, return255, alpha255));
}
return null;
}
exports.StringToHVS = StringToHVS;
/**
* Takes an `HSVColor` and converts it to `String` (HEX Format)
*/
function HSVToHEX(hsv, options) {
if (hsv.s > 1 || hsv.v > 1 || (options && options.isLong)) {
hsv.s = hsv.s / 100;
hsv.v = hsv.v / 100;
}
var f = function (n, k) {
if (k === void 0) { k = (n + hsv.h / 60) % 6; }
return hsv.v - hsv.v * hsv.s * Math.max(Math.min(k, 4 - k, 1), 0);
};
return HandleGet_1.HandleGetHex(options && options.type ? options.type : 'hex', {
r: f(5),
g: f(3),
b: f(1),
a: hsv.a
});
}
exports.HSVToHEX = HSVToHEX;
/**
* Takes an `RGBColor` and converts it to `String` (HEX Format)
*/
function RGBToHEX(color, type) {
return HandleGet_1.HandleGetHex(type ? type : 'hex', {
r: color.r,
g: color.g,
b: color.b,
a: color.a
});
}
exports.RGBToHEX = RGBToHEX;

60
node_modules/s.color/lib/ColorTypes.d.ts generated vendored Executable file
View file

@ -0,0 +1,60 @@
/**
* Represents a color in the rgb(a) format.
*
*
* Range `[0 - 1]`
*/
export declare class RGBColor {
/**
* Range [0-1]
*/
r: number;
/**
* Range [0-1]
*/
g: number;
/**
* Range [0-1]
*/
b: number;
/**
* Range [0-1]
*/
a: number;
constructor(r: number, g: number, b: number, a?: number);
}
/**
* Represents a color in the hsv(a) format.
*
*
* Range `[h 0 - 360, v/s/a 0 - 1]`
*/
export declare class HSVColor {
/**
* Range [0-360]
*/
h: number;
/**
* Range [0-100]
*/
s: number;
/**
* Range [0-100]
*/
v: number;
/**
* Range [0-1]
*/
a: number;
constructor(h: number, s: number, v: number, a?: number);
}
/**
* Represents a color in a string format.
* Valid strings are `#000 | #0000 | #000000 | #00000000`
* Or `rgb(0, 0, 0, 0) | rgba(0, 0, 0, 0, 0)` Range [rgb 0-255, a: 0-1]
*
*/
export declare class StringColor {
color: string;
constructor(color: string);
}

49
node_modules/s.color/lib/ColorTypes.js generated vendored Executable file
View file

@ -0,0 +1,49 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var validators_1 = require("./validators");
/**
* Represents a color in the rgb(a) format.
*
*
* Range `[0 - 1]`
*/
var RGBColor = /** @class */ (function () {
function RGBColor(r, g, b, a) {
this.r = r;
this.g = g;
this.b = b;
this.a = a !== undefined ? a : 1;
}
return RGBColor;
}());
exports.RGBColor = RGBColor;
/**
* Represents a color in the hsv(a) format.
*
*
* Range `[h 0 - 360, v/s/a 0 - 1]`
*/
var HSVColor = /** @class */ (function () {
function HSVColor(h, s, v, a) {
this.h = h;
this.s = s;
this.v = v;
this.a = a !== undefined ? a : 1;
}
return HSVColor;
}());
exports.HSVColor = HSVColor;
/**
* Represents a color in a string format.
* Valid strings are `#000 | #0000 | #000000 | #00000000`
* Or `rgb(0, 0, 0, 0) | rgba(0, 0, 0, 0, 0)` Range [rgb 0-255, a: 0-1]
*
*/
var StringColor = /** @class */ (function () {
function StringColor(color) {
var newColor = validators_1.isValidStringColor(color);
this.color = newColor !== null ? newColor : '#0000';
}
return StringColor;
}());
exports.StringColor = StringColor;

3
node_modules/s.color/lib/HandleGet.d.ts generated vendored Executable file
View file

@ -0,0 +1,3 @@
import { GetColorType, GetColorOptions } from './interfaces';
import { RGBColor } from './ColorTypes';
export declare function HandleGetHex(type: GetColorType, color: RGBColor, options?: GetColorOptions): string;

38
node_modules/s.color/lib/HandleGet.js generated vendored Executable file
View file

@ -0,0 +1,38 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
function HandleGetHex(type, color, options) {
var isLong = color.b > 1 || color.g > 1 || color.r > 1;
var alpha = Math.round(color.a > 1 ? color.a : color.a * 255).toString(16);
var red = Math.round(isLong ? color.r : color.r * 255).toString(16);
var green = Math.round(isLong ? color.g : color.g * 255).toString(16);
var blue = Math.round(isLong ? color.b : color.b * 255).toString(16);
if (options && options.UpperCaseHex) {
alpha = alpha.toUpperCase();
red = red.toUpperCase();
green = green.toUpperCase();
blue = blue.toUpperCase();
}
switch (type) {
case 'hex':
return "#" + (red.length === 1 ? '0' + red : red)
.concat(green.length === 1 ? '0' + green : green)
.concat(blue.length === 1 ? '0' + blue : blue)
.concat(alpha.length === 1 ? '0' + alpha : alpha);
case 'hex-short':
return "#" + red
.substring(0, 1)
.concat(green.substring(0, 1))
.concat(blue.substring(0, 1))
.concat(alpha.substring(0, 1));
case 'hex-without-alpha':
return "#" + (red.length === 1 ? '0' + red : red)
.concat(green.length === 1 ? '0' + green : green)
.concat(blue.length === 1 ? '0' + blue : blue);
case 'hex-without-alpha-short':
return "#" + red
.substring(0, 1)
.concat(green.substring(0, 1))
.concat(blue.substring(0, 1));
}
}
exports.HandleGetHex = HandleGetHex;

6
node_modules/s.color/lib/HandleSet.d.ts generated vendored Executable file
View file

@ -0,0 +1,6 @@
import { RGBColor } from './ColorTypes';
export declare function ConvertString(input: string, return255?: boolean, alpha255?: boolean): RGBColor;
/**
* **assumes that the input is valid**
*/
export declare function HandleConvertHexString(text: string, return255?: boolean, alpha255?: boolean): RGBColor;

49
node_modules/s.color/lib/HandleSet.js generated vendored Executable file
View file

@ -0,0 +1,49 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var validators_1 = require("./validators");
var ColorTypes_1 = require("./ColorTypes");
function ConvertString(input, return255, alpha255) {
if (validators_1.isValidStringColor(input)) {
if (input.startsWith('#')) {
return HandleConvertHexString(input, return255, alpha255);
}
else if (input.startsWith('rgb')) {
return HandleConvertRgbString(input, return255);
}
}
}
exports.ConvertString = ConvertString;
/**
* **assumes that the input is valid**
*/
function HandleConvertHexString(text, return255, alpha255) {
var color = { red: 0, green: 0, blue: 0, alpha: 0 };
var raw = text.replace('#', '');
var length = raw.length;
var modulo = length % 3;
color.red =
length > 4 ? parseInt(raw.substring(0, 2), 16) : parseInt(raw.substring(0, 1).concat(raw.substring(0, 1)), 16);
color.green =
length > 4 ? parseInt(raw.substring(2, 4), 16) : parseInt(raw.substring(1, 2).concat(raw.substring(1, 2)), 16);
color.blue =
length > 4 ? parseInt(raw.substring(4, 6), 16) : parseInt(raw.substring(2, 3).concat(raw.substring(2, 3)), 16);
if (modulo) {
color.alpha =
length > 4
? parseInt(raw.substring(length - modulo, length), 16)
: parseInt(raw.substring(length - modulo, length).concat(raw.substring(length - modulo, length)), 16);
color.alpha = alpha255 ? color.alpha : color.alpha / 255;
}
else {
color.alpha = 1;
}
return new ColorTypes_1.RGBColor(return255 ? color.red : color.red / 255, return255 ? color.green : color.green / 255, return255 ? color.blue : color.blue / 255, color.alpha);
}
exports.HandleConvertHexString = HandleConvertHexString;
/**
* **assumes that the input is valid**
*/
function HandleConvertRgbString(text, return255) {
var split = text.split(/,|\b /g);
return new ColorTypes_1.RGBColor(parseInt(split[0].replace(/\D/g, '')) / (return255 ? 1 : 255), parseInt(split[1].replace(/\D/g, '')) / (return255 ? 1 : 255), parseInt(split[2].replace(/\D/g, '')) / (return255 ? 1 : 255), split[3] ? parseFloat(split[3].replace(/[^\.\d]/g, '')) : 1);
}

6
node_modules/s.color/lib/UtilityFunction.d.ts generated vendored Executable file
View file

@ -0,0 +1,6 @@
import { RGBColor, HSVColor, StringColor } from './ColorTypes';
export declare function GetReadableTextColor(color: RGBColor | HSVColor | StringColor | string): RGBColor | HSVColor | "#000" | "#fff";
/**
* Shifts the hue of the `HSVColor` by the Value
*/
export declare function ShiftHue(hsv: HSVColor, value: number): HSVColor;

38
node_modules/s.color/lib/UtilityFunction.js generated vendored Executable file
View file

@ -0,0 +1,38 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var ColorConverters_1 = require("./ColorConverters");
var ColorTypes_1 = require("./ColorTypes");
function GetReadableTextColor(color) {
if (typeof color === 'string') {
var rgb = ColorConverters_1.StringToRGB(color);
return (rgb.r * 299 + rgb.g * 587 + rgb.b * 114) / 1000 > 0.5 ? '#000' : '#fff';
}
else if (color instanceof ColorTypes_1.StringColor) {
var rgb = ColorConverters_1.StringToRGB(color.color);
return (rgb.r * 299 + rgb.g * 587 + rgb.b * 114) / 1000 > 0.5 ? '#000' : '#fff';
}
else if (color instanceof ColorTypes_1.RGBColor) {
var isLong = color.b > 1 || color.g > 1 || color.r > 1;
var v = isLong ? 255 : 1;
return (color.r * 299 + color.g * 587 + color.b * 114) / 1000 > 0.5 ? new ColorTypes_1.RGBColor(0, 0, 0) : new ColorTypes_1.RGBColor(v, v, v);
}
else if (color instanceof ColorTypes_1.HSVColor) {
var rgb = ColorConverters_1.HSVToRGB(color);
return (rgb.r * 299 + rgb.g * 587 + rgb.b * 114) / 1000 > 0.5
? new ColorTypes_1.HSVColor(0, 0, 0)
: new ColorTypes_1.HSVColor(0, 0, color.s > 1 || color.v > 1 ? 100 : 1);
}
}
exports.GetReadableTextColor = GetReadableTextColor;
/**
* Shifts the hue of the `HSVColor` by the Value
*/
function ShiftHue(hsv, value) {
if (value > 360)
value = value % 360;
else if (value < 0)
value = -(Math.abs(value) % 360);
hsv.h = hsv.h + value <= 360 ? hsv.h + value : hsv.h + value - 360;
return hsv;
}
exports.ShiftHue = ShiftHue;

13
node_modules/s.color/lib/index.d.ts generated vendored Executable file
View file

@ -0,0 +1,13 @@
import { GetColorType, GetColorOptions } from './interfaces';
import { RGBColor } from './ColorTypes';
export * from './ColorTypes';
export * from './ColorConverters';
export * from './regex';
export * from './validators';
export * from './utils';
export default class Color {
private color;
constructor(input?: string | RGBColor);
Get(type?: GetColorType, options?: GetColorOptions): string | RGBColor | import("./ColorTypes").HSVColor;
Set(input: string | RGBColor): void;
}

55
node_modules/s.color/lib/index.js generated vendored Executable file
View file

@ -0,0 +1,55 @@
"use strict";
function __export(m) {
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
}
Object.defineProperty(exports, "__esModule", { value: true });
var HandleGet_1 = require("./HandleGet");
var HandleSet_1 = require("./HandleSet");
var ColorTypes_1 = require("./ColorTypes");
var ColorConverters_1 = require("./ColorConverters");
__export(require("./ColorTypes"));
__export(require("./ColorConverters"));
__export(require("./regex"));
__export(require("./validators"));
__export(require("./utils"));
var Color = /** @class */ (function () {
function Color(input) {
this.Set(input);
}
Color.prototype.Get = function (type, options) {
if (type !== undefined) {
if (type.startsWith('hex')) {
return HandleGet_1.HandleGetHex(type, this.color, options);
}
else {
switch (type) {
case 'rgb':
return "rgb(" + Math.round(this.color.r * 255) + ", " + Math.round(this.color.g * 255) + ", " + Math.round(this.color.b * 255) + ")";
case 'rgba':
return "rgba(" + Math.round(this.color.r * 255) + ", " + Math.round(this.color.g * 255) + ", " + Math.round(this.color.b * 255) + ", " + this.color.a.toFixed(2).toString() + ")";
case 'object':
return this.color;
case 'hsv':
return ColorConverters_1.RGBToHSV(this.color);
}
}
}
else {
return this.color;
}
};
Color.prototype.Set = function (input) {
if (typeof input === 'object') {
this.color = new ColorTypes_1.RGBColor(input.r === undefined ? 1 : input.r > 1 ? input.r / 255 : input.r, input.g === undefined ? 1 : input.g > 1 ? input.g / 255 : input.g, input.b === undefined ? 1 : input.b > 1 ? input.b / 255 : input.b, input.a === undefined ? 1 : input.a > 1 ? input.a / 255 : input.a);
}
else if (typeof input === 'string') {
var tempColor = HandleSet_1.ConvertString(input);
this.color = tempColor === null ? this.color : tempColor;
}
else {
this.color = new ColorTypes_1.RGBColor(0, 0, 0, 0);
}
};
return Color;
}());
exports.default = Color;

8
node_modules/s.color/lib/interfaces.d.ts generated vendored Executable file
View file

@ -0,0 +1,8 @@
export declare type GetColorTypeHex = 'hex' | 'hex-short' | 'hex-without-alpha' | 'hex-without-alpha-short';
export declare type GetColorType = 'rgb' | GetColorTypeHex | 'rgba' | 'object' | 'hsv';
export interface GetColorOptions {
/**
* if true `#fff` will be output as `#FFF`
*/
UpperCaseHex: boolean;
}

2
node_modules/s.color/lib/interfaces.js generated vendored Executable file
View file

@ -0,0 +1,2 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });

2
node_modules/s.color/lib/regex.d.ts generated vendored Executable file
View file

@ -0,0 +1,2 @@
export declare function isValidHex(text: string): boolean;
export declare function isValidRGB(text: string): boolean;

10
node_modules/s.color/lib/regex.js generated vendored Executable file
View file

@ -0,0 +1,10 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
function isValidHex(text) {
return /^#[a-fA-F\d]{3,4}$|^#[a-fA-F\d]{6}$|^#[a-fA-F\d]{8}$/.test(text);
}
exports.isValidHex = isValidHex;
function isValidRGB(text) {
return /rgba?\([\d. ]+[, ][\d. ]+[, ][\d. ]+([, ][\d. ]+)?\)/.test(text);
}
exports.isValidRGB = isValidRGB;

8
node_modules/s.color/lib/utils.d.ts generated vendored Normal file
View file

@ -0,0 +1,8 @@
import { RGBColor, HSVColor, StringColor } from './ColorTypes';
export declare function GetReadableTextColor(color: RGBColor | HSVColor | StringColor | string): RGBColor | HSVColor | "#000" | "#fff";
/**
* Shifts the hue of the `HSVColor` by the Value
*/
export declare function ShiftHue(hsv: HSVColor, value: number): HSVColor;
/**Returns the hex value of the color string or the input string */
export declare function convertCssColorToHex(color: string): string;

191
node_modules/s.color/lib/utils.js generated vendored Normal file
View file

@ -0,0 +1,191 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var ColorConverters_1 = require("./ColorConverters");
var ColorTypes_1 = require("./ColorTypes");
// TODO Add Description
function GetReadableTextColor(color) {
if (typeof color === 'string') {
var rgb = ColorConverters_1.StringToRGB(color);
return (rgb.r * 299 + rgb.g * 587 + rgb.b * 114) / 1000 > 0.5 ? '#000' : '#fff';
}
else if (color instanceof ColorTypes_1.StringColor) {
var rgb = ColorConverters_1.StringToRGB(color.color);
return (rgb.r * 299 + rgb.g * 587 + rgb.b * 114) / 1000 > 0.5 ? '#000' : '#fff';
}
else if (color instanceof ColorTypes_1.RGBColor) {
var isLong = color.b > 1 || color.g > 1 || color.r > 1;
var v = isLong ? 255 : 1;
return (color.r * 299 + color.g * 587 + color.b * 114) / 1000 > 0.5
? new ColorTypes_1.RGBColor(0, 0, 0)
: new ColorTypes_1.RGBColor(v, v, v);
}
else if (color instanceof ColorTypes_1.HSVColor) {
var rgb = ColorConverters_1.HSVToRGB(color);
return (rgb.r * 299 + rgb.g * 587 + rgb.b * 114) / 1000 > 0.5
? new ColorTypes_1.HSVColor(0, 0, 0)
: new ColorTypes_1.HSVColor(0, 0, color.s > 1 || color.v > 1 ? 100 : 1);
}
}
exports.GetReadableTextColor = GetReadableTextColor;
/**
* Shifts the hue of the `HSVColor` by the Value
*/
function ShiftHue(hsv, value) {
if (value > 360)
value = value % 360;
else if (value < 0)
value = -(Math.abs(value) % 360);
hsv.h = hsv.h + value <= 360 ? hsv.h + value : hsv.h + value - 360;
return hsv;
}
exports.ShiftHue = ShiftHue;
/**Returns the hex value of the color string or the input string */
function convertCssColorToHex(color) {
if (cssColors[color.toLowerCase()] !== undefined)
return cssColors[color.toLowerCase()];
return color;
}
exports.convertCssColorToHex = convertCssColorToHex;
var cssColors = {
aliceblue: '#f0f8ff',
antiquewhite: '#faebd7',
aqua: '#00ffff',
aquamarine: '#7fffd4',
azure: '#f0ffff',
beige: '#f5f5dc',
bisque: '#ffe4c4',
black: '#000000',
blanchedalmond: '#ffebcd',
blue: '#0000ff',
blueviolet: '#8a2be2',
brown: '#a52a2a',
burlywood: '#deb887',
cadetblue: '#5f9ea0',
chartreuse: '#7fff00',
chocolate: '#d2691e',
coral: '#ff7f50',
cornflowerblue: '#6495ed',
cornsilk: '#fff8dc',
crimson: '#dc143c',
cyan: '#00ffff',
darkblue: '#00008b',
darkcyan: '#008b8b',
darkgoldenrod: '#b8860b',
darkgray: '#a9a9a9',
darkgreen: '#006400',
darkkhaki: '#bdb76b',
darkmagenta: '#8b008b',
darkolivegreen: '#556b2f',
darkorange: '#ff8c00',
darkorchid: '#9932cc',
darkred: '#8b0000',
darksalmon: '#e9967a',
darkseagreen: '#8fbc8f',
darkslateblue: '#483d8b',
darkslategray: '#2f4f4f',
darkturquoise: '#00ced1',
darkviolet: '#9400d3',
deeppink: '#ff1493',
deepskyblue: '#00bfff',
dimgray: '#696969',
dodgerblue: '#1e90ff',
firebrick: '#b22222',
floralwhite: '#fffaf0',
forestgreen: '#228b22',
fuchsia: '#ff00ff',
gainsboro: '#dcdcdc',
ghostwhite: '#f8f8ff',
gold: '#ffd700',
goldenrod: '#daa520',
gray: '#808080',
green: '#008000',
greenyellow: '#adff2f',
honeydew: '#f0fff0',
hotpink: '#ff69b4',
indianred: '#cd5c5c',
indigo: '#4b0082',
ivory: '#fffff0',
khaki: '#f0e68c',
lavender: '#e6e6fa',
lavenderblush: '#fff0f5',
lawngreen: '#7cfc00',
lemonchiffon: '#fffacd',
lightblue: '#add8e6',
lightcoral: '#f08080',
lightcyan: '#e0ffff',
lightgoldenrodyellow: '#fafad2',
lightgrey: '#d3d3d3',
lightgreen: '#90ee90',
lightpink: '#ffb6c1',
lightsalmon: '#ffa07a',
lightseagreen: '#20b2aa',
lightskyblue: '#87cefa',
lightslategray: '#778899',
lightsteelblue: '#b0c4de',
lightyellow: '#ffffe0',
lime: '#00ff00',
limegreen: '#32cd32',
linen: '#faf0e6',
magenta: '#ff00ff',
maroon: '#800000',
mediumaquamarine: '#66cdaa',
mediumblue: '#0000cd',
mediumorchid: '#ba55d3',
mediumpurple: '#9370d8',
mediumseagreen: '#3cb371',
mediumslateblue: '#7b68ee',
mediumspringgreen: '#00fa9a',
mediumturquoise: '#48d1cc',
mediumvioletred: '#c71585',
midnightblue: '#191970',
mintcream: '#f5fffa',
mistyrose: '#ffe4e1',
moccasin: '#ffe4b5',
navajowhite: '#ffdead',
navy: '#000080',
oldlace: '#fdf5e6',
olive: '#808000',
olivedrab: '#6b8e23',
orange: '#ffa500',
orangered: '#ff4500',
orchid: '#da70d6',
palegoldenrod: '#eee8aa',
palegreen: '#98fb98',
paleturquoise: '#afeeee',
palevioletred: '#d87093',
papayawhip: '#ffefd5',
peachpuff: '#ffdab9',
peru: '#cd853f',
pink: '#ffc0cb',
plum: '#dda0dd',
powderblue: '#b0e0e6',
purple: '#800080',
rebeccapurple: '#663399',
red: '#ff0000',
rosybrown: '#bc8f8f',
royalblue: '#4169e1',
saddlebrown: '#8b4513',
salmon: '#fa8072',
sandybrown: '#f4a460',
seagreen: '#2e8b57',
seashell: '#fff5ee',
sienna: '#a0522d',
silver: '#c0c0c0',
skyblue: '#87ceeb',
slateblue: '#6a5acd',
slategray: '#708090',
snow: '#fffafa',
springgreen: '#00ff7f',
steelblue: '#4682b4',
tan: '#d2b48c',
teal: '#008080',
thistle: '#d8bfd8',
tomato: '#ff6347',
turquoise: '#40e0d0',
violet: '#ee82ee',
wheat: '#f5deb3',
white: '#ffffff',
whitesmoke: '#f5f5f5',
yellow: '#ffff00',
yellowgreen: '#9acd32'
};

1
node_modules/s.color/lib/validators.d.ts generated vendored Executable file
View file

@ -0,0 +1 @@
export declare function isValidStringColor(input: string): string;

13
node_modules/s.color/lib/validators.js generated vendored Executable file
View file

@ -0,0 +1,13 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var regex_1 = require("./regex");
function isValidStringColor(input) {
if (regex_1.isValidHex(input) || regex_1.isValidRGB(input)) {
return input;
}
else {
console.warn('[S.Color] Invalid String Input:', input);
return null;
}
}
exports.isValidStringColor = isValidStringColor;

38
node_modules/s.color/package.json generated vendored Normal file
View file

@ -0,0 +1,38 @@
{
"name": "s.color",
"version": "0.0.15",
"description": "Simple color library.",
"main": "lib/index.js",
"files": [
"lib",
"README.md"
],
"directories": {
"lib": "lib"
},
"scripts": {
"prepack": "tsc -b && npm run test && suf",
"test": "jest --coverage",
"test:watch": "jest --watch --coverage"
},
"author": "Syler",
"license": "MIT",
"devDependencies": {
"jest": "^24.9.0",
"ts-jest": "^24.0.2",
"suf-cli": "^0.1.0",
"@types/jest": "^24.0.18",
"typescript": "^3.6.2"
},
"repository": {
"type": "git",
"url": "https://github.com/TheRealSyler/s.color"
},
"keywords": [
"color",
"rgb",
"hex",
"rgba"
],
"dependencies": {}
}