Skip to content

Commit 64e0aa4

Browse files
committed
ColorDef validation and ColorByName fix (#3360)
* ColorByName is an object not an enum Add ColorDef validation. * Test ColorDef.getName * docs, types. * lint, extract-api * NextVersion.md * why aren't integration tests running? * so much casting. (cherry picked from commit 84290b9)
1 parent e9d440d commit 64e0aa4

File tree

16 files changed

+531
-572
lines changed

16 files changed

+531
-572
lines changed

common/api/imodeljs-common.api.md

Lines changed: 174 additions & 322 deletions
Large diffs are not rendered by default.

common/api/summary/imodeljs-common.exports.csv

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ public;CodeProps
9999
public;CodeScopeProps = Id64String | GuidString
100100
public;CodeScopeSpec
101101
public;CodeSpec
102-
public;ColorByName
102+
public;ColorByName:
103103
public;ColorDef
104104
public;ColorDefProps = number
105105
internal;ColorIndex
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"changes": [
3+
{
4+
"packageName": "@bentley/imodeljs-common",
5+
"comment": "Add methods to validate ColorDefProps and color strings; fix failure to find duplicate color names.",
6+
"type": "none"
7+
}
8+
],
9+
"packageName": "@bentley/imodeljs-common",
10+
"email": "[email protected]"
11+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"changes": [
3+
{
4+
"packageName": "@bentley/ui-components",
5+
"comment": "",
6+
"type": "none"
7+
}
8+
],
9+
"packageName": "@bentley/ui-components",
10+
"email": "[email protected]"
11+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"changes": [
3+
{
4+
"packageName": "@itwin/core-common",
5+
"comment": "Add methods to validate ColorDefProps and color strings; fix failure to find duplicate color names.",
6+
"type": "none"
7+
}
8+
],
9+
"packageName": "@itwin/core-common"
10+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"changes": [
3+
{
4+
"packageName": "@itwin/imodel-components-react",
5+
"comment": "",
6+
"type": "none"
7+
}
8+
],
9+
"packageName": "@itwin/imodel-components-react"
10+
}

core/common/src/ColorByName.ts

