yuyeon 0.3.4-beta.12 → 0.3.4-beta.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/style.css +1 -1
- package/dist/yuyeon.js +2 -2
- package/dist/yuyeon.umd.cjs +1 -1
- package/lib/components/table/YDataTableBody.js +1 -1
- package/lib/components/table/YDataTableBody.js.map +1 -1
- package/lib/directives/plate-wave/plate-wave.scss +17 -6
- package/lib/util/ui.js +8 -7
- package/lib/util/ui.js.map +1 -1
- package/package.json +1 -1
- package/types/src/abstract/items.d.ts +49 -0
- package/types/src/components/alert/YAlert.d.ts +13 -0
- package/types/src/components/alert/index.d.ts +1 -0
- package/types/src/components/app/YApp.d.ts +8 -0
- package/types/src/components/app/index.d.ts +1 -0
- package/types/src/components/badge/YBadge.d.ts +126 -0
- package/types/src/components/badge/index.d.ts +1 -0
- package/types/src/components/bench/YBench.d.ts +4 -0
- package/types/src/components/bench/index.d.ts +1 -0
- package/types/src/components/button/YButton.d.ts +189 -0
- package/types/src/components/button/index.d.ts +1 -0
- package/types/src/components/card/YCard.d.ts +9 -0
- package/types/src/components/card/YCardBody.d.ts +2 -0
- package/types/src/components/card/YCardFooter.d.ts +2 -0
- package/types/src/components/card/YCardHeader.d.ts +2 -0
- package/types/src/components/card/index.d.ts +4 -0
- package/types/src/components/checkbox/YCheckbox.d.ts +23 -0
- package/types/src/components/checkbox/YInputCheckbox.d.ts +31 -0
- package/types/src/components/checkbox/index.d.ts +4 -0
- package/types/src/components/chip/YChip.d.ts +37 -0
- package/types/src/components/chip/index.d.ts +1 -0
- package/types/src/components/date-picker/YDateCalendar.d.ts +115 -0
- package/types/src/components/date-picker/YDatePicker.d.ts +94 -0
- package/types/src/components/date-picker/YDatePickerControl.d.ts +97 -0
- package/types/src/components/date-picker/YMonthPicker.d.ts +25 -0
- package/types/src/components/date-picker/YYearPicker.d.ts +38 -0
- package/types/src/components/date-picker/index.d.ts +3 -0
- package/types/src/components/default-provider/YDefaultProvider.d.ts +0 -0
- package/types/src/components/default-provider/index.d.ts +0 -0
- package/types/src/components/dialog/YDialog.d.ts +715 -0
- package/types/src/components/dialog/index.d.ts +1 -0
- package/types/src/components/divider/YDivider.d.ts +14 -0
- package/types/src/components/divider/index.d.ts +1 -0
- package/types/src/components/draggable/YDraggable.d.ts +36 -0
- package/types/src/components/draggable/index.d.ts +1 -0
- package/types/src/components/dropdown/YDropdown.d.ts +574 -0
- package/types/src/components/dropdown/index.d.ts +1 -0
- package/types/src/components/field-input/YFieldInput.d.ts +322 -0
- package/types/src/components/field-input/index.d.ts +1 -0
- package/types/src/components/form/YForm.d.ts +20 -0
- package/types/src/components/form/index.d.ts +1 -0
- package/types/src/components/hover/YHover.d.ts +57 -0
- package/types/src/components/hover/index.d.ts +1 -0
- package/types/src/components/icon/YIcon.d.ts +67 -0
- package/types/src/components/icon/index.d.ts +1 -0
- package/types/src/components/icons/YIconCheckbox.d.ts +6 -0
- package/types/src/components/icons/YIconClear.d.ts +1 -0
- package/types/src/components/icons/YIconDropdown.d.ts +1 -0
- package/types/src/components/icons/YIconExpand.d.ts +1 -0
- package/types/src/components/icons/YIconPageControl.d.ts +14 -0
- package/types/src/components/icons/YIconSort.d.ts +10 -0
- package/types/src/components/icons/index.d.ts +51 -0
- package/types/src/components/img/YImg.d.ts +133 -0
- package/types/src/components/img/index.d.ts +0 -0
- package/types/src/components/index.d.ts +38 -0
- package/types/src/components/input/YInput.d.ts +249 -0
- package/types/src/components/input/index.d.ts +1 -0
- package/types/src/components/ip-field/YIpv4Field.d.ts +65 -0
- package/types/src/components/ip-field/index.d.ts +1 -0
- package/types/src/components/layer/YLayer.d.ts +436 -0
- package/types/src/components/layer/active-delay.d.ts +4 -0
- package/types/src/components/layer/active-stack.d.ts +16 -0
- package/types/src/components/layer/base.d.ts +28 -0
- package/types/src/components/layer/content.d.ts +21 -0
- package/types/src/components/layer/index.d.ts +1 -0
- package/types/src/components/layer/scroll-strategies.d.ts +41 -0
- package/types/src/components/list/YList.d.ts +19 -0
- package/types/src/components/list/YListItem.d.ts +42 -0
- package/types/src/components/list/index.d.ts +2 -0
- package/types/src/components/loading/YSpinnerRing.d.ts +3 -0
- package/types/src/components/loading/index.d.ts +1 -0
- package/types/src/components/menu/YMenu.d.ts +517 -0
- package/types/src/components/menu/index.d.ts +1 -0
- package/types/src/components/navigation/YNavigation.d.ts +1 -0
- package/types/src/components/navigation/index.d.ts +1 -0
- package/types/src/components/pagination/YPagination.d.ts +137 -0
- package/types/src/components/pagination/index.d.ts +1 -0
- package/types/src/components/panel/YDividePanel.d.ts +5 -0
- package/types/src/components/panel/index.d.ts +1 -0
- package/types/src/components/plate/YPlate.d.ts +9 -0
- package/types/src/components/plate/index.d.ts +1 -0
- package/types/src/components/progress-bar/YProgressBar.d.ts +38 -0
- package/types/src/components/progress-bar/index.d.ts +1 -0
- package/types/src/components/progress-ring/YProgressRing.d.ts +34 -0
- package/types/src/components/progress-ring/index.d.ts +1 -0
- package/types/src/components/radio/YRadio.d.ts +25 -0
- package/types/src/components/radio/YRadioIcon.d.ts +6 -0
- package/types/src/components/radio/index.d.ts +2 -0
- package/types/src/components/select/YSelect.d.ts +1221 -0
- package/types/src/components/select/index.d.ts +1 -0
- package/types/src/components/slider/YSlider.d.ts +16 -0
- package/types/src/components/slider/index.d.ts +1 -0
- package/types/src/components/slider/slider.d.ts +0 -0
- package/types/src/components/snackbar/YSnackbar.d.ts +452 -0
- package/types/src/components/snackbar/index.d.ts +1 -0
- package/types/src/components/switch/YSwitch.d.ts +137 -0
- package/types/src/components/switch/index.d.ts +1 -0
- package/types/src/components/tab/YTab.d.ts +218 -0
- package/types/src/components/tab/YTabs.d.ts +98 -0
- package/types/src/components/tab/index.d.ts +3 -0
- package/types/src/components/tab/shared.d.ts +4 -0
- package/types/src/components/tab/types.d.ts +5 -0
- package/types/src/components/table/YDataTable.d.ts +459 -0
- package/types/src/components/table/YDataTableBody.d.ts +99 -0
- package/types/src/components/table/YDataTableCell.d.ts +32 -0
- package/types/src/components/table/YDataTableControl.d.ts +68 -0
- package/types/src/components/table/YDataTableHead.d.ts +54 -0
- package/types/src/components/table/YDataTableLayer.d.ts +13 -0
- package/types/src/components/table/YDataTableLayerRow.d.ts +22 -0
- package/types/src/components/table/YDataTableLayerRows.d.ts +9 -0
- package/types/src/components/table/YDataTableRow.d.ts +53 -0
- package/types/src/components/table/YDataTableServer.d.ts +502 -0
- package/types/src/components/table/YTable.d.ts +65 -0
- package/types/src/components/table/composables/expand.d.ts +42 -0
- package/types/src/components/table/composables/header.d.ts +175 -0
- package/types/src/components/table/composables/items.d.ts +55 -0
- package/types/src/components/table/composables/measure.d.ts +8 -0
- package/types/src/components/table/composables/options.d.ts +11 -0
- package/types/src/components/table/composables/pagination.d.ts +81 -0
- package/types/src/components/table/composables/provides.d.ts +15 -0
- package/types/src/components/table/composables/selection.d.ts +82 -0
- package/types/src/components/table/composables/sorted-items.d.ts +7 -0
- package/types/src/components/table/composables/sorting.d.ts +56 -0
- package/types/src/components/table/index.d.ts +10 -0
- package/types/src/components/table/types/common.d.ts +2 -0
- package/types/src/components/table/types/header.d.ts +25 -0
- package/types/src/components/table/types/index.d.ts +59 -0
- package/types/src/components/table/types/item.d.ts +23 -0
- package/types/src/components/table/types/row.d.ts +4 -0
- package/types/src/components/text-ellipsis/YTextEllipsis.d.ts +11 -0
- package/types/src/components/text-ellipsis/index.d.ts +1 -0
- package/types/src/components/text-highlighter/YTextHighlighter.d.ts +26 -0
- package/types/src/components/text-highlighter/index.d.ts +1 -0
- package/types/src/components/text-interpolation/YTi.d.ts +11 -0
- package/types/src/components/text-interpolation/index.d.ts +1 -0
- package/types/src/components/textarea/YTextarea.d.ts +583 -0
- package/types/src/components/textarea/index.d.ts +1 -0
- package/types/src/components/toggle-button/YToggleButton.d.ts +4 -0
- package/types/src/components/toggle-button/index.d.ts +1 -0
- package/types/src/components/tooltip/YTooltip.d.ts +502 -0
- package/types/src/components/tooltip/index.d.ts +1 -0
- package/types/src/components/transitions/expand-transition.d.ts +20 -0
- package/types/src/components/transitions/index.d.ts +38 -0
- package/types/src/components/tree-view/YTreeView.d.ts +172 -0
- package/types/src/components/tree-view/YTreeViewNode.d.ts +176 -0
- package/types/src/components/tree-view/index.d.ts +2 -0
- package/types/src/components/tree-view/tree-view.d.ts +51 -0
- package/types/src/components/tree-view/types.d.ts +17 -0
- package/types/src/components/tree-view/util.d.ts +6 -0
- package/types/src/composables/choice-link.d.ts +3 -0
- package/types/src/composables/choice.d.ts +113 -0
- package/types/src/composables/communication.d.ts +8 -0
- package/types/src/composables/component.d.ts +3 -0
- package/types/src/composables/coordinate/arrangement.d.ts +7 -0
- package/types/src/composables/coordinate/index.d.ts +87 -0
- package/types/src/composables/coordinate/levitation.d.ts +7 -0
- package/types/src/composables/coordinate/types.d.ts +7 -0
- package/types/src/composables/coordinate/utils/point.d.ts +22 -0
- package/types/src/composables/date/factory.d.ts +3 -0
- package/types/src/composables/date/index.d.ts +12 -0
- package/types/src/composables/date/setting.d.ts +5 -0
- package/types/src/composables/date/types.d.ts +13 -0
- package/types/src/composables/defaults/index.d.ts +11 -0
- package/types/src/composables/defaults/share.d.ts +4 -0
- package/types/src/composables/defaults/types.d.ts +12 -0
- package/types/src/composables/dimension.d.ts +54 -0
- package/types/src/composables/focus.d.ts +30 -0
- package/types/src/composables/form.d.ts +132 -0
- package/types/src/composables/i18n/index.d.ts +9 -0
- package/types/src/composables/i18n/locale.d.ts +3 -0
- package/types/src/composables/i18n/rtl.d.ts +21 -0
- package/types/src/composables/i18n/share.d.ts +1 -0
- package/types/src/composables/icon.d.ts +79 -0
- package/types/src/composables/index.d.ts +10 -0
- package/types/src/composables/layer-group.d.ts +10 -0
- package/types/src/composables/layout.d.ts +10 -0
- package/types/src/composables/list-items.d.ts +113 -0
- package/types/src/composables/progress.d.ts +4 -0
- package/types/src/composables/ref.d.ts +6 -0
- package/types/src/composables/resize-observer.d.ts +24 -0
- package/types/src/composables/scope.d.ts +3 -0
- package/types/src/composables/style-color.d.ts +14 -0
- package/types/src/composables/theme/factory.d.ts +4 -0
- package/types/src/composables/theme/helper.d.ts +3 -0
- package/types/src/composables/theme/index.d.ts +57 -0
- package/types/src/composables/theme/setting.d.ts +11 -0
- package/types/src/composables/theme/types.d.ts +29 -0
- package/types/src/composables/timing.d.ts +20 -0
- package/types/src/composables/transition.d.ts +40 -0
- package/types/src/composables/validation.d.ts +82 -0
- package/types/src/composables/vue-router.d.ts +43 -0
- package/types/src/declares.d.ts +1 -0
- package/types/src/directives/complement-click/index.d.ts +26 -0
- package/types/src/directives/index.d.ts +2 -0
- package/types/src/directives/plate-wave/index.d.ts +20 -0
- package/types/src/directives/theme-class/index.d.ts +4 -0
- package/types/src/etc/index.d.ts +1 -0
- package/types/src/globals.d.ts +20 -0
- package/types/src/i18n/built-in.d.ts +3 -0
- package/types/src/i18n/config.d.ts +81 -0
- package/types/src/i18n/types.d.ts +20 -0
- package/types/src/index.d.ts +13 -0
- package/types/src/locales/en.d.ts +6 -0
- package/types/src/locales/index.d.ts +2 -0
- package/types/src/locales/ko.d.ts +6 -0
- package/types/src/mixins/di.d.ts +2 -0
- package/types/src/mixins/rebind-attrs.d.ts +5 -0
- package/types/src/shims.d.ts +64 -0
- package/types/src/types/index.d.ts +9 -0
- package/types/src/util/anchor.d.ts +23 -0
- package/types/src/util/array.d.ts +2 -0
- package/types/src/util/collection.d.ts +1 -0
- package/types/src/util/color/apca.d.ts +29 -0
- package/types/src/util/color/const.d.ts +5 -0
- package/types/src/util/color/contrast/contrast.d.ts +74 -0
- package/types/src/util/color/conversion.d.ts +131 -0
- package/types/src/util/color/hct/cam16.d.ts +116 -0
- package/types/src/util/color/hct/hct-solver.d.ts +131 -0
- package/types/src/util/color/hct/hct.d.ts +71 -0
- package/types/src/util/color/hct/viewing-conditions.d.ts +58 -0
- package/types/src/util/color/index.d.ts +5 -0
- package/types/src/util/color/palettes/core-palette.d.ts +44 -0
- package/types/src/util/color/palettes/tonal-palette.d.ts +40 -0
- package/types/src/util/color/types.d.ts +14 -0
- package/types/src/util/color/utils/math-utils.d.ts +82 -0
- package/types/src/util/common.d.ts +17 -0
- package/types/src/util/component/component.d.ts +5 -0
- package/types/src/util/component/index.d.ts +11 -0
- package/types/src/util/component/inject-self.d.ts +3 -0
- package/types/src/util/component/props.d.ts +32 -0
- package/types/src/util/component/types.d.ts +21 -0
- package/types/src/util/date/adapters/yuyeon-date-adapter.d.ts +43 -0
- package/types/src/util/date/built-in.d.ts +41 -0
- package/types/src/util/date/index.d.ts +3 -0
- package/types/src/util/date/types.d.ts +167 -0
- package/types/src/util/debounce.d.ts +11 -0
- package/types/src/util/dom.d.ts +5 -0
- package/types/src/util/environments.d.ts +6 -0
- package/types/src/util/frame-scheduler.d.ts +7 -0
- package/types/src/util/index.d.ts +16 -0
- package/types/src/util/reactivity.d.ts +7 -0
- package/types/src/util/rect.d.ts +36 -0
- package/types/src/util/scroll.d.ts +3 -0
- package/types/src/util/string.d.ts +9 -0
- package/types/src/util/ui.d.ts +4 -0
- package/types/src/util/validation.d.ts +3 -0
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/** @preserve
|
|
2
|
+
///// SAPC APCA - Advanced Perceptual Contrast Algorithm
|
|
3
|
+
///// Beta 0.1.9 W3 • contrast function only
|
|
4
|
+
///// DIST: W3 • Revision date: July 3, 2022
|
|
5
|
+
///// Function to parse color values and determine Lc contrast
|
|
6
|
+
///// Copyright © 2019-2022 by Andrew Somers. All Rights Reserved.
|
|
7
|
+
///// LICENSE: W3 LICENSE
|
|
8
|
+
///// CONTACT: Please use the ISSUES or DISCUSSIONS tab at:
|
|
9
|
+
///// https://github.com/Myndex/SAPC-APCA/
|
|
10
|
+
/////
|
|
11
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
12
|
+
/////
|
|
13
|
+
///// MINIMAL IMPORTS:
|
|
14
|
+
///// import { APCAcontrast, sRGBtoY, displayP3toY,
|
|
15
|
+
///// calcAPCA, fontLookupAPCA } from 'apca-w3';
|
|
16
|
+
///// import { colorParsley } from 'colorparsley';
|
|
17
|
+
/////
|
|
18
|
+
///// FORWARD CONTRAST USAGE:
|
|
19
|
+
///// Lc = APCAcontrast( sRGBtoY( TEXTcolor ) , sRGBtoY( BACKGNDcolor ) );
|
|
20
|
+
///// Where the colors are sent as an rgba array [255,255,255,1]
|
|
21
|
+
/////
|
|
22
|
+
///// Retrieving an array of font sizes for the contrast:
|
|
23
|
+
///// fontArray = fontLookupAPCA(Lc);
|
|
24
|
+
/////
|
|
25
|
+
///// Live Demonstrator at https://www.myndex.com/APCA/
|
|
26
|
+
// */
|
|
27
|
+
export declare function sRGBtoY(rgb?: number[]): number;
|
|
28
|
+
export declare function APCAcontrast(txtY: number, bgY: number, places?: number): string | number;
|
|
29
|
+
export declare function alphaBlend(rgbaFG?: number[], rgbBG?: number[], round?: boolean): (number | boolean)[];
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Utility methods for calculating contrast given two colors, or calculating a
|
|
3
|
+
* color given one color and a contrast ratio.
|
|
4
|
+
*
|
|
5
|
+
* Contrast ratio is calculated using XYZ's Y. When linearized to match human
|
|
6
|
+
* perception, Y becomes HCT's tone and L*a*b*'s' L*. Informally, this is the
|
|
7
|
+
* lightness of a color.
|
|
8
|
+
*
|
|
9
|
+
* Methods refer to tone, T in the the HCT color space.
|
|
10
|
+
* Tone is equivalent to L* in the L*a*b* color space, or L in the LCH color
|
|
11
|
+
* space.
|
|
12
|
+
*/
|
|
13
|
+
export declare class Contrast {
|
|
14
|
+
/**
|
|
15
|
+
* Returns a contrast ratio, which ranges from 1 to 21.
|
|
16
|
+
*
|
|
17
|
+
* @param toneA Tone between 0 and 100. Values outside will be clamped.
|
|
18
|
+
* @param toneB Tone between 0 and 100. Values outside will be clamped.
|
|
19
|
+
*/
|
|
20
|
+
static ratioOfTones(toneA: number, toneB: number): number;
|
|
21
|
+
static ratioOfYs(y1: number, y2: number): number;
|
|
22
|
+
/**
|
|
23
|
+
* Returns a tone >= tone parameter that ensures ratio parameter.
|
|
24
|
+
* Return value is between 0 and 100.
|
|
25
|
+
* Returns -1 if ratio cannot be achieved with tone parameter.
|
|
26
|
+
*
|
|
27
|
+
* @param tone Tone return value must contrast with.
|
|
28
|
+
* Range is 0 to 100. Invalid values will result in -1 being returned.
|
|
29
|
+
* @param ratio Contrast ratio of return value and tone.
|
|
30
|
+
* Range is 1 to 21, invalid values have undefined behavior.
|
|
31
|
+
*/
|
|
32
|
+
static lighter(tone: number, ratio: number): number;
|
|
33
|
+
/**
|
|
34
|
+
* Returns a tone <= tone parameter that ensures ratio parameter.
|
|
35
|
+
* Return value is between 0 and 100.
|
|
36
|
+
* Returns -1 if ratio cannot be achieved with tone parameter.
|
|
37
|
+
*
|
|
38
|
+
* @param tone Tone return value must contrast with.
|
|
39
|
+
* Range is 0 to 100. Invalid values will result in -1 being returned.
|
|
40
|
+
* @param ratio Contrast ratio of return value and tone.
|
|
41
|
+
* Range is 1 to 21, invalid values have undefined behavior.
|
|
42
|
+
*/
|
|
43
|
+
static darker(tone: number, ratio: number): number;
|
|
44
|
+
/**
|
|
45
|
+
* Returns a tone >= tone parameter that ensures ratio parameter.
|
|
46
|
+
* Return value is between 0 and 100.
|
|
47
|
+
* Returns 100 if ratio cannot be achieved with tone parameter.
|
|
48
|
+
*
|
|
49
|
+
* This method is unsafe because the returned value is guaranteed to be in
|
|
50
|
+
* bounds for tone, i.e. between 0 and 100. However, that value may not reach
|
|
51
|
+
* the ratio with tone. For example, there is no color lighter than T100.
|
|
52
|
+
*
|
|
53
|
+
* @param tone Tone return value must contrast with.
|
|
54
|
+
* Range is 0 to 100. Invalid values will result in 100 being returned.
|
|
55
|
+
* @param ratio Desired contrast ratio of return value and tone parameter.
|
|
56
|
+
* Range is 1 to 21, invalid values have undefined behavior.
|
|
57
|
+
*/
|
|
58
|
+
static lighterUnsafe(tone: number, ratio: number): number;
|
|
59
|
+
/**
|
|
60
|
+
* Returns a tone >= tone parameter that ensures ratio parameter.
|
|
61
|
+
* Return value is between 0 and 100.
|
|
62
|
+
* Returns 100 if ratio cannot be achieved with tone parameter.
|
|
63
|
+
*
|
|
64
|
+
* This method is unsafe because the returned value is guaranteed to be in
|
|
65
|
+
* bounds for tone, i.e. between 0 and 100. However, that value may not reach
|
|
66
|
+
* the [ratio with [tone]. For example, there is no color darker than T0.
|
|
67
|
+
*
|
|
68
|
+
* @param tone Tone return value must contrast with.
|
|
69
|
+
* Range is 0 to 100. Invalid values will result in 0 being returned.
|
|
70
|
+
* @param ratio Desired contrast ratio of return value and tone parameter.
|
|
71
|
+
* Range is 1 to 21, invalid values have undefined behavior.
|
|
72
|
+
*/
|
|
73
|
+
static darkerUnsafe(tone: number, ratio: number): number;
|
|
74
|
+
}
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import { Rgba } from './types';
|
|
2
|
+
|
|
3
|
+
export declare function rgbFromHex(color: string): number[] | undefined;
|
|
4
|
+
export declare function hexFromRgb(red: number, green: number, blue: number): string;
|
|
5
|
+
export declare function hexFromArgb(argb: number): string;
|
|
6
|
+
/**
|
|
7
|
+
* Converts a color from RGB components to ARGB format.
|
|
8
|
+
*/
|
|
9
|
+
export declare function argbFromRgb(red: number, green: number, blue: number): number;
|
|
10
|
+
/**
|
|
11
|
+
* Converts a color from linear RGB components to ARGB format.
|
|
12
|
+
*/
|
|
13
|
+
export declare function argbFromLinrgb(linrgb: number[]): number;
|
|
14
|
+
/**
|
|
15
|
+
* Returns the alpha component of a color in ARGB format.
|
|
16
|
+
*/
|
|
17
|
+
export declare function alphaFromArgb(argb: number): number;
|
|
18
|
+
/**
|
|
19
|
+
* Returns the red component of a color in ARGB format.
|
|
20
|
+
*/
|
|
21
|
+
export declare function redFromArgb(argb: number): number;
|
|
22
|
+
/**
|
|
23
|
+
* Returns the green component of a color in ARGB format.
|
|
24
|
+
*/
|
|
25
|
+
export declare function greenFromArgb(argb: number): number;
|
|
26
|
+
/**
|
|
27
|
+
* Returns the blue component of a color in ARGB format.
|
|
28
|
+
*/
|
|
29
|
+
export declare function blueFromArgb(argb: number): number;
|
|
30
|
+
/**
|
|
31
|
+
* Returns whether a color in ARGB format is opaque.
|
|
32
|
+
*/
|
|
33
|
+
export declare function isOpaque(argb: number): boolean;
|
|
34
|
+
/**
|
|
35
|
+
* Converts a color from ARGB to XYZ.
|
|
36
|
+
*/
|
|
37
|
+
export declare function argbFromXyz(x: number, y: number, z: number): number;
|
|
38
|
+
/**
|
|
39
|
+
* Converts a color from XYZ to ARGB.
|
|
40
|
+
*/
|
|
41
|
+
export declare function xyzFromArgb(argb: number): number[];
|
|
42
|
+
/**
|
|
43
|
+
* Converts a color represented in Lab color space into an ARGB
|
|
44
|
+
* integer.
|
|
45
|
+
*/
|
|
46
|
+
export declare function argbFromLab(l: number, a: number, b: number): number;
|
|
47
|
+
/**
|
|
48
|
+
* Converts a color from ARGB representation to L*a*b*
|
|
49
|
+
* representation.
|
|
50
|
+
*
|
|
51
|
+
* @param argb the ARGB representation of a color
|
|
52
|
+
* @return a Lab object representing the color
|
|
53
|
+
*/
|
|
54
|
+
export declare function labFromArgb(argb: number): number[];
|
|
55
|
+
/**
|
|
56
|
+
* Converts an L* value to an ARGB representation.
|
|
57
|
+
*
|
|
58
|
+
* @param lstar L* in L*a*b*
|
|
59
|
+
* @return ARGB representation of grayscale color with lightness
|
|
60
|
+
* matching L*
|
|
61
|
+
*/
|
|
62
|
+
export declare function argbFromLstar(lstar: number): number;
|
|
63
|
+
/**
|
|
64
|
+
* Computes the L* value of a color in ARGB representation.
|
|
65
|
+
*
|
|
66
|
+
* @param argb ARGB representation of a color
|
|
67
|
+
* @return L*, from L*a*b*, coordinate of the color
|
|
68
|
+
*/
|
|
69
|
+
export declare function lstarFromArgb(argb: number): number;
|
|
70
|
+
/**
|
|
71
|
+
* Converts an L* value to a Y value.
|
|
72
|
+
*
|
|
73
|
+
* L* in L*a*b* and Y in XYZ measure the same quantity, luminance.
|
|
74
|
+
*
|
|
75
|
+
* L* measures perceptual luminance, a linear scale. Y in XYZ
|
|
76
|
+
* measures relative luminance, a logarithmic scale.
|
|
77
|
+
*
|
|
78
|
+
* @param lstar L* in L*a*b*
|
|
79
|
+
* @return Y in XYZ
|
|
80
|
+
*/
|
|
81
|
+
export declare function yFromLstar(lstar: number): number;
|
|
82
|
+
/**
|
|
83
|
+
* Converts a Y value to an L* value.
|
|
84
|
+
*
|
|
85
|
+
* L* in L*a*b* and Y in XYZ measure the same quantity, luminance.
|
|
86
|
+
*
|
|
87
|
+
* L* measures perceptual luminance, a linear scale. Y in XYZ
|
|
88
|
+
* measures relative luminance, a logarithmic scale.
|
|
89
|
+
*
|
|
90
|
+
* @param y Y in XYZ
|
|
91
|
+
* @return L* in L*a*b*
|
|
92
|
+
*/
|
|
93
|
+
export declare function lstarFromY(y: number): number;
|
|
94
|
+
/**
|
|
95
|
+
* Linearizes an RGB component.
|
|
96
|
+
*
|
|
97
|
+
* @param rgbComponent 0 <= rgb_component <= 255, represents R/G/B
|
|
98
|
+
* channel
|
|
99
|
+
* @return 0.0 <= output <= 100.0, color channel converted to
|
|
100
|
+
* linear RGB space
|
|
101
|
+
*/
|
|
102
|
+
export declare function linearized(rgbComponent: number): number;
|
|
103
|
+
/**
|
|
104
|
+
* Delinearizes an RGB component.
|
|
105
|
+
*
|
|
106
|
+
* @param rgbComponent 0.0 <= rgb_component <= 100.0, represents
|
|
107
|
+
* linear R/G/B channel
|
|
108
|
+
* @return 0 <= output <= 255, color channel converted to regular
|
|
109
|
+
* RGB space
|
|
110
|
+
*/
|
|
111
|
+
export declare function delinearized(rgbComponent: number): number;
|
|
112
|
+
/**
|
|
113
|
+
* Returns the standard white point; white on a sunny day.
|
|
114
|
+
*
|
|
115
|
+
* @return The white point
|
|
116
|
+
*/
|
|
117
|
+
export declare function whitePointD65(): number[];
|
|
118
|
+
/**
|
|
119
|
+
* Return RGBA from a given int32 color
|
|
120
|
+
*
|
|
121
|
+
* @param argb ARGB representation of a int32 color.
|
|
122
|
+
* @return RGBA representation of a int32 color.
|
|
123
|
+
*/
|
|
124
|
+
export declare function rgbaFromArgb(argb: number): Rgba;
|
|
125
|
+
/**
|
|
126
|
+
* Return int32 color from a given RGBA component
|
|
127
|
+
*
|
|
128
|
+
* @param rgba RGBA representation of a int32 color.
|
|
129
|
+
* @returns ARGB representation of a int32 color.
|
|
130
|
+
*/
|
|
131
|
+
export declare function argbFromRgba({ r, g, b, a }: Rgba): number;
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { ViewingConditions } from './viewing-conditions';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* CAM16, a color appearance model. Colors are not just defined by their hex
|
|
5
|
+
* code, but rather, a hex code and viewing conditions.
|
|
6
|
+
*
|
|
7
|
+
* CAM16 instances also have coordinates in the CAM16-UCS space, called J*, a*,
|
|
8
|
+
* b*, or jstar, astar, bstar in code. CAM16-UCS is included in the CAM16
|
|
9
|
+
* specification, and should be used when measuring distances between colors.
|
|
10
|
+
*
|
|
11
|
+
* In traditional color spaces, a color can be identified solely by the
|
|
12
|
+
* observer's measurement of the color. Color appearance models such as CAM16
|
|
13
|
+
* also use information about the environment where the color was
|
|
14
|
+
* observed, known as the viewing conditions.
|
|
15
|
+
*
|
|
16
|
+
* For example, white under the traditional assumption of a midday sun white
|
|
17
|
+
* point is accurately measured as a slightly chromatic blue by CAM16. (roughly,
|
|
18
|
+
* hue 203, chroma 3, lightness 100)
|
|
19
|
+
*/
|
|
20
|
+
export declare class Cam16 {
|
|
21
|
+
readonly hue: number;
|
|
22
|
+
readonly chroma: number;
|
|
23
|
+
readonly j: number;
|
|
24
|
+
readonly q: number;
|
|
25
|
+
readonly m: number;
|
|
26
|
+
readonly s: number;
|
|
27
|
+
readonly jstar: number;
|
|
28
|
+
readonly astar: number;
|
|
29
|
+
readonly bstar: number;
|
|
30
|
+
/**
|
|
31
|
+
* All of the CAM16 dimensions can be calculated from 3 of the dimensions, in
|
|
32
|
+
* the following combinations:
|
|
33
|
+
* - {j or q} and {c, m, or s} and hue
|
|
34
|
+
* - jstar, astar, bstar
|
|
35
|
+
* Prefer using a static method that constructs from 3 of those dimensions.
|
|
36
|
+
* This constructor is intended for those methods to use to return all
|
|
37
|
+
* possible dimensions.
|
|
38
|
+
*
|
|
39
|
+
* @param hue
|
|
40
|
+
* @param chroma informally, colorfulness / color intensity. like saturation
|
|
41
|
+
* in HSL, except perceptually accurate.
|
|
42
|
+
* @param j lightness
|
|
43
|
+
* @param q brightness; ratio of lightness to white point's lightness
|
|
44
|
+
* @param m colorfulness
|
|
45
|
+
* @param s saturation; ratio of chroma to white point's chroma
|
|
46
|
+
* @param jstar CAM16-UCS J coordinate
|
|
47
|
+
* @param astar CAM16-UCS a coordinate
|
|
48
|
+
* @param bstar CAM16-UCS b coordinate
|
|
49
|
+
*/
|
|
50
|
+
constructor(hue: number, chroma: number, j: number, q: number, m: number, s: number, jstar: number, astar: number, bstar: number);
|
|
51
|
+
/**
|
|
52
|
+
* CAM16 instances also have coordinates in the CAM16-UCS space, called J*,
|
|
53
|
+
* a*, b*, or jstar, astar, bstar in code. CAM16-UCS is included in the CAM16
|
|
54
|
+
* specification, and is used to measure distances between colors.
|
|
55
|
+
*/
|
|
56
|
+
distance(other: Cam16): number;
|
|
57
|
+
/**
|
|
58
|
+
* @param argb ARGB representation of a color.
|
|
59
|
+
* @return CAM16 color, assuming the color was viewed in default viewing
|
|
60
|
+
* conditions.
|
|
61
|
+
*/
|
|
62
|
+
static fromInt(argb: number): Cam16;
|
|
63
|
+
/**
|
|
64
|
+
* @param argb ARGB representation of a color.
|
|
65
|
+
* @param viewingConditions Information about the environment where the color
|
|
66
|
+
* was observed.
|
|
67
|
+
* @return CAM16 color.
|
|
68
|
+
*/
|
|
69
|
+
static fromIntInViewingConditions(argb: number, viewingConditions: ViewingConditions): Cam16;
|
|
70
|
+
/**
|
|
71
|
+
* @param j CAM16 lightness
|
|
72
|
+
* @param c CAM16 chroma
|
|
73
|
+
* @param h CAM16 hue
|
|
74
|
+
*/
|
|
75
|
+
static fromJch(j: number, c: number, h: number): Cam16;
|
|
76
|
+
/**
|
|
77
|
+
* @param j CAM16 lightness
|
|
78
|
+
* @param c CAM16 chroma
|
|
79
|
+
* @param h CAM16 hue
|
|
80
|
+
* @param viewingConditions Information about the environment where the color
|
|
81
|
+
* was observed.
|
|
82
|
+
*/
|
|
83
|
+
static fromJchInViewingConditions(j: number, c: number, h: number, viewingConditions: ViewingConditions): Cam16;
|
|
84
|
+
/**
|
|
85
|
+
* @param jstar CAM16-UCS lightness.
|
|
86
|
+
* @param astar CAM16-UCS a dimension. Like a* in L*a*b*, it is a Cartesian
|
|
87
|
+
* coordinate on the Y axis.
|
|
88
|
+
* @param bstar CAM16-UCS b dimension. Like a* in L*a*b*, it is a Cartesian
|
|
89
|
+
* coordinate on the X axis.
|
|
90
|
+
*/
|
|
91
|
+
static fromUcs(jstar: number, astar: number, bstar: number): Cam16;
|
|
92
|
+
/**
|
|
93
|
+
* @param jstar CAM16-UCS lightness.
|
|
94
|
+
* @param astar CAM16-UCS a dimension. Like a* in L*a*b*, it is a Cartesian
|
|
95
|
+
* coordinate on the Y axis.
|
|
96
|
+
* @param bstar CAM16-UCS b dimension. Like a* in L*a*b*, it is a Cartesian
|
|
97
|
+
* coordinate on the X axis.
|
|
98
|
+
* @param viewingConditions Information about the environment where the color
|
|
99
|
+
* was observed.
|
|
100
|
+
*/
|
|
101
|
+
static fromUcsInViewingConditions(jstar: number, astar: number, bstar: number, viewingConditions: ViewingConditions): Cam16;
|
|
102
|
+
/**
|
|
103
|
+
* @return ARGB representation of color, assuming the color was viewed in
|
|
104
|
+
* default viewing conditions, which are near-identical to the default
|
|
105
|
+
* viewing conditions for sRGB.
|
|
106
|
+
*/
|
|
107
|
+
toInt(): number;
|
|
108
|
+
/**
|
|
109
|
+
* @param viewingConditions Information about the environment where the color
|
|
110
|
+
* will be viewed.
|
|
111
|
+
* @return ARGB representation of color
|
|
112
|
+
*/
|
|
113
|
+
viewed(viewingConditions: ViewingConditions): number;
|
|
114
|
+
static fromXyzInViewingConditions(x: number, y: number, z: number, viewingConditions: ViewingConditions): Cam16;
|
|
115
|
+
xyzInViewingConditions(viewingConditions: ViewingConditions): number[];
|
|
116
|
+
}
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import { Cam16 } from './cam16';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* A class that solves the HCT equation.
|
|
5
|
+
*/
|
|
6
|
+
export declare class HctSolver {
|
|
7
|
+
static SCALED_DISCOUNT_FROM_LINRGB: number[][];
|
|
8
|
+
static LINRGB_FROM_SCALED_DISCOUNT: number[][];
|
|
9
|
+
static Y_FROM_LINRGB: number[];
|
|
10
|
+
static CRITICAL_PLANES: number[];
|
|
11
|
+
/**
|
|
12
|
+
* Sanitizes a small enough angle in radians.
|
|
13
|
+
*
|
|
14
|
+
* @param angle An angle in radians; must not deviate too much
|
|
15
|
+
* from 0.
|
|
16
|
+
* @return A coterminal angle between 0 and 2pi.
|
|
17
|
+
*/
|
|
18
|
+
private static sanitizeRadians;
|
|
19
|
+
/**
|
|
20
|
+
* Delinearizes an RGB component, returning a floating-point
|
|
21
|
+
* number.
|
|
22
|
+
*
|
|
23
|
+
* @param rgbComponent 0.0 <= rgb_component <= 100.0, represents
|
|
24
|
+
* linear R/G/B channel
|
|
25
|
+
* @return 0.0 <= output <= 255.0, color channel converted to
|
|
26
|
+
* regular RGB space
|
|
27
|
+
*/
|
|
28
|
+
private static trueDelinearized;
|
|
29
|
+
private static chromaticAdaptation;
|
|
30
|
+
/**
|
|
31
|
+
* Returns the hue of a linear RGB color in CAM16.
|
|
32
|
+
*
|
|
33
|
+
* @param linrgb The linear RGB coordinates of a color.
|
|
34
|
+
* @return The hue of the color in CAM16, in radians.
|
|
35
|
+
*/
|
|
36
|
+
private static hueOf;
|
|
37
|
+
private static areInCyclicOrder;
|
|
38
|
+
/**
|
|
39
|
+
* Solves the lerp equation.
|
|
40
|
+
*
|
|
41
|
+
* @param source The starting number.
|
|
42
|
+
* @param mid The number in the middle.
|
|
43
|
+
* @param target The ending number.
|
|
44
|
+
* @return A number t such that lerp(source, target, t) = mid.
|
|
45
|
+
*/
|
|
46
|
+
private static intercept;
|
|
47
|
+
private static lerpPoint;
|
|
48
|
+
/**
|
|
49
|
+
* Intersects a segment with a plane.
|
|
50
|
+
*
|
|
51
|
+
* @param source The coordinates of point A.
|
|
52
|
+
* @param coordinate The R-, G-, or B-coordinate of the plane.
|
|
53
|
+
* @param target The coordinates of point B.
|
|
54
|
+
* @param axis The axis the plane is perpendicular with. (0: R, 1:
|
|
55
|
+
* G, 2: B)
|
|
56
|
+
* @return The intersection point of the segment AB with the plane
|
|
57
|
+
* R=coordinate, G=coordinate, or B=coordinate
|
|
58
|
+
*/
|
|
59
|
+
private static setCoordinate;
|
|
60
|
+
private static isBounded;
|
|
61
|
+
/**
|
|
62
|
+
* Returns the nth possible vertex of the polygonal intersection.
|
|
63
|
+
*
|
|
64
|
+
* @param y The Y value of the plane.
|
|
65
|
+
* @param n The zero-based index of the point. 0 <= n <= 11.
|
|
66
|
+
* @return The nth possible vertex of the polygonal intersection
|
|
67
|
+
* of the y plane and the RGB cube, in linear RGB coordinates, if
|
|
68
|
+
* it exists. If this possible vertex lies outside of the cube,
|
|
69
|
+
* [-1.0, -1.0, -1.0] is returned.
|
|
70
|
+
*/
|
|
71
|
+
private static nthVertex;
|
|
72
|
+
/**
|
|
73
|
+
* Finds the segment containing the desired color.
|
|
74
|
+
*
|
|
75
|
+
* @param y The Y value of the color.
|
|
76
|
+
* @param targetHue The hue of the color.
|
|
77
|
+
* @return A list of two sets of linear RGB coordinates, each
|
|
78
|
+
* corresponding to an endpoint of the segment containing the
|
|
79
|
+
* desired color.
|
|
80
|
+
*/
|
|
81
|
+
private static bisectToSegment;
|
|
82
|
+
private static midpoint;
|
|
83
|
+
private static criticalPlaneBelow;
|
|
84
|
+
private static criticalPlaneAbove;
|
|
85
|
+
/**
|
|
86
|
+
* Finds a color with the given Y and hue on the boundary of the
|
|
87
|
+
* cube.
|
|
88
|
+
*
|
|
89
|
+
* @param y The Y value of the color.
|
|
90
|
+
* @param targetHue The hue of the color.
|
|
91
|
+
* @return The desired color, in linear RGB coordinates.
|
|
92
|
+
*/
|
|
93
|
+
private static bisectToLimit;
|
|
94
|
+
private static inverseChromaticAdaptation;
|
|
95
|
+
/**
|
|
96
|
+
* Finds a color with the given hue, chroma, and Y.
|
|
97
|
+
*
|
|
98
|
+
* @param hueRadians The desired hue in radians.
|
|
99
|
+
* @param chroma The desired chroma.
|
|
100
|
+
* @param y The desired Y.
|
|
101
|
+
* @return The desired color as a hexadecimal integer, if found; 0
|
|
102
|
+
* otherwise.
|
|
103
|
+
*/
|
|
104
|
+
private static findResultByJ;
|
|
105
|
+
/**
|
|
106
|
+
* Finds an sRGB color with the given hue, chroma, and L*, if
|
|
107
|
+
* possible.
|
|
108
|
+
*
|
|
109
|
+
* @param hueDegrees The desired hue, in degrees.
|
|
110
|
+
* @param chroma The desired chroma.
|
|
111
|
+
* @param lstar The desired L*.
|
|
112
|
+
* @return A hexadecimal representing the sRGB color. The color
|
|
113
|
+
* has sufficiently close hue, chroma, and L* to the desired
|
|
114
|
+
* values, if possible; otherwise, the hue and L* will be
|
|
115
|
+
* sufficiently close, and chroma will be maximized.
|
|
116
|
+
*/
|
|
117
|
+
static solveToInt(hueDegrees: number, chroma: number, lstar: number): number;
|
|
118
|
+
/**
|
|
119
|
+
* Finds an sRGB color with the given hue, chroma, and L*, if
|
|
120
|
+
* possible.
|
|
121
|
+
*
|
|
122
|
+
* @param hueDegrees The desired hue, in degrees.
|
|
123
|
+
* @param chroma The desired chroma.
|
|
124
|
+
* @param lstar The desired L*.
|
|
125
|
+
* @return An CAM16 object representing the sRGB color. The color
|
|
126
|
+
* has sufficiently close hue, chroma, and L* to the desired
|
|
127
|
+
* values, if possible; otherwise, the hue and L* will be
|
|
128
|
+
* sufficiently close, and chroma will be maximized.
|
|
129
|
+
*/
|
|
130
|
+
static solveToCam(hueDegrees: number, chroma: number, lstar: number): Cam16;
|
|
131
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { ViewingConditions } from './viewing-conditions';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* HCT, hue, chroma, and tone. A color system that provides a perceptually
|
|
5
|
+
* accurate color measurement system that can also accurately render what colors
|
|
6
|
+
* will appear as in different lighting environments.
|
|
7
|
+
*/
|
|
8
|
+
export declare class Hct {
|
|
9
|
+
private argb;
|
|
10
|
+
/**
|
|
11
|
+
* @param hue 0 <= hue < 360; invalid values are corrected.
|
|
12
|
+
* @param chroma 0 <= chroma < ?; Informally, colorfulness. The color
|
|
13
|
+
* returned may be lower than the requested chroma. Chroma has a different
|
|
14
|
+
* maximum for any given hue and tone.
|
|
15
|
+
* @param tone 0 <= tone <= 100; invalid values are corrected.
|
|
16
|
+
* @return HCT representation of a color in default viewing conditions.
|
|
17
|
+
*/
|
|
18
|
+
internalHue: number;
|
|
19
|
+
internalChroma: number;
|
|
20
|
+
internalTone: number;
|
|
21
|
+
static from(hue: number, chroma: number, tone: number): Hct;
|
|
22
|
+
/**
|
|
23
|
+
* @param argb ARGB representation of a color.
|
|
24
|
+
* @return HCT representation of a color in default viewing conditions
|
|
25
|
+
*/
|
|
26
|
+
static fromInt(argb: number): Hct;
|
|
27
|
+
toInt(): number;
|
|
28
|
+
/**
|
|
29
|
+
* A number, in degrees, representing ex. red, orange, yellow, etc.
|
|
30
|
+
* Ranges from 0 <= hue < 360.
|
|
31
|
+
*/
|
|
32
|
+
get hue(): number;
|
|
33
|
+
/**
|
|
34
|
+
* @param newHue 0 <= newHue < 360; invalid values are corrected.
|
|
35
|
+
* Chroma may decrease because chroma has a different maximum for any given
|
|
36
|
+
* hue and tone.
|
|
37
|
+
*/
|
|
38
|
+
set hue(newHue: number);
|
|
39
|
+
get chroma(): number;
|
|
40
|
+
/**
|
|
41
|
+
* @param newChroma 0 <= newChroma < ?
|
|
42
|
+
* Chroma may decrease because chroma has a different maximum for any given
|
|
43
|
+
* hue and tone.
|
|
44
|
+
*/
|
|
45
|
+
set chroma(newChroma: number);
|
|
46
|
+
/** Lightness. Ranges from 0 to 100. */
|
|
47
|
+
get tone(): number;
|
|
48
|
+
/**
|
|
49
|
+
* @param newTone 0 <= newTone <= 100; invalid valids are corrected.
|
|
50
|
+
* Chroma may decrease because chroma has a different maximum for any given
|
|
51
|
+
* hue and tone.
|
|
52
|
+
*/
|
|
53
|
+
set tone(newTone: number);
|
|
54
|
+
private constructor();
|
|
55
|
+
private setInternalState;
|
|
56
|
+
/**
|
|
57
|
+
* Translates a color into different [ViewingConditions].
|
|
58
|
+
*
|
|
59
|
+
* Colors change appearance. They look different with lights on versus off,
|
|
60
|
+
* the same color, as in hex code, on white looks different when on black.
|
|
61
|
+
* This is called color relativity, most famously explicated by Josef Albers
|
|
62
|
+
* in Interaction of Color.
|
|
63
|
+
*
|
|
64
|
+
* In color science, color appearance models can account for this and
|
|
65
|
+
* calculate the appearance of a color in different settings. HCT is based on
|
|
66
|
+
* CAM16, a color appearance model, and uses it to make these calculations.
|
|
67
|
+
*
|
|
68
|
+
* See [ViewingConditions.make] for parameters affecting color appearance.
|
|
69
|
+
*/
|
|
70
|
+
inViewingConditions(vc: ViewingConditions): Hct;
|
|
71
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* In traditional color spaces, a color can be identified solely by the
|
|
3
|
+
* observer's measurement of the color. Color appearance models such as CAM16
|
|
4
|
+
* also use information about the environment where the color was
|
|
5
|
+
* observed, known as the viewing conditions.
|
|
6
|
+
*
|
|
7
|
+
* For example, white under the traditional assumption of a midday sun white
|
|
8
|
+
* point is accurately measured as a slightly chromatic blue by CAM16. (roughly,
|
|
9
|
+
* hue 203, chroma 3, lightness 100)
|
|
10
|
+
*
|
|
11
|
+
* This class caches intermediate values of the CAM16 conversion process that
|
|
12
|
+
* depend only on viewing conditions, enabling speed ups.
|
|
13
|
+
*/
|
|
14
|
+
export declare class ViewingConditions {
|
|
15
|
+
n: number;
|
|
16
|
+
aw: number;
|
|
17
|
+
nbb: number;
|
|
18
|
+
ncb: number;
|
|
19
|
+
c: number;
|
|
20
|
+
nc: number;
|
|
21
|
+
rgbD: number[];
|
|
22
|
+
fl: number;
|
|
23
|
+
fLRoot: number;
|
|
24
|
+
z: number;
|
|
25
|
+
/** sRGB-like viewing conditions. */
|
|
26
|
+
static DEFAULT: ViewingConditions;
|
|
27
|
+
/**
|
|
28
|
+
* Create ViewingConditions from a simple, physically relevant, set of
|
|
29
|
+
* parameters.
|
|
30
|
+
*
|
|
31
|
+
* @param whitePoint White point, measured in the XYZ color space.
|
|
32
|
+
* default = D65, or sunny day afternoon
|
|
33
|
+
* @param adaptingLuminance The luminance of the adapting field. Informally,
|
|
34
|
+
* how bright it is in the room where the color is viewed. Can be
|
|
35
|
+
* calculated from lux by multiplying lux by 0.0586. default = 11.72,
|
|
36
|
+
* or 200 lux.
|
|
37
|
+
* @param backgroundLstar The lightness of the area surrounding the color.
|
|
38
|
+
* measured by L* in L*a*b*. default = 50.0
|
|
39
|
+
* @param surround A general description of the lighting surrounding the
|
|
40
|
+
* color. 0 is pitch dark, like watching a movie in a theater. 1.0 is a
|
|
41
|
+
* dimly light room, like watching TV at home at night. 2.0 means there
|
|
42
|
+
* is no difference between the lighting on the color and around it.
|
|
43
|
+
* default = 2.0
|
|
44
|
+
* @param discountingIlluminant Whether the eye accounts for the tint of the
|
|
45
|
+
* ambient lighting, such as knowing an apple is still red in green light.
|
|
46
|
+
* default = false, the eye does not perform this process on
|
|
47
|
+
* self-luminous objects like displays.
|
|
48
|
+
*/
|
|
49
|
+
static make(whitePoint?: number[], adaptingLuminance?: number, backgroundLstar?: number, surround?: number, discountingIlluminant?: boolean): ViewingConditions;
|
|
50
|
+
/**
|
|
51
|
+
* Parameters are intermediate values of the CAM16 conversion process. Their
|
|
52
|
+
* names are shorthand for technical color science terminology, this class
|
|
53
|
+
* would not benefit from documenting them individually. A brief overview
|
|
54
|
+
* is available in the CAM16 specification, and a complete overview requires
|
|
55
|
+
* a color science textbook, such as Fairchild's Color Appearance Models.
|
|
56
|
+
*/
|
|
57
|
+
private constructor();
|
|
58
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { TonalPalette } from './tonal-palette';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Set of colors to generate a [CorePalette] from
|
|
5
|
+
*/
|
|
6
|
+
export interface CorePaletteColors {
|
|
7
|
+
primary: number;
|
|
8
|
+
secondary?: number;
|
|
9
|
+
tertiary?: number;
|
|
10
|
+
neutral?: number;
|
|
11
|
+
neutralVariant?: number;
|
|
12
|
+
error?: number;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* An intermediate concept between the key color for a UI theme, and a full
|
|
16
|
+
* color scheme. 5 sets of tones are generated, all except one use the same hue
|
|
17
|
+
* as the key color, and all vary in chroma.
|
|
18
|
+
*/
|
|
19
|
+
export declare class CorePalette {
|
|
20
|
+
a1: TonalPalette;
|
|
21
|
+
a2: TonalPalette;
|
|
22
|
+
a3: TonalPalette;
|
|
23
|
+
n1: TonalPalette;
|
|
24
|
+
n2: TonalPalette;
|
|
25
|
+
error: TonalPalette;
|
|
26
|
+
/**
|
|
27
|
+
* @param argb ARGB representation of a color
|
|
28
|
+
*/
|
|
29
|
+
static of(argb: number): CorePalette;
|
|
30
|
+
/**
|
|
31
|
+
* @param argb ARGB representation of a color
|
|
32
|
+
*/
|
|
33
|
+
static contentOf(argb: number): CorePalette;
|
|
34
|
+
/**
|
|
35
|
+
* Create a [CorePalette] from a set of colors
|
|
36
|
+
*/
|
|
37
|
+
static fromColors(colors: CorePaletteColors): CorePalette;
|
|
38
|
+
/**
|
|
39
|
+
* Create a content [CorePalette] from a set of colors
|
|
40
|
+
*/
|
|
41
|
+
static contentFromColors(colors: CorePaletteColors): CorePalette;
|
|
42
|
+
private static createPaletteFromColors;
|
|
43
|
+
private constructor();
|
|
44
|
+
}
|