完成世界书、骰子、apiconfig页面处理
This commit is contained in:
14
frontend/node_modules/khroma/dist/methods/adjust_channel.js
generated
vendored
Normal file
14
frontend/node_modules/khroma/dist/methods/adjust_channel.js
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
/* IMPORT */
|
||||
import _ from '../utils/index.js';
|
||||
import Color from '../color/index.js';
|
||||
/* MAIN */
|
||||
const adjustChannel = (color, channel, amount) => {
|
||||
const channels = Color.parse(color);
|
||||
const amountCurrent = channels[channel];
|
||||
const amountNext = _.channel.clamp[channel](amountCurrent + amount);
|
||||
if (amountCurrent !== amountNext)
|
||||
channels[channel] = amountNext;
|
||||
return Color.stringify(channels);
|
||||
};
|
||||
/* EXPORT */
|
||||
export default adjustChannel;
|
||||
8
frontend/node_modules/khroma/dist/methods/alpha.js
generated
vendored
Normal file
8
frontend/node_modules/khroma/dist/methods/alpha.js
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
/* IMPORT */
|
||||
import channel from './channel.js';
|
||||
/* MAIN */
|
||||
const alpha = (color) => {
|
||||
return channel(color, 'a');
|
||||
};
|
||||
/* EXPORT */
|
||||
export default alpha;
|
||||
3
frontend/node_modules/khroma/dist/methods/blue.d.ts
generated
vendored
Normal file
3
frontend/node_modules/khroma/dist/methods/blue.d.ts
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
import type { Channels } from '../types';
|
||||
declare const blue: (color: string | Channels) => number;
|
||||
export default blue;
|
||||
3
frontend/node_modules/khroma/dist/methods/complement.d.ts
generated
vendored
Normal file
3
frontend/node_modules/khroma/dist/methods/complement.d.ts
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
import type { Channels } from '../types';
|
||||
declare const complement: (color: string | Channels) => string;
|
||||
export default complement;
|
||||
2
frontend/node_modules/khroma/dist/methods/contrast.d.ts
generated
vendored
Normal file
2
frontend/node_modules/khroma/dist/methods/contrast.d.ts
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
declare const contrast: (color1: string, color2: string) => number;
|
||||
export default contrast;
|
||||
3
frontend/node_modules/khroma/dist/methods/darken.d.ts
generated
vendored
Normal file
3
frontend/node_modules/khroma/dist/methods/darken.d.ts
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
import type { Channels } from '../types';
|
||||
declare const darken: (color: string | Channels, amount: number) => string;
|
||||
export default darken;
|
||||
3
frontend/node_modules/khroma/dist/methods/desaturate.d.ts
generated
vendored
Normal file
3
frontend/node_modules/khroma/dist/methods/desaturate.d.ts
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
import type { Channels } from '../types';
|
||||
declare const desaturate: (color: string | Channels, amount: number) => string;
|
||||
export default desaturate;
|
||||
8
frontend/node_modules/khroma/dist/methods/grayscale.js
generated
vendored
Normal file
8
frontend/node_modules/khroma/dist/methods/grayscale.js
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
/* IMPORT */
|
||||
import change from './change.js';
|
||||
/* MAIN */
|
||||
const grayscale = (color) => {
|
||||
return change(color, { s: 0 });
|
||||
};
|
||||
/* EXPORT */
|
||||
export default grayscale;
|
||||
8
frontend/node_modules/khroma/dist/methods/green.js
generated
vendored
Normal file
8
frontend/node_modules/khroma/dist/methods/green.js
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
/* IMPORT */
|
||||
import channel from './channel.js';
|
||||
/* MAIN */
|
||||
const green = (color) => {
|
||||
return channel(color, 'g');
|
||||
};
|
||||
/* EXPORT */
|
||||
export default green;
|
||||
16
frontend/node_modules/khroma/dist/methods/hsla.js
generated
vendored
Normal file
16
frontend/node_modules/khroma/dist/methods/hsla.js
generated
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
/* IMPORT */
|
||||
import _ from '../utils/index.js';
|
||||
import ChannelsReusable from '../channels/reusable.js';
|
||||
import Color from '../color/index.js';
|
||||
/* MAIN */
|
||||
const hsla = (h, s, l, a = 1) => {
|
||||
const channels = ChannelsReusable.set({
|
||||
h: _.channel.clamp.h(h),
|
||||
s: _.channel.clamp.s(s),
|
||||
l: _.channel.clamp.l(l),
|
||||
a: _.channel.clamp.a(a)
|
||||
});
|
||||
return Color.stringify(channels);
|
||||
};
|
||||
/* EXPORT */
|
||||
export default hsla;
|
||||
40
frontend/node_modules/khroma/dist/methods/index.d.ts
generated
vendored
Normal file
40
frontend/node_modules/khroma/dist/methods/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,40 @@
|
||||
import hex from './rgba';
|
||||
import rgb from './rgba';
|
||||
import rgba from './rgba';
|
||||
import hsl from './hsla';
|
||||
import hsla from './hsla';
|
||||
import toKeyword from './to_keyword';
|
||||
import toHex from './to_hex';
|
||||
import toRgba from './to_rgba';
|
||||
import toHsla from './to_hsla';
|
||||
import channel from './channel';
|
||||
import red from './red';
|
||||
import green from './green';
|
||||
import blue from './blue';
|
||||
import hue from './hue';
|
||||
import saturation from './saturation';
|
||||
import lightness from './lightness';
|
||||
import alpha from './alpha';
|
||||
import opacity from './alpha';
|
||||
import contrast from './contrast';
|
||||
import luminance from './luminance';
|
||||
import isDark from './is_dark';
|
||||
import isLight from './is_light';
|
||||
import isTransparent from './is_transparent';
|
||||
import isValid from './is_valid';
|
||||
import saturate from './saturate';
|
||||
import desaturate from './desaturate';
|
||||
import lighten from './lighten';
|
||||
import darken from './darken';
|
||||
import opacify from './opacify';
|
||||
import fadeIn from './opacify';
|
||||
import transparentize from './transparentize';
|
||||
import fadeOut from './transparentize';
|
||||
import complement from './complement';
|
||||
import grayscale from './grayscale';
|
||||
import adjust from './adjust';
|
||||
import change from './change';
|
||||
import invert from './invert';
|
||||
import mix from './mix';
|
||||
import scale from './scale';
|
||||
export { hex, rgb, rgba, hsl, hsla, toKeyword, toHex, toRgba, toHsla, channel, red, green, blue, hue, saturation, lightness, alpha, opacity, contrast, luminance, isDark, isLight, isTransparent, isValid, saturate, desaturate, lighten, darken, opacify, fadeIn, transparentize, fadeOut, complement, grayscale, adjust, change, invert, mix, scale };
|
||||
3
frontend/node_modules/khroma/dist/methods/is_transparent.d.ts
generated
vendored
Normal file
3
frontend/node_modules/khroma/dist/methods/is_transparent.d.ts
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
import type { Channels } from '../types';
|
||||
declare const isTransparent: (color: string | Channels) => boolean;
|
||||
export default isTransparent;
|
||||
14
frontend/node_modules/khroma/dist/methods/is_valid.js
generated
vendored
Normal file
14
frontend/node_modules/khroma/dist/methods/is_valid.js
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
/* IMPORT */
|
||||
import Color from '../color/index.js';
|
||||
/* MAIN */
|
||||
const isValid = (color) => {
|
||||
try {
|
||||
Color.parse(color);
|
||||
return true;
|
||||
}
|
||||
catch {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
/* EXPORT */
|
||||
export default isValid;
|
||||
3
frontend/node_modules/khroma/dist/methods/lightness.d.ts
generated
vendored
Normal file
3
frontend/node_modules/khroma/dist/methods/lightness.d.ts
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
import type { Channels } from '../types';
|
||||
declare const lightness: (color: string | Channels) => number;
|
||||
export default lightness;
|
||||
8
frontend/node_modules/khroma/dist/methods/lightness.js
generated
vendored
Normal file
8
frontend/node_modules/khroma/dist/methods/lightness.js
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
/* IMPORT */
|
||||
import channel from './channel.js';
|
||||
/* MAIN */
|
||||
const lightness = (color) => {
|
||||
return channel(color, 'l');
|
||||
};
|
||||
/* EXPORT */
|
||||
export default lightness;
|
||||
22
frontend/node_modules/khroma/dist/methods/mix.js
generated
vendored
Normal file
22
frontend/node_modules/khroma/dist/methods/mix.js
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
/* IMPORT */
|
||||
import Color from '../color/index.js';
|
||||
import rgba from './rgba.js';
|
||||
/* MAIN */
|
||||
//SOURCE: https://github.com/sass/dart-sass/blob/7457d2e9e7e623d9844ffd037a070cf32d39c348/lib/src/functions/color.dart#L718-L756
|
||||
const mix = (color1, color2, weight = 50) => {
|
||||
const { r: r1, g: g1, b: b1, a: a1 } = Color.parse(color1);
|
||||
const { r: r2, g: g2, b: b2, a: a2 } = Color.parse(color2);
|
||||
const weightScale = weight / 100;
|
||||
const weightNormalized = (weightScale * 2) - 1;
|
||||
const alphaDelta = a1 - a2;
|
||||
const weight1combined = ((weightNormalized * alphaDelta) === -1) ? weightNormalized : (weightNormalized + alphaDelta) / (1 + weightNormalized * alphaDelta);
|
||||
const weight1 = (weight1combined + 1) / 2;
|
||||
const weight2 = 1 - weight1;
|
||||
const r = (r1 * weight1) + (r2 * weight2);
|
||||
const g = (g1 * weight1) + (g2 * weight2);
|
||||
const b = (b1 * weight1) + (b2 * weight2);
|
||||
const a = (a1 * weightScale) + (a2 * (1 - weightScale));
|
||||
return rgba(r, g, b, a);
|
||||
};
|
||||
/* EXPORT */
|
||||
export default mix;
|
||||
8
frontend/node_modules/khroma/dist/methods/opacify.js
generated
vendored
Normal file
8
frontend/node_modules/khroma/dist/methods/opacify.js
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
/* IMPORT */
|
||||
import adjustChannel from './adjust_channel.js';
|
||||
/* MAIN */
|
||||
const opacify = (color, amount) => {
|
||||
return adjustChannel(color, 'a', amount);
|
||||
};
|
||||
/* EXPORT */
|
||||
export default opacify;
|
||||
19
frontend/node_modules/khroma/dist/methods/rgba.js
generated
vendored
Normal file
19
frontend/node_modules/khroma/dist/methods/rgba.js
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
/* IMPORT */
|
||||
import _ from '../utils/index.js';
|
||||
import ChannelsReusable from '../channels/reusable.js';
|
||||
import Color from '../color/index.js';
|
||||
import change from './change.js';
|
||||
/* MAIN */
|
||||
const rgba = (r, g, b = 0, a = 1) => {
|
||||
if (typeof r !== 'number')
|
||||
return change(r, { a: g });
|
||||
const channels = ChannelsReusable.set({
|
||||
r: _.channel.clamp.r(r),
|
||||
g: _.channel.clamp.g(g),
|
||||
b: _.channel.clamp.b(b),
|
||||
a: _.channel.clamp.a(a)
|
||||
});
|
||||
return Color.stringify(channels);
|
||||
};
|
||||
/* EXPORT */
|
||||
export default rgba;
|
||||
8
frontend/node_modules/khroma/dist/methods/transparentize.js
generated
vendored
Normal file
8
frontend/node_modules/khroma/dist/methods/transparentize.js
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
/* IMPORT */
|
||||
import adjustChannel from './adjust_channel.js';
|
||||
/* MAIN */
|
||||
const transparentize = (color, amount) => {
|
||||
return adjustChannel(color, 'a', -amount);
|
||||
};
|
||||
/* EXPORT */
|
||||
export default transparentize;
|
||||
Reference in New Issue
Block a user