@dra2020/dra-types 1.8.111 → 1.8.112
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/colormgr.d.ts +7 -0
- package/dist/dra-types.js +22 -14
- package/dist/dra-types.js.map +1 -1
- package/lib/colormgr.ts +20 -11
- package/package.json +1 -1
package/dist/colormgr.d.ts
CHANGED
|
@@ -91,10 +91,17 @@ export declare const BinBlueViolet = 13;
|
|
|
91
91
|
export declare const BinDarkViolet = 14;
|
|
92
92
|
export declare const BinMagenta = 15;
|
|
93
93
|
export declare const BinDeepPink = 16;
|
|
94
|
+
export declare const BinBlack = 17;
|
|
95
|
+
export declare const BinEthnicWhite = 11;
|
|
96
|
+
export declare const BinEthnicBlack = 6;
|
|
97
|
+
export declare const BinEthnicAsian = 0;
|
|
98
|
+
export declare const BinEthnicHispanic = 3;
|
|
99
|
+
export declare const BinEthnicOther = 2;
|
|
94
100
|
export declare const BinColorLookup: RGB[];
|
|
95
101
|
export declare const FieldCountToColors: {
|
|
96
102
|
[nfields: number]: number[];
|
|
97
103
|
};
|
|
104
|
+
export declare const MaxFields = 16;
|
|
98
105
|
export declare function colorindexToRGB(colorindex: number): RGB;
|
|
99
106
|
export declare const ColorFlags = "abcdefghijklmnopqrstuvwxyz";
|
|
100
107
|
export declare function colorflagToColorindex(nfields: number, colorflag: string): number;
|
package/dist/dra-types.js
CHANGED
|
@@ -108,7 +108,7 @@ exports.BucketMap = {
|
|
|
108
108
|
|
|
109
109
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
110
110
|
exports.BinGold = exports.BinOrange = exports.BinBrown = exports.BinOrangeRed = exports.BinRed = exports.computeDistrictColors = exports.ToExtendedColor = exports.allGroups16Colors = exports.colorsFromStopsPartisan = exports.colorsFromStops = exports.PaletteNames = exports.ColorFromRGBPcts = exports.AggregatePartisanColorStr = exports.AggregatePartisanColor = exports.AggregateEthnicColor = exports.ToEthnicColorStr = exports.ToPartisanShiftColor = exports.ToPartisanDistrictColor = exports.ToPartisanColorStr = exports.ToAllEthnicColor = exports.ethnicBackgroundColor = exports.makeStops = exports.DefaultPaletteDefaults = exports.EthnicFewStops = exports.PartisanPrecinctStops = exports.PartisanDistrictStops = exports.ColorByGreatD = exports.ColorByGoodD = exports.ColorByFairD = exports.ColorByEven = exports.ColorByFairR = exports.ColorByGoodR = exports.ColorByGreatR = exports.EthnicTextColor = exports.ColorByBlackAsian = exports.ColorByAsianHispanic = exports.ColorByAsianWhite = exports.ColorByHispanicBlack = exports.ColorByBlackWhite = exports.ColorByHispanicWhite = exports.ColorByMix = exports.ColorByMostlyNative = exports.ColorByMostlyAsian = exports.ColorByMostlyHispanic = exports.ColorByMostlyBlack = exports.ColorByMostlyWhite = exports.ColorBySolidAsian = exports.ColorBySolidHispanic = exports.ColorBySolidBlack = exports.ColorBySolidWhite = void 0;
|
|
111
|
-
exports.colororderToColorindex = exports.colorflagToColorindex = exports.ColorFlags = exports.colorindexToRGB = exports.FieldCountToColors = exports.BinColorLookup = exports.BinDeepPink = exports.BinMagenta = exports.BinDarkViolet = exports.BinBlueViolet = exports.BinBlue = exports.BinLightBlue = exports.BinCyan = exports.BinMediumSpringGreen = exports.BinLime = exports.BinChartreuse = exports.BinGreenish = exports.BinYellow = void 0;
|
|
111
|
+
exports.colororderToColorindex = exports.colorflagToColorindex = exports.ColorFlags = exports.colorindexToRGB = exports.MaxFields = exports.FieldCountToColors = exports.BinColorLookup = exports.BinEthnicOther = exports.BinEthnicHispanic = exports.BinEthnicAsian = exports.BinEthnicBlack = exports.BinEthnicWhite = exports.BinBlack = exports.BinDeepPink = exports.BinMagenta = exports.BinDarkViolet = exports.BinBlueViolet = exports.BinBlue = exports.BinLightBlue = exports.BinCyan = exports.BinMediumSpringGreen = exports.BinLime = exports.BinChartreuse = exports.BinGreenish = exports.BinYellow = void 0;
|
|
112
112
|
// App libraries
|
|
113
113
|
const PF = __webpack_require__(/*! ./packedfields */ "./lib/packedfields.ts");
|
|
114
114
|
const datasets_1 = __webpack_require__(/*! ./datasets */ "./lib/datasets.ts");
|
|
@@ -681,6 +681,13 @@ exports.BinBlueViolet = 13;
|
|
|
681
681
|
exports.BinDarkViolet = 14;
|
|
682
682
|
exports.BinMagenta = 15;
|
|
683
683
|
exports.BinDeepPink = 16;
|
|
684
|
+
exports.BinBlack = 17;
|
|
685
|
+
// Ethnic colors
|
|
686
|
+
exports.BinEthnicWhite = exports.BinLightBlue;
|
|
687
|
+
exports.BinEthnicBlack = exports.BinGreenish;
|
|
688
|
+
exports.BinEthnicAsian = exports.BinRed;
|
|
689
|
+
exports.BinEthnicHispanic = exports.BinOrange;
|
|
690
|
+
exports.BinEthnicOther = exports.BinBrown;
|
|
684
691
|
exports.BinColorLookup = [
|
|
685
692
|
{ r: 0xff, g: 0x00, b: 0x00 }, // 0 - red
|
|
686
693
|
{ r: 0xff, g: 0x45, b: 0x00 }, // 1 - orange red
|
|
@@ -699,6 +706,7 @@ exports.BinColorLookup = [
|
|
|
699
706
|
{ r: 0x94, g: 0x00, b: 0xd3 }, // 14 - dark violet
|
|
700
707
|
{ r: 0xff, g: 0x00, b: 0xff }, // 15 - magenta
|
|
701
708
|
{ r: 0xff, g: 0x14, b: 0x93 }, // 16 - deep pink
|
|
709
|
+
{ r: 0x00, g: 0x00, b: 0x00 }, // 17 - black
|
|
702
710
|
];
|
|
703
711
|
// Map ordering to Bin* lookup values
|
|
704
712
|
const ColorOrderEthnic = 'wbaho'; // abcde
|
|
@@ -710,18 +718,18 @@ exports.FieldCountToColors = {
|
|
|
710
718
|
[4]: [exports.BinRed, exports.BinBlue, exports.BinBrown, exports.BinGreenish],
|
|
711
719
|
[5]: [exports.BinLightBlue, exports.BinGreenish, exports.BinRed, exports.BinOrange, exports.BinBrown],
|
|
712
720
|
[6]: [exports.BinRed, exports.BinBrown, exports.BinGold, exports.BinGreenish, exports.BinLightBlue, exports.BinBlueViolet],
|
|
713
|
-
[7]: [exports.BinRed, exports.BinBrown, exports.BinGold, exports.
|
|
714
|
-
[8]: [exports.BinRed, exports.BinBrown, exports.
|
|
715
|
-
[9]: [exports.BinRed, exports.BinBrown, exports.
|
|
716
|
-
[10]: [exports.BinRed, exports.BinBrown, exports.
|
|
717
|
-
[11]: [exports.BinRed, exports.BinBrown, exports.
|
|
718
|
-
[12]: [exports.BinRed, exports.BinBrown, exports.BinOrange, exports.BinGold, exports.
|
|
719
|
-
[13]: [exports.BinRed, exports.BinBrown, exports.BinOrange, exports.BinGold, exports.
|
|
720
|
-
[14]: [exports.BinRed, exports.BinOrangeRed, exports.BinBrown, exports.BinOrange, exports.BinGold, exports.
|
|
721
|
-
[15]: [exports.BinRed, exports.BinOrangeRed, exports.BinBrown, exports.BinOrange, exports.BinGold, exports.
|
|
722
|
-
[16]: [exports.BinRed, exports.BinOrangeRed, exports.BinBrown, exports.BinOrange, exports.BinGold, exports.BinYellow, exports.
|
|
721
|
+
[7]: [exports.BinRed, exports.BinBrown, exports.BinGold, exports.BinBlueViolet, exports.BinMagenta, exports.BinGreenish, exports.BinLightBlue],
|
|
722
|
+
[8]: [exports.BinRed, exports.BinBrown, exports.BinOrange, exports.BinGold, exports.BinBlueViolet, exports.BinMagenta, exports.BinGreenish, exports.BinLightBlue],
|
|
723
|
+
[9]: [exports.BinRed, exports.BinBrown, exports.BinOrange, exports.BinGold, exports.BinBlueViolet, exports.BinMagenta, exports.BinGreenish, exports.BinLightBlue, exports.BinBlue],
|
|
724
|
+
[10]: [exports.BinRed, exports.BinBrown, exports.BinOrange, exports.BinGold, exports.BinBlueViolet, exports.BinMagenta, exports.BinGreenish, exports.BinCyan, exports.BinLightBlue, exports.BinBlue],
|
|
725
|
+
[11]: [exports.BinRed, exports.BinBrown, exports.BinOrange, exports.BinGold, exports.BinBlueViolet, exports.BinMagenta, exports.BinGreenish, exports.BinLime, exports.BinCyan, exports.BinLightBlue, exports.BinBlue],
|
|
726
|
+
[12]: [exports.BinRed, exports.BinBrown, exports.BinOrange, exports.BinGold, exports.BinBlueViolet, exports.BinMagenta, exports.BinDeepPink, exports.BinGreenish, exports.BinMediumSpringGreen, exports.BinCyan, exports.BinLightBlue, exports.BinBlue],
|
|
727
|
+
[13]: [exports.BinRed, exports.BinBrown, exports.BinOrange, exports.BinGold, exports.BinBlueViolet, exports.BinMagenta, exports.BinDeepPink, exports.BinGreenish, exports.BinLime, exports.BinMediumSpringGreen, exports.BinCyan, exports.BinLightBlue, exports.BinBlue],
|
|
728
|
+
[14]: [exports.BinRed, exports.BinOrangeRed, exports.BinBrown, exports.BinOrange, exports.BinGold, exports.BinBlueViolet, exports.BinMagenta, exports.BinDeepPink, exports.BinGreenish, exports.BinLime, exports.BinMediumSpringGreen, exports.BinCyan, exports.BinLightBlue, exports.BinBlue],
|
|
729
|
+
[15]: [exports.BinRed, exports.BinOrangeRed, exports.BinBrown, exports.BinOrange, exports.BinGold, exports.BinBlueViolet, exports.BinDarkViolet, exports.BinMagenta, exports.BinDeepPink, exports.BinGreenish, exports.BinLime, exports.BinMediumSpringGreen, exports.BinCyan, exports.BinLightBlue, exports.BinBlue],
|
|
730
|
+
[16]: [exports.BinRed, exports.BinOrangeRed, exports.BinBrown, exports.BinOrange, exports.BinGold, exports.BinYellow, exports.BinBlueViolet, exports.BinDarkViolet, exports.BinMagenta, exports.BinDeepPink, exports.BinGreenish, exports.BinLime, exports.BinMediumSpringGreen, exports.BinCyan, exports.BinLightBlue, exports.BinBlue],
|
|
723
731
|
};
|
|
724
|
-
|
|
732
|
+
exports.MaxFields = 16;
|
|
725
733
|
function colorindexToRGB(colorindex) {
|
|
726
734
|
return exports.BinColorLookup[colorindex] || exports.BinColorLookup[exports.BinBrown];
|
|
727
735
|
}
|
|
@@ -729,11 +737,11 @@ exports.colorindexToRGB = colorindexToRGB;
|
|
|
729
737
|
exports.ColorFlags = 'abcdefghijklmnopqrstuvwxyz';
|
|
730
738
|
function colorflagToColorindex(nfields, colorflag) {
|
|
731
739
|
let i = exports.ColorFlags.indexOf(colorflag);
|
|
732
|
-
return i >= 0 && nfields > 0 && nfields <= MaxFields ? exports.FieldCountToColors[nfields][i] : exports.BinBrown;
|
|
740
|
+
return i >= 0 && nfields > 0 && nfields <= exports.MaxFields ? exports.FieldCountToColors[nfields][i] : exports.BinBrown;
|
|
733
741
|
}
|
|
734
742
|
exports.colorflagToColorindex = colorflagToColorindex;
|
|
735
743
|
function colororderToColorindex(nfields, order) {
|
|
736
|
-
return order >= 0 && nfields > 0 && nfields <= MaxFields ? exports.FieldCountToColors[nfields][order] : exports.BinBrown;
|
|
744
|
+
return order >= 0 && nfields > 0 && nfields <= exports.MaxFields ? exports.FieldCountToColors[nfields][order] : exports.BinBrown;
|
|
737
745
|
}
|
|
738
746
|
exports.colororderToColorindex = colororderToColorindex;
|
|
739
747
|
|