mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 08:12:24 +00:00
Read CSS colour names as the default renderer reads them
cssColor (src/render/color.js) now reads the colour names the default renderer knows, in any case, upper-cased as it looks them up: its table, with grey aliases, transparent and its lavendar_blush spelling, and no rebeccapurple. The local GeoJSON layers read simplestyle fill, stroke and marker colours through it, so a named colour no longer falls back to the layer colour; submarine cables read their marker colours the same way.
This commit is contained in:
1 parent
38e0750715
commit
85d4f4840c
4 files changed
+236
-7
No files matched your search
@@ -220,7 +220,43 @@ test('features keep their own simplestyle colours, widths and marker sizes', asy
|
||||
{ type: 'Point', coordinates: [0.002, 0.003] },
|
||||
{ 'marker-color': '#ffffff', 'marker-size': 'large' },
|
||||
),
|
||||
// CSS colour names, as the loader reads them.
|
||||
feature(
|
||||
'named',
|
||||
{ type: 'Polygon', coordinates: square(0.04, 0) },
|
||||
{ fill: 'Red' },
|
||||
),
|
||||
feature(
|
||||
'named-line',
|
||||
{
|
||||
type: 'LineString',
|
||||
coordinates: [
|
||||
[0, 0],
|
||||
[0, 0.01],
|
||||
],
|
||||
},
|
||||
{ stroke: 'navy' },
|
||||
),
|
||||
feature(
|
||||
'named-pin',
|
||||
{ type: 'Point', coordinates: [0.004, 0.003] },
|
||||
{ 'marker-color': 'white' },
|
||||
),
|
||||
]);
|
||||
assert.deepEqual(
|
||||
env.fake.set('fills').items.get('named').fill,
|
||||
[1, 0, 0, 0.3],
|
||||
);
|
||||
assert.deepEqual(env.fake.set('lines').items.get('named-line').style.color, [
|
||||
0,
|
||||
0,
|
||||
128 / 255,
|
||||
1,
|
||||
]);
|
||||
assert.match(
|
||||
env.fake.set('pins').items.get('named-pin').image.svg,
|
||||
/fill="rgba\(255,255,255,1\)"/,
|
||||
);
|
||||
assert.deepEqual(env.fake.set('fills').items.get('p').fill, [1, 0, 0, 0.5]);
|
||||
// `fill` alone keeps the layer's fill alpha.
|
||||
assert.deepEqual(env.fake.set('fills').items.get('q').fill, [0, 1, 0, 0.3]);
|
||||
|
||||
Reference in new issue
Block a user