Lines changed: 152 additions & 152 deletions
Original file line numberDiff line numberDiff line change
@@ -12,155 +12,155 @@
1212
* @note If your colors don't look right, likely you're using 0xRRGGBB where ColorDef expects 0xBBGGRR.
1313
* @public
1414
*/
15-
export enum ColorByName {
16-
aliceBlue = 0xFFF8F0,
17-
amber = 0x00BFFF,
18-
antiqueWhite = 0xD7EBFA,
19-
aqua = 0xFFFF00,
20-
aquamarine = 0xD4FF7F,
21-
azure = 0xFFFFF0,
22-
beige = 0xDCF5F5,
23-
bisque = 0xC4E4FF,
24-
black = 0x000000,
25-
blanchedAlmond = 0xCDEBFF,
26-
blue = 0xFF0000,
27-
blueViolet = 0xE22B8A,
28-
brown = 0x2A2AA5,
29-
burlyWood = 0x87B8DE,
30-
cadetBlue = 0xA09E5F,
31-
chartreuse = 0x00FF7F,
32-
chocolate = 0x1E69D2,
33-
coral = 0x507FFF,
34-
cornflowerBlue = 0xED9564,
35-
cornSilk = 0xDCF8FF,
36-
crimson = 0x3C14DC,
37-
cyan = 0xFFFF00,
38-
darkBlue = 0x8B0000,
39-
darkBrown = 0x214365,
40-
darkCyan = 0x8B8B00,
41-
darkGoldenrod = 0x0B86B8,
42-
darkGray = 0xA9A9A9,
43-
darkGreen = 0x006400,
44-
darkGrey = 0xA9A9A9,
45-
darkKhaki = 0x6BB7BD,
46-
darkMagenta = 0x8B008B,
47-
darkOliveGreen = 0x2F6B55,
48-
darkOrange = 0x008CFF,
49-
darkOrchid = 0xCC3299,
50-
darkRed = 0x00008B,
51-
darkSalmon = 0x7A96E9,
52-
darkSeagreen = 0x8FBC8F,
53-
darkSlateBlue = 0x8B3D48,
54-
darkSlateGray = 0x4F4F2F,
55-
darkSlateGrey = 0x4F4F2F,
56-
darkTurquoise = 0xD1CE00,
57-
darkViolet = 0xD30094,
58-
deepPink = 0x9314FF,
59-
deepSkyBlue = 0xFFBF00,
60-
dimGray = 0x696969,
61-
dimGrey = 0x696969,
62-
dodgerBlue = 0xFF901E,
63-
fireBrick = 0x2222B2,
64-
floralWhite = 0xF0FAFF,
65-
forestGreen = 0x228B22,
66-
fuchsia = 0xFF00FF,
67-
gainsboro = 0xDCDCDC,
68-
ghostWhite = 0xFFF8F8,
69-
gold = 0x00D7FF,
70-
goldenrod = 0x20A5DA,
71-
gray = 0x808080,
72-
green = 0x008000,
73-
greenYellow = 0x2FFFAD,
74-
grey = 0x808080,
75-
honeydew = 0xF0FFF0,
76-
hotPink = 0xB469FF,
77-
indianRed = 0x5C5CCD,
78-
indigo = 0x82004B,
79-
ivory = 0xF0FFFF,
80-
khaki = 0x8CE6F0,
81-
lavender = 0xFAE6E6,
82-
lavenderBlush = 0xF5F0FF,
83-
lawnGreen = 0x00FC7C,
84-
lemonChiffon = 0xCDFAFF,
85-
lightBlue = 0xE6D8AD,
86-
lightCoral = 0x8080F0,
87-
lightCyan = 0xFFFFE0,
88-
lightGoldenrodYellow = 0xD2FAFA,
89-
lightGray = 0xD3D3D3,
90-
lightGreen = 0x90EE90,
91-
lightGrey = 0xD3D3D3,
92-
lightPink = 0xC1B6FF,
93-
lightSalmon = 0x7AA0FF,
94-
lightSeagreen = 0xAAB220,
95-
lightSkyBlue = 0xFACE87,
96-
lightSlateGray = 0x998877,
97-
lightSlateGrey = 0x998877,
98-
lightSteelBlue = 0xDEC4B0,
99-
lightyellow = 0xE0FFFF,
100-
lime = 0x00FF00,
101-
limeGreen = 0x32CD32,
102-
linen = 0xE6F0FA,
103-
magenta = 0xFF00FF,
104-
maroon = 0x000080,
105-
mediumAquamarine = 0xAACD66,
106-
mediumBlue = 0xCD0000,
107-
mediumOrchid = 0xD355BA,
108-
mediumPurple = 0xDB7093,
109-
mediumSeaGreen = 0x71B33C,
110-
mediumSlateBlue = 0xEE687B,
111-
mediumSpringGreen = 0x9AFA00,
112-
mediumTurquoise = 0xCCD148,
113-
mediumVioletRed = 0x8515C7,
114-
midnightBlue = 0x701919,
115-
mintCream = 0xFAFFF5,
116-
mistyRose = 0xE1E4FF,
117-
moccasin = 0xB5E4FF,
118-
navajoWhite = 0xADDEFF,
119-
navy = 0x800000,
120-
oldLace = 0xE6F5FD,
121-
olive = 0x008080,
122-
oliveDrab = 0x238E6B,
123-
orange = 0x00A5FF,
124-
orangeRed = 0x0045FF,
125-
orchid = 0xD670DA,
126-
paleGoldenrod = 0xAAE8EE,
127-
paleGreen = 0x98FB98,
128-
paleTurquoise = 0xEEEEAF,
129-
paleVioletRed = 0x9370DB,
130-
papayaWhip = 0xD5EFFF,
131-
peachPuff = 0xB9DAFF,
132-
peru = 0x3F85CD,
133-
pink = 0xCBC0FF,
134-
plum = 0xDDA0DD,
135-
powderBlue = 0xE6E0B0,
136-
purple = 0x800080,
137-
rebeccaPurple = 0x993366,
138-
red = 0x0000FF,
139-
rosyBrown = 0x8F8FBC,
140-
royalBlue = 0xE16941,
141-
saddleBrown = 0x13458B,
142-
salmon = 0x7280FA,
143-
sandyBrown = 0x60A4F4,
144-
seaGreen = 0x578B2E,
145-
seaShell = 0xEEF5FF,
146-
sienna = 0x2D52A0,
147-
silver = 0xC0C0C0,
148-
skyBlue = 0xEBCE87,
149-
slateBlue = 0xCD5A6A,
150-
slateGray = 0x908070,
151-
slateGrey = 0x908070,
152-
snow = 0xFAFAFF,
153-
springGreen = 0x7FFF00,
154-
steelBlue = 0xB48246,
155-
tan = 0x8CB4D2,
156-
teal = 0x808000,
157-
thistle = 0xD8BFD8,
158-
tomato = 0x4763FF,
159-
turquoise = 0xD0E040,
160-
violet = 0xEE82EE,
161-
wheat = 0xB3DEF5,
162-
white = 0xFFFFFF,
163-
whiteSmoke = 0xF5F5F5,
164-
yellow = 0x00FFFF,
165-
yellowGreen = 0x32CD9A,
166-
}
15+
export const ColorByName = { // eslint-disable-line @typescript-eslint/naming-convention
16+
aliceBlue: 0xFFF8F0,
17+
amber: 0x00BFFF,
18+
antiqueWhite: 0xD7EBFA,
19+
aqua: 0xFFFF00,
20+
aquamarine: 0xD4FF7F,
21+
azure: 0xFFFFF0,
22+
beige: 0xDCF5F5,
23+
bisque: 0xC4E4FF,
24+
black: 0x000000,
25+
blanchedAlmond: 0xCDEBFF,
26+
blue: 0xFF0000,
27+
blueViolet: 0xE22B8A,
28+
brown: 0x2A2AA5,
29+
burlyWood: 0x87B8DE,
30+
cadetBlue: 0xA09E5F,
31+
chartreuse: 0x00FF7F,
32+
chocolate: 0x1E69D2,
33+
coral: 0x507FFF,
34+
cornflowerBlue: 0xED9564,
35+
cornSilk: 0xDCF8FF,
36+
crimson: 0x3C14DC,
37+
cyan: 0xFFFF00,
38+
darkBlue: 0x8B0000,
39+
darkBrown: 0x214365,
40+
darkCyan: 0x8B8B00,
41+
darkGoldenrod: 0x0B86B8,
42+
darkGray: 0xA9A9A9,
43+
darkGreen: 0x006400,
44+
darkGrey: 0xA9A9A9,
45+
darkKhaki: 0x6BB7BD,
46+
darkMagenta: 0x8B008B,
47+
darkOliveGreen: 0x2F6B55,
48+
darkOrange: 0x008CFF,
49+
darkOrchid: 0xCC3299,
50+
darkRed: 0x00008B,
51+
darkSalmon: 0x7A96E9,
52+
darkSeagreen: 0x8FBC8F,
53+
darkSlateBlue: 0x8B3D48,
54+
darkSlateGray: 0x4F4F2F,
55+
darkSlateGrey: 0x4F4F2F,
56+
darkTurquoise: 0xD1CE00,
57+
darkViolet: 0xD30094,
58+
deepPink: 0x9314FF,
59+
deepSkyBlue: 0xFFBF00,
60+
dimGray: 0x696969,
61+
dimGrey: 0x696969,
62+
dodgerBlue: 0xFF901E,
63+
fireBrick: 0x2222B2,
64+
floralWhite: 0xF0FAFF,
65+
forestGreen: 0x228B22,
66+
fuchsia: 0xFF00FF,
67+
gainsboro: 0xDCDCDC,
68+
ghostWhite: 0xFFF8F8,
69+
gold: 0x00D7FF,
70+
goldenrod: 0x20A5DA,
71+
gray: 0x808080,
72+
green: 0x008000,
73+
greenYellow: 0x2FFFAD,
74+
grey: 0x808080,
75+
honeydew: 0xF0FFF0,
76+
hotPink: 0xB469FF,
77+
indianRed: 0x5C5CCD,
78+
indigo: 0x82004B,
79+
ivory: 0xF0FFFF,
80+
khaki: 0x8CE6F0,
81+
lavender: 0xFAE6E6,
82+
lavenderBlush: 0xF5F0FF,
83+
lawnGreen: 0x00FC7C,
84+
lemonChiffon: 0xCDFAFF,
85+
lightBlue: 0xE6D8AD,
86+
lightCoral: 0x8080F0,
87+
lightCyan: 0xFFFFE0,
88+
lightGoldenrodYellow: 0xD2FAFA,
89+
lightGray: 0xD3D3D3,
90+
lightGreen: 0x90EE90,
91+
lightGrey: 0xD3D3D3,
92+
lightPink: 0xC1B6FF,
93+
lightSalmon: 0x7AA0FF,
94+
lightSeagreen: 0xAAB220,
95+
lightSkyBlue: 0xFACE87,
96+
lightSlateGray: 0x998877,
97+
lightSlateGrey: 0x998877,
98+
lightSteelBlue: 0xDEC4B0,
99+
lightyellow: 0xE0FFFF,
100+
lime: 0x00FF00,
101+
limeGreen: 0x32CD32,
102+
linen: 0xE6F0FA,
103+
magenta: 0xFF00FF,
104+
maroon: 0x000080,
105+
mediumAquamarine: 0xAACD66,
106+
mediumBlue: 0xCD0000,
107+
mediumOrchid: 0xD355BA,
108+
mediumPurple: 0xDB7093,
109+
mediumSeaGreen: 0x71B33C,
110+
mediumSlateBlue: 0xEE687B,
111+
mediumSpringGreen: 0x9AFA00,
112+
mediumTurquoise: 0xCCD148,
113+
mediumVioletRed: 0x8515C7,
114+
midnightBlue: 0x701919,
115+
mintCream: 0xFAFFF5,
116+
mistyRose: 0xE1E4FF,
117+
moccasin: 0xB5E4FF,
118+
navajoWhite: 0xADDEFF,
119+
navy: 0x800000,
120+
oldLace: 0xE6F5FD,
121+
olive: 0x008080,
122+
oliveDrab: 0x238E6B,
123+
orange: 0x00A5FF,
124+
orangeRed: 0x0045FF,
125+
orchid: 0xD670DA,
126+
paleGoldenrod: 0xAAE8EE,
127+
paleGreen: 0x98FB98,
128+
paleTurquoise: 0xEEEEAF,
129+
paleVioletRed: 0x9370DB,
130+
papayaWhip: 0xD5EFFF,
131+
peachPuff: 0xB9DAFF,
132+
peru: 0x3F85CD,
133+
pink: 0xCBC0FF,
134+
plum: 0xDDA0DD,
135+
powderBlue: 0xE6E0B0,
136+
purple: 0x800080,
137+
rebeccaPurple: 0x993366,
138+
red: 0x0000FF,
139+
rosyBrown: 0x8F8FBC,
140+
royalBlue: 0xE16941,
141+
saddleBrown: 0x13458B,
142+
salmon: 0x7280FA,
143+
sandyBrown: 0x60A4F4,
144+
seaGreen: 0x578B2E,
145+
seaShell: 0xEEF5FF,
146+
sienna: 0x2D52A0,
147+
silver: 0xC0C0C0,
148+
skyBlue: 0xEBCE87,
149+
slateBlue: 0xCD5A6A,
150+
slateGray: 0x908070,
151+
slateGrey: 0x908070,
152+
snow: 0xFAFAFF,
153+
springGreen: 0x7FFF00,
154+
steelBlue: 0xB48246,
155+
tan: 0x8CB4D2,
156+
teal: 0x808000,
157+
thistle: 0xD8BFD8,
158+
tomato: 0x4763FF,
159+
turquoise: 0xD0E040,
160+
violet: 0xEE82EE,
161+
wheat: 0xB3DEF5,
162+
white: 0xFFFFFF,
163+
whiteSmoke: 0xF5F5F5,
164+
yellow: 0x00FFFF,
165+
yellowGreen: 0x32CD9A,
166+
};

0 commit comments

Comments
 (0